karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject karaf git commit: [KARAF-4897] Add an option to simplify bundle dependencies
Date Wed, 04 Jan 2017 21:06:21 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-4.0.x 84515ee44 -> 8ea352180


[KARAF-4897] Add an option to simplify bundle dependencies


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/8ea35218
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/8ea35218
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/8ea35218

Branch: refs/heads/karaf-4.0.x
Commit: 8ea352180978d69efd29d9daa90f474d52be41a8
Parents: 84515ee
Author: Stephen Kitt <skitt@redhat.com>
Authored: Thu Dec 15 10:50:25 2016 +0100
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Wed Jan 4 21:50:14 2017 +0100

----------------------------------------------------------------------
 .../src/it/test-simplify-bundles/control.xml    | 39 ++++++++++
 .../src/it/test-simplify-bundles/pom.xml        | 76 ++++++++++++++++++
 .../simplify-bundle-a/pom.xml                   | 54 +++++++++++++
 .../simplify-bundle-a/src/main/java/test/A.java | 25 ++++++
 .../simplify-bundle-b/pom.xml                   | 66 ++++++++++++++++
 .../simplify-bundle-b/src/main/java/test/B.java | 25 ++++++
 .../simplify-feature-a/pom.xml                  | 71 +++++++++++++++++
 .../simplify-feature-as-is/pom.xml              | 71 +++++++++++++++++
 .../simplify-feature-reduced/pom.xml            | 72 +++++++++++++++++
 .../simplify-features/pom.xml                   | 81 ++++++++++++++++++++
 .../src/it/test-simplify-bundles/verify.bsh     | 34 ++++++++
 .../features/GenerateDescriptorMojo.java        | 28 ++++++-
 12 files changed, 641 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml
new file mode 100644
index 0000000..94cb36a
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/control.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="simplify-features">
+    <repository>mvn:test/simplify-feature-a/1.0-SNAPSHOT/xml/features</repository>
+    <feature name="simplify-feature-as-is" description="simplify-feature-as-is" version="1.0.0.SNAPSHOT">
+        <details>Check that bundles are simplified</details>
+        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">simplify-feature-a</feature>
+        <bundle>mvn:test/simplify-bundle-b/1.0-SNAPSHOT</bundle>
+        <bundle>mvn:test/simplify-bundle-a/1.0-SNAPSHOT</bundle>
+    </feature>
+    <feature name="simplify-feature-reduced" description="simplify-feature-reduced" version="1.0.0.SNAPSHOT">
+        <details>Check that bundles are simplified</details>
+        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">simplify-feature-a</feature>
+        <bundle>mvn:test/simplify-bundle-b/1.0-SNAPSHOT</bundle>
+    </feature>
+    <feature name="simplify-features" description="simplify-features" version="1.0.0.SNAPSHOT">
+        <details>Check that bundles are simplified</details>
+        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">simplify-feature-as-is</feature>
+        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">simplify-feature-reduced</feature>
+    </feature>
+</features>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/pom.xml b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/pom.xml
new file mode 100644
index 0000000..b61c6a3
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>test</groupId>
+    <artifactId>test-simplify-bundles</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <packaging>pom</packaging>
+
+    <description>Check that bundles are simplified</description>
+
+    <!--
+    There are two bundles, a and b; b depends on a, and on feature-a which contains a.
+    When simplifying, this should be reduced to a dependency on feature-a only.
+    Two features are produced and aggregated to verify that enabling and disabling the
+    functionality works.
+    -->
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <modules>
+        <module>simplify-bundle-a</module>
+        <module>simplify-bundle-b</module>
+        <module>simplify-feature-a</module>
+        <module>simplify-feature-as-is</module>
+        <module>simplify-feature-reduced</module>
+        <module>simplify-features</module>
+    </modules>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>@pom.version@</version>
+                <executions>
+                    <execution>
+                        <id>generate-features-file</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>features-generate-descriptor</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/pom.xml
new file mode 100644
index 0000000..27dfccd
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>test</groupId>
+        <artifactId>test-simplify-bundles</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <groupId>test</groupId>
+    <artifactId>simplify-bundle-a</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <packaging>bundle</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.3.7</version>
+                <extensions>true</extensions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/src/main/java/test/A.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/src/main/java/test/A.java
b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/src/main/java/test/A.java
new file mode 100644
index 0000000..9aa5496
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-a/src/main/java/test/A.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package test.a;
+
+public class A
+{
+    public static String ASTRING = "A-string";
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/pom.xml
new file mode 100644
index 0000000..f84310f
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/pom.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>test</groupId>
+        <artifactId>test-simplify-bundles</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <groupId>test</groupId>
+    <artifactId>simplify-bundle-b</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <packaging>bundle</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>simplify-feature-a</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>simplify-bundle-a</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.3.7</version>
+                <extensions>true</extensions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/src/main/java/test/B.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/src/main/java/test/B.java
b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/src/main/java/test/B.java
new file mode 100644
index 0000000..b66ddea
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-bundle-b/src/main/java/test/B.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package test.b;
+
+public class B
+{
+    public static String BSTRING = "B-string";
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-a/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-a/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-a/pom.xml
new file mode 100644
index 0000000..abbf8a9
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-a/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>test</groupId>
+        <artifactId>test-simplify-bundles</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <groupId>test</groupId>
+    <artifactId>simplify-feature-a</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <packaging>feature</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>simplify-bundle-a</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>@pom.version@</version>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <id>generate-features-file</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>features-generate-descriptor</goal>
+                        </goals>
+                        <configuration>
+                            <enableGeneration>true</enableGeneration>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-as-is/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-as-is/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-as-is/pom.xml
new file mode 100644
index 0000000..3bab1f6
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-as-is/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>test</groupId>
+        <artifactId>test-simplify-bundles</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <groupId>test</groupId>
+    <artifactId>simplify-feature-as-is</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <packaging>feature</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>simplify-bundle-b</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>@pom.version@</version>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <id>generate-features-file</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>features-generate-descriptor</goal>
+                        </goals>
+                        <configuration>
+                            <enableGeneration>true</enableGeneration>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-reduced/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-reduced/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-reduced/pom.xml
new file mode 100644
index 0000000..0c3247b
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-feature-reduced/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>test</groupId>
+        <artifactId>test-simplify-bundles</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <groupId>test</groupId>
+    <artifactId>simplify-feature-reduced</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <packaging>feature</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>simplify-bundle-b</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>@pom.version@</version>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <id>generate-features-file</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>features-generate-descriptor</goal>
+                        </goals>
+                        <configuration>
+                            <enableGeneration>true</enableGeneration>
+                            <simplifyBundleDependencies>true</simplifyBundleDependencies>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-features/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-features/pom.xml
b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-features/pom.xml
new file mode 100644
index 0000000..da5ca35
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/simplify-features/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>test</groupId>
+        <artifactId>test-simplify-bundles</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <groupId>test</groupId>
+    <artifactId>simplify-features</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <packaging>feature</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>simplify-feature-as-is</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>simplify-feature-reduced</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>@pom.version@</version>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <id>generate-features-file</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>features-generate-descriptor</goal>
+                        </goals>
+                        <configuration>
+                            <enableGeneration>true</enableGeneration>
+                            <aggregateFeatures>true</aggregateFeatures>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh
new file mode 100644
index 0000000..78f37fd
--- /dev/null
+++ b/tooling/karaf-maven-plugin/src/it/test-simplify-bundles/verify.bsh
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.custommonkey.xmlunit.*;
+import java.io.*;
+import java.lang.*;
+
+Reader r = new FileReader(new File(basedir, "control.xml"));
+
+// load the features file pushed to the repository
+File generated = new File(basedir, "simplify-features/target/feature/feature.xml");
+if (generated.exists()) {
+    try {
+        XMLAssert.assertXMLEqual(r, new FileReader(generated));
+        return true;
+    } catch (Throwable ignored) { }
+}
+return false;

http://git-wip-us.apache.org/repos/asf/karaf/blob/8ea35218/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
index 1ee0a65..55355a4 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/GenerateDescriptorMojo.java
@@ -251,6 +251,14 @@ public class GenerateDescriptorMojo extends MojoSupport {
     @Parameter(defaultValue = "false")
     private boolean includeTransitiveVersionRanges;
 
+    /**
+     * Flag indicating whether the plugin should simplify bundle dependencies. If the flag
is set to {@code true}
+     * and a bundle dependency is determined to be included in a feature dependency, the
bundle dependency is
+     * dropped.
+     */
+    @Parameter(defaultValue = "false")
+    private boolean simplifyBundleDependencies;
+    
     // *************************************************
     // READ-ONLY MAVEN PLUGIN PARAMETERS
     // *************************************************
@@ -459,7 +467,11 @@ public class GenerateDescriptorMojo extends MojoSupport {
                     if (bundle == null) {
                         bundle = objectFactory.createBundle();
                         bundle.setLocation(bundleName);
-                        if (!"provided".equals(entry.getScope()) || !ignoreScopeProvided)
{
+                        // Check the features this feature depends on don't already contain
the dependency
+                        // TODO Perhaps only for transitive dependencies?
+                        boolean includedTransitively =
+                            simplifyBundleDependencies && isBundleIncludedTransitively(feature,
otherFeatures, bundle);
+                        if (!includedTransitively && (!"provided".equals(entry.getScope())
|| !ignoreScopeProvided)) {
                             feature.getBundle().add(bundle);
                         }
                     }
@@ -543,6 +555,20 @@ public class GenerateDescriptorMojo extends MojoSupport {
         }
     }
 
+    private boolean isBundleIncludedTransitively(Feature feature, Map<Dependency, Feature>
otherFeatures,
+                                                 Bundle bundle) {
+        for (Dependency dependency : feature.getFeature()) {
+            Feature otherFeature = otherFeatures.get(dependency);
+            if (otherFeature != null) {
+                if (otherFeature.getBundle().contains(bundle) || isBundleIncludedTransitively(otherFeature,
+                    otherFeatures, bundle)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
     /**
      * Extract the MANIFEST from the give file.
      */


Mime
View raw message