bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
531 stars 305 forks source link

includeresource unroll to relative path #4610

Closed rymsha closed 2 years ago

rymsha commented 3 years ago

bnd .gradle 5.3.0

Documentation has an example to unroll entire jar to a specific jar's folder -includeresource folder=@jar

Actually, I don't think syntax allows it, because assignment is not part of unroll `iclause ::= (unroll | copy) parameter unroll ::= '@' (PATH | URL) ( '!/' SELECTOR )?`

There is also example to unroll specific files to jar's root -includeresource @jar/osgi.jar!/!(LICENSE|about.html|org/*)

Is there any way to "unroll" and copy files without full path? -includeresource folder=@jar/a/b/* so jar will contain /folder/file not /folder/a/b/file

pkriens commented 3 years ago

I do not think this is proper syntax? @jar/a/b/* since it would try to unroll all files in the jar/a/b directory? As far as I recall, this wild carding does not work. If you mean @foo.jar!/a/b/*, I would expect the files in b to end up in folder.

If this is just a clarification, please discuss it at bnd.discourse.group. If you think it is an error, please provide a concrete example.

rymsha commented 3 years ago

Sorry for confusion, It is more like a feature request. There is no correct syntax for this, it is just an example.

If you mean @foo.jar!/a/b/*, I would expect the files in b to end up in folder.

Problem is, files in b end up in /folder/a/b, not in /folder

bjhargrave commented 3 years ago

Have you tried the flatten directive? https://bnd.bndtools.org/instructions/includeresource.html

-includeresource target/=hierarchy/;flatten:=true

rymsha commented 3 years ago

assets=@momentjs-2.11.1.jar!/META-INF/resources/webjars/*;flatten:=true files endup in /assets/META-INF/resources/webjars/... (I want them in /assets/...)

assets=@momentjs-2.11.1.jar!/META-INF/resources/webjars;flatten:=true files endup nowhere (well, probably because /META-INF/resources/webjars is a directory record in zip/jar)

so, flatten has no effect for unroll

pkriens commented 3 years ago

guess that was worth a try :-(

I am afraid I do not see a solution right now.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

stale[bot] commented 2 years ago

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Bnd/Bndtools or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

juergen-albert commented 2 years ago

I just stumbled upon this. @rymsha even if this issue is nearly a year old, what you asked for is now possible. https://bnd.bndtools.org/instructions/includeresource.html has now a rename, which is what you asked for here, as far as I can tell. You will find it under the unroll options.

rymsha commented 2 years ago

Thank you for an update. I'll try it out.