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

ASF GitHub Bot commented on SLING-8003:
---------------------------------------

simonetripodi commented on issue #7: SLING-8003 - Interpolate Maven variables 
using the Maven Filtering APIs rather that iterate string replacing operations
URL: 
https://github.com/apache/sling-slingfeature-maven-plugin/pull/7#issuecomment-429844637
 
 
   Hi again @bosschaert 
   as requested, I included an Integration Test that aggregates features and 
produces a single JSON output; given one feature in the form:
   
   ```
   {
     "id": 
"${project.groupId}:${project.artifactId}:slingfeature:slingtest:${project.version}",
     "title": "${project.name}",
     "description": "${project.description}",
     "vendor": "${project.organization.name}",
     "variables": {
       "interpolated_variable": "${interpolated_variable}"
     },
     "framework-properties": {
       "sling.framework.install.incremental": 
"${sling.framework.install.incremental}",
       "sling.framework.install.startlevel": 
"${sling.framework.install.startlevel}",
       "sling.ignoreSystemProperties": "${sling.ignoreSystemProperties}"
     },
     "bundles":[
       {
         "id":"org.osgi:org.osgi.framework:${osgi.framework.version}",
         "start-level":"20"
       }
     ]
   }
   ```
   
   where POM descriptor is configured as
   
   ```
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.sling</groupId>
     <artifactId>slingfeature-maven-plugin-test</artifactId>
     <packaging>jar</packaging>
     <version>1.0.0-SNAPSHOT</version>
   
     <name>Apache Sling Features Maven plugin test</name>
     <description>This is just an Apache Sling Features Maven plugin test to 
verify variables interpolation</description>
   
     <organization>
       <name>The Apache Software Foundation</name>
       <url>https://www.apache.org/</url>
     </organization>
     <licenses>
       <license>
         <name>Apache License, Version 2.0</name>
         <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
         <distribution>repo</distribution>
       </license>
     </licenses>
   
     <properties>
       <interpolated_variable>true</interpolated_variable>
       <osgi.framework.version>1.9.0</osgi.framework.version>
       
<sling.framework.install.incremental>true</sling.framework.install.incremental>
       
<sling.framework.install.startlevel>1</sling.framework.install.startlevel>
       <sling.ignoreSystemProperties>true</sling.ignoreSystemProperties>
     </properties>
   ```
   
   the resulting output is
   
   ```
   {
     
"id":"org.apache.sling:slingfeature-maven-plugin-test:slingfeature:slingtest:1.0.0-SNAPSHOT",
     "title":"Apache Sling Features Maven plugin test",
     "description":"This is just an Apache Sling Features Maven plugin test to 
verify variables interpolation",
     "vendor":"The Apache Software Foundation",
     "variables":{
       "interpolated_variable":"true"
     },
     "bundles":[
       {
         "id":"org.osgi:org.osgi.framework:1.9.0",
         "start-level":"20"
       }
     ],
     "framework-properties":{
       "sling.framework.install.incremental":"true",
       "sling.framework.install.startlevel":"1",
       "sling.ignoreSystemProperties":"true"
     }
   }
   ```
   
   once you run `mvn clean install` you can find the resulting JSON Feature 
under `target/it/variables-interpolator/target/slingtest.json`
   
   PS you'll may notice a wrong interpolation for the `licenses/license` item, 
but it doesn't break the backward compatibility - and I am investigating about 
it with the Maven team.
   
   I hope you'll like that contribution! :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Interpolate Maven variables using the Maven Filtering APIs rather that 
> iterate string replacing operations
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-8003
>                 URL: https://issues.apache.org/jira/browse/SLING-8003
>             Project: Sling
>          Issue Type: Improvement
>          Components: Feature Model, Maven Plugins and Archetypes
>            Reporter: Simone Tripodi
>            Assignee: David Bosschaert
>            Priority: Major
>
> Currently, the {{Substitution}} class iterates over all variables and replace 
> them one by one in the whole input string.
> We can improve performances - and avoid writing custom variables interpolator 
> - by replacing its use with the {{MavenReaderFilter}} API.
> It will helpful also to avoid reading the Feature file and storing it in a 
> String, but keep working with {{Reader}} APIs.
> PR is coming



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to