You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/12/05 23:28:53 UTC

[sling-slingfeature-maven-plugin] 01/01: SLING-8890 - Exported packages with no java classes trigger API jars errors

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch feature/SLING-8890
in repository https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git

commit 5637590aa3c2dc3aba7d3874ae2d931cd15cdfde
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Fri Dec 6 00:28:12 2019 +0100

    SLING-8890 - Exported packages with no java classes trigger API jars errors
    
    Add a failing IT demonstrating the problem.
---
 .../invoker.properties                             | 17 +++++++
 .../apis-jar-exported-package-no-classes/pom.xml   | 59 ++++++++++++++++++++++
 .../src/main/features/main.json                    | 17 +++++++
 .../verify.bsh                                     | 30 +++++++++++
 4 files changed, 123 insertions(+)

diff --git a/src/it/apis-jar-exported-package-no-classes/invoker.properties b/src/it/apis-jar-exported-package-no-classes/invoker.properties
new file mode 100644
index 0000000..91f59c8
--- /dev/null
+++ b/src/it/apis-jar-exported-package-no-classes/invoker.properties
@@ -0,0 +1,17 @@
+# 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.
+
+invoker.goals = clean org.apache.sling:slingfeature-maven-plugin:apis-jar
+invoker.debug = true
diff --git a/src/it/apis-jar-exported-package-no-classes/pom.xml b/src/it/apis-jar-exported-package-no-classes/pom.xml
new file mode 100644
index 0000000..0f803ea
--- /dev/null
+++ b/src/it/apis-jar-exported-package-no-classes/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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 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/maven-v4_0_0.xsd">
+
+  <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>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>@project.groupId@</groupId>
+        <artifactId>@project.artifactId@</artifactId>
+        <version>@project.version@</version>
+        <extensions>true</extensions>
+        <executions>
+          <execution>
+            <id>analyze</id>
+            <phase>package</phase>
+            <goals>
+              <goal>apis-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <selection>
+            <filesInclude>**/*.json</filesInclude>
+          </selection>
+          <includeResources>
+            <includeResource>*.cnd</includeResource>
+            <includeResource>*.tld</includeResource>
+          </includeResources>
+          <javadocLinks>
+            <javadocLink>https://osgi.org/javadoc/r6/core/</javadocLink>
+            <javadocLink>https://osgi.org/javadoc/r6/annotation/</javadocLink>
+            <javadocLink>https://osgi.org/javadoc/r6/cmpn/</javadocLink>
+          </javadocLinks>
+          <incrementalApis>false</incrementalApis>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/it/apis-jar-exported-package-no-classes/src/main/features/main.json b/src/it/apis-jar-exported-package-no-classes/src/main/features/main.json
new file mode 100644
index 0000000..b2d6a9b
--- /dev/null
+++ b/src/it/apis-jar-exported-package-no-classes/src/main/features/main.json
@@ -0,0 +1,17 @@
+{
+  "id":"org.apache.sling:slingfeature-maven-plugin-test:1.0.0-SNAPSHOT",
+  "bundles":[
+    {
+      "id":"org.apache.aries:org.apache.aries.util:1.1.1"
+    }
+  ],
+  "api-regions:JSON|false": [
+    {
+      "name": "base",
+      "exports": [
+        "org.apache.aries.util",
+        "org.apache.aries.util.messages"
+      ]
+    }
+  ]
+}
diff --git a/src/it/apis-jar-exported-package-no-classes/verify.bsh b/src/it/apis-jar-exported-package-no-classes/verify.bsh
new file mode 100644
index 0000000..0e50ca5
--- /dev/null
+++ b/src/it/apis-jar-exported-package-no-classes/verify.bsh
@@ -0,0 +1,30 @@
+/*
+ * 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 java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File(basedir, "build.log");
+String log = FileUtils.fileRead(file);
+
+if (log.indexOf("Missing package org.apache.aries.util.messages") != 0) {
+    System.out.println("Analyzer failure, please see build log for details.");
+    return false;
+}
+return true;