You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2020/11/23 13:35:34 UTC
[sling-feature-converter-maven-plugin] 24/37: SLING-9827 Specify
the API Region to export packages into
This is an automated email from the ASF dual-hosted git repository.
davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-feature-converter-maven-plugin.git
commit cb5aaf6e887287c93133bd8782a38c3afa57d8d1
Author: David Bosschaert <bo...@adobe.com>
AuthorDate: Thu Oct 15 09:45:05 2020 +0100
SLING-9827 Specify the API Region to export packages into
Make this configuration available to the Maven Plugin
---
pom.xml | 2 +-
.../cpconverter/maven/mojos/ConvertCPMojo.java | 42 +++++++++++++++++-----
2 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/pom.xml b/pom.xml
index 992d3db..45f3647 100644
--- a/pom.xml
+++ b/pom.xml
@@ -160,7 +160,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.feature.cpconverter</artifactId>
- <version>1.0.14</version>
+ <version>1.0.15-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
diff --git a/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java b/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java
index 2c0fddd..93a35a7 100644
--- a/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java
+++ b/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java
@@ -84,6 +84,10 @@ public class ConvertCPMojo
public static final String CFG_IS_CONTENT_PACKAGE = "isContentPackage";
+ public static final String CFG_API_REGIONS = "apiRegions";
+
+ public static final String CFP_EXPORT_TO_API_REGION = "exportToApiRegion";
+
public static final boolean DEFAULT_STRING_VALIDATION = false;
public static final boolean DEFAULT_MERGE_CONFIGURATIONS = false;
@@ -165,6 +169,19 @@ public class ConvertCPMojo
@Parameter(property = CFG_IS_CONTENT_PACKAGE, defaultValue = DEFAULT_IS_CONTENT_PACKAGE + "")
private boolean isContentPackage;
+ /**
+ * Specify the API Regions that the generated feature is made part of
+ */
+ @Parameter(property = CFG_API_REGIONS)
+ private List<String> apiRegions;
+
+ /**
+ * Specify the API Region to export all exported packages to, if not specified
+ * packages will not be added to the api-regions extension.
+ */
+ @Parameter(property = CFP_EXPORT_TO_API_REGION)
+ private String exportToApiRegion;
+
@Parameter(defaultValue="${repositorySystemSession}")
private RepositorySystemSession repoSession;
@@ -195,16 +212,23 @@ public class ConvertCPMojo
}
}
try {
+ DefaultFeaturesManager featuresManager = new DefaultFeaturesManager(
+ mergeConfigurations,
+ bundleStartOrder,
+ fmOutput,
+ artifactIdOverride,
+ fmPrefix,
+ properties
+ );
+ if (!apiRegions.isEmpty())
+ featuresManager.setAPIRegions(apiRegions);
+
+ if (exportToApiRegion != null)
+ featuresManager.setExportToAPIRegion(exportToApiRegion);
+
ContentPackage2FeatureModelConverter converter = new ContentPackage2FeatureModelConverter(strictValidation)
.setFeaturesManager(
- new DefaultFeaturesManager(
- mergeConfigurations,
- bundleStartOrder,
- fmOutput,
- artifactIdOverride,
- fmPrefix,
- properties
- )
+ featuresManager
)
.setBundlesDeployer(
new DefaultArtifactsDeployer(
@@ -232,9 +256,9 @@ public class ConvertCPMojo
}
} else {
for(ContentPackage contentPackage: contentPackages) {
- getLog().info("Content Package Artifact File: " + contentPackage.toString() + ", is module CP: " + isContentPackage);
contentPackage.setExcludeTransitive(true);
contentPackage.setModuleIsContentPackage(isContentPackage);
+ getLog().info("Content Package Artifact File: " + contentPackage.toString() + ", is module CP: " + isContentPackage);
final Collection<Artifact> artifacts = contentPackage.getMatchingArtifacts(project, repoSystem, repoSession);
if (artifacts.isEmpty()) {
getLog().warn("No matching artifacts for " + contentPackage);