FELIX-4135: the analyzeJar() method returns false. Deactivate scrplugin DS annotation scanner.
Append to Service-Component header.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1512721 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/bnd-scr-plugin/pom.xml b/scrplugin/bnd-scr-plugin/pom.xml
index f03c63b..2b5e876 100644
--- a/scrplugin/bnd-scr-plugin/pom.xml
+++ b/scrplugin/bnd-scr-plugin/pom.xml
@@ -54,12 +54,6 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
- <version>1.2.4</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-all</artifactId>
<version>4.0</version>
@@ -118,7 +112,7 @@
</goals>
<configuration>
<includeArtifactIds>
- org.osgi.compendium,asm-all,org.apache.felix.scr.generator,org.apache.felix.scr.annotations,org.apache.felix.scr.ds-annotations
+ org.osgi.compendium,asm-all,org.apache.felix.scr.generator,org.apache.felix.scr.annotations
</includeArtifactIds>
<outputDirectory>
${project.build.outputDirectory}
diff --git a/scrplugin/bnd-scr-plugin/src/main/java/org/apache/felix/scrplugin/bnd/SCRDescriptorBndPlugin.java b/scrplugin/bnd-scr-plugin/src/main/java/org/apache/felix/scrplugin/bnd/SCRDescriptorBndPlugin.java
index bd180eb..b115e02 100644
--- a/scrplugin/bnd-scr-plugin/src/main/java/org/apache/felix/scrplugin/bnd/SCRDescriptorBndPlugin.java
+++ b/scrplugin/bnd-scr-plugin/src/main/java/org/apache/felix/scrplugin/bnd/SCRDescriptorBndPlugin.java
@@ -179,7 +179,7 @@
putResource(analyzer, scrFile);
}
sb.setLength(sb.length() - 1);
- analyzer.setProperty("Service-Component", sb.toString());
+ addServiceComponentHeader(analyzer, sb.toString());
}
// Embed metatype descriptors in target jar
@@ -196,7 +196,19 @@
} finally {
log.close();
}
- return true;
+ return false; // do not reanalyze bundle classpath because our plugin has not changed it.
+ }
+
+ private void addServiceComponentHeader(Analyzer analyzer, String components) {
+ String oldComponents = analyzer.getProperty("Service-Component");
+ if (oldComponents != null && oldComponents.length() > 0) {
+ StringBuilder sb = new StringBuilder(oldComponents);
+ sb.append(",");
+ sb.append(components);
+ components = sb.toString();
+ }
+ log.info("Setting Service-Component header: " + components);
+ analyzer.setProperty("Service-Component", components);
}
private void init(Analyzer analyzer) {