Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support arbitrary resource paths in CARs #1480

Closed
hwellmann opened this issue Dec 1, 2013 · 2 comments
Closed

Support arbitrary resource paths in CARs #1480

hwellmann opened this issue Dec 1, 2013 · 2 comments

Comments

@hwellmann
Copy link

Problem

ceylon compile <module name> fails to put resources into the generated archive, unless the resource paths start with the module path prefix.

Example for module com.acme.foo:

source/com/acme/foo/Foo.ceylon
resource/com/acme/foo/Message.properties
resource/META-INF/services/com.acme.Bar

The resulting CAR contains

com/acme/foo/Foo.class
com/acme/foo/Message.properties

but the META-INF resource is missing.

For Java interoperability, some resources need to be in well-defined places like META-INF/, WEB-INF/, OSGI-INF/ and the like, so the ceylon tool should support arbitrary resource paths.

Possible solutions

When compiling a single module, any resources from the --resource directories can be included into the archive with the unmodified relative path.

This approach does not work well when compiling multiple modules simultaneously, e.g. with resources from ./resource/META-INF being copied to all module archives.

This can be avoided with some kind of relocation default, e.g.

resource/com/acme/module1/ROOT/META-INF/beans.xml
resource/com/acme/module2/ROOT/WEB-INF/web.xml

ending up in

com.acme.module1-1.0.0.car:
META-INF/beans.xml

com.acme.module2-1.0.0.car:
WEB-INF/web.xml

A new option for ceylon compile could be used to override the magic ROOT directory name if someone actually needs to have a ROOT entry in their archive.

@FroMage
Copy link
Member

FroMage commented Apr 3, 2014

@quintesse can you take a look at this one?

@quintesse quintesse self-assigned this Apr 30, 2014
quintesse added a commit to ceylon/ceylon-common that referenced this issue May 6, 2014
quintesse added a commit to ceylon/ceylon-common that referenced this issue May 6, 2014
quintesse added a commit that referenced this issue May 6, 2014
…--resource-root` option for the Ceylon compiler (#1480)
quintesse added a commit that referenced this issue May 6, 2014
…ing of the default `ROOT` special folder for resources (#1480)
quintesse added a commit that referenced this issue May 6, 2014
…mes trusting validation being done earlier in the chain (#1480)
quintesse added a commit that referenced this issue May 6, 2014
…ecial folder `ROOT` now get relocated to the root of the CAR file (#1480)
@quintesse
Copy link
Member

Done. By default uses the folder ROOT but this is overridable with the --resource-root option. (Btw, setting it to an empty string disables the feature).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants