You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2018/11/12 11:19:55 UTC

[sling-org-apache-sling-feature-analyser] branch SLING-8078_double-check created (now e6109c8)

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

simonetripodi pushed a change to branch SLING-8078_double-check
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-analyser.git.


      at e6109c8  SLING-8078 - New Analyser task which is able to detect Export-Package dependencies between regions

This branch includes the following new commits:

     new e6109c8  SLING-8078 - New Analyser task which is able to detect Export-Package dependencies between regions

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[sling-org-apache-sling-feature-analyser] 01/01: SLING-8078 - New Analyser task which is able to detect Export-Package dependencies between regions

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch SLING-8078_double-check
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-analyser.git

commit e6109c83e7f9fa0a2f98abc65d7fa779a9be2bd7
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Mon Nov 12 12:19:41 2018 +0100

    SLING-8078 - New Analyser task which is able to detect Export-Package
    dependencies between regions
    
    handling the error case where the same package is listed in both the
    exporting and hiding regions
---
 .../task/impl/CheckApiRegionsDependencies.java     | 36 ++++++++++++++--------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckApiRegionsDependencies.java b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckApiRegionsDependencies.java
index 59332b2..fa35b39 100644
--- a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckApiRegionsDependencies.java
+++ b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckApiRegionsDependencies.java
@@ -58,18 +58,30 @@ public class CheckApiRegionsDependencies extends AbstractApiRegionsAnalyserTask
                 String exportedPackage = packageInfo.getName();
 
                 if (exportingApis.contains(exportedPackage)) {
-                    for (String uses : packageInfo.getUses()) {
-                        if (hidingApis.contains(uses)) {
-                            String errorMessage = String.format(
-                                    "Bundle '%s' (defined in feature '%s') declares '%s' in the '%s' header, enlisted in the '%s' region, which requires '%s' package that is in the '%s' region",
-                                    bundleDescriptor.getArtifact().getId(),
-                                    ctx.getFeature().getId(),
-                                    exportedPackage,
-                                    Constants.EXPORT_PACKAGE,
-                                    exportingApisName,
-                                    uses,
-                                    hidingApisName);
-                            ctx.reportError(errorMessage);
+                    if (hidingApis.contains(exportedPackage)) {
+                        String errorMessage = String.format(
+                                "Bundle '%s' (defined in feature '%s') declares '%s' in the '%s' header that is enlisted in both exporting '%s' and hiding '%s' APIs regions, please adjust Feature settings",
+                                bundleDescriptor.getArtifact().getId(),
+                                ctx.getFeature().getId(),
+                                exportedPackage,
+                                Constants.EXPORT_PACKAGE,
+                                exportingApisName,
+                                hidingApisName);
+                        ctx.reportError(errorMessage);
+                    } else {
+                        for (String uses : packageInfo.getUses()) {
+                            if (hidingApis.contains(uses)) {
+                                String errorMessage = String.format(
+                                        "Bundle '%s' (defined in feature '%s') declares '%s' in the '%s' header, enlisted in the '%s' region, which requires '%s' package that is in the '%s' region",
+                                        bundleDescriptor.getArtifact().getId(),
+                                        ctx.getFeature().getId(),
+                                        exportedPackage,
+                                        Constants.EXPORT_PACKAGE,
+                                        exportingApisName,
+                                        uses,
+                                        hidingApisName);
+                                ctx.reportError(errorMessage);
+                            }
                         }
                     }
                 }