[ 
https://issues.apache.org/jira/browse/FELIX-2921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031738#comment-13031738
 ] 

Richard S. Hall commented on FELIX-2921:
----------------------------------------

I looked into updating the build according to the suggested approach. I got it 
to work, but then I tried to update main to use the same approach for 
consistency reasons. It didn't work for main, because it actually has a file 
where we do want some properties substituted, but not all. So the 
all-or-nothing approach of the proposed patch is not sufficient.

I then looked into specifying different delimiters for maven-resources-plugin. 
At first, this appeared to not be working, but then I realized we were having 
issues between maven and bnd both processing the resources. Maven would first 
copy and filter the resources, but then bnd would then overwrite the resources 
with the original unfiltered versions when creating the JAR file. So, the 
solution would be to only let Maven handle the resources.

Such an approach would work, but it is a little more complicated than that, 
since bnd will only copy resources into the resulting JAR file if they are in a 
private or exported package. So, any resources not in a package must be 
explicitly included in the Include-Resource command for bnd so they end up in 
the JAR file. Importantly, these resources must be the ones copied into the 
output directory by maven-resources-plugin, not the originals, otherwise any 
property filtering will not be retained.

So, in short, this approach would work, but it seems somewhat ugly to me, so 
I'm holding off on it for now. Perhaps someone with better knowledge in this 
area can help me find a better way.

> [Framework] Improve property substitution handling in build process
> -------------------------------------------------------------------
>
>                 Key: FELIX-2921
>                 URL: https://issues.apache.org/jira/browse/FELIX-2921
>             Project: Felix
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: framework-3.2.0
>         Environment: apple
>            Reporter: Stephane Chomat
>            Priority: Minor
>             Fix For: framework-4.0.0
>
>         Attachments: BadPropertiesTest.java
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> The properties like FRAMEWORK_SYSTEMPACKAGES are bad substituted by the 
> method Util.getDefaultProperty.
> The properties dollar is missing and the value is '' returned by 
> System.getProperty.
> The bad default value for FRAMEWORK_SYSTEMPACKAGES  is 
> org.osgi.framework; version=1.5.0, org.osgi.framework.launch; version=1.0.0, 
> org.osgi.framework.hooks.service; version=1.0.0, 
> org.osgi.service.packageadmin; version=1.2.0, org.osgi.service.startlevel; 
> version=1.1.0, org.osgi.service.url; version=1.0.0, org.osgi.util.tracker; 
> version=1.4.0 {jre-{java.specification.version}}
> You can add this test :
>     public void testDefaultProperty() {
>        Logger logger = new Logger();
>        
>        String jsv = System.getProperty("java.specification.version");
>        String jre = Util.getDefaultProperty(logger, "jre-"+jsv);
>         
>        String actual = Util.getDefaultProperty(logger, 
> Constants.FRAMEWORK_SYSTEMPACKAGES);
>        
>        assertEquals("org.osgi.framework; version=1.5.0, 
> org.osgi.framework.launch; version=1.0.0, org.osgi.framework.hooks.service; 
> version=1.0.0, org.osgi.service.packageadmin; version=1.2.0, 
> org.osgi.service.startlevel; version=1.1.0, org.osgi.service.url; 
> version=1.0.0, org.osgi.util.tracker; version=1.4.0 "+jre, actual);
>     }
> If you add this line before test, the test works
>      System.setProperty("dollar","$");

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to