You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2020/10/01 12:35:19 UTC

[sling-org-apache-sling-feature-analyser] branch master updated: SLING-9265 : Add support for optional bundles

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

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-analyser.git


The following commit(s) were added to refs/heads/master by this push:
     new 04185eb  SLING-9265 : Add support for optional bundles
04185eb is described below

commit 04185eb7db86e8c5774611869ecfaf12f7cec4b5
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Oct 1 14:34:58 2020 +0200

    SLING-9265 : Add support for optional bundles
---
 .gitignore                                                           | 1 +
 pom.xml                                                              | 2 +-
 .../sling/feature/analyser/task/impl/CheckBundleExportsImports.java  | 5 +++--
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5b783ed..c7f991e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@ maven-eclipse.xml
 *.iws
 *.bak
 .vlt
+.vscode
 .DS_Store
 jcr.log
 atlassian-ide-plugin.xml
diff --git a/pom.xml b/pom.xml
index fcb3297..844bcc3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,7 +116,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.feature</artifactId>
-            <version>1.2.6</version>
+            <version>1.3.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckBundleExportsImports.java b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckBundleExportsImports.java
index 37ecafa..7b7e1a8 100644
--- a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckBundleExportsImports.java
+++ b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckBundleExportsImports.java
@@ -26,6 +26,7 @@ import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
+import org.apache.sling.feature.ArtifactResolution;
 import org.apache.sling.feature.analyser.task.AnalyserTask;
 import org.apache.sling.feature.analyser.task.AnalyserTaskContext;
 import org.apache.sling.feature.scanner.BundleDescriptor;
@@ -171,13 +172,13 @@ public class CheckBundleExportsImports implements AnalyserTask {
                 ctx.reportWarning(key + " is exporting package(s) " + getPackageInfo(entry.getValue().importWithoutVersion, false) + " without a version.");
             }
 
-            if ( !entry.getValue().missingExports.isEmpty() ) {
+            if ( !entry.getValue().missingExports.isEmpty() && entry.getKey().getArtifact().getResolution() == ArtifactResolution.MANDATORY) {
                 ctx.reportError(key + " is importing package(s) " + getPackageInfo(entry.getValue().missingExports, false) + " in start level " +
                         String.valueOf(entry.getKey().getArtifact().getStartOrder())
                         + " but no bundle is exporting these for that start level.");
                 errorReported = true;
             }
-            if ( !entry.getValue().missingExportsWithVersion.isEmpty() ) {
+            if ( !entry.getValue().missingExportsWithVersion.isEmpty() && entry.getKey().getArtifact().getResolution() == ArtifactResolution.MANDATORY ) {
                 ctx.reportError(key + " is importing package(s) "
                         + getPackageInfo(entry.getValue().missingExportsWithVersion, true) + " in start level "
                         + String.valueOf(entry.getKey().getArtifact().getStartOrder())