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/09/22 07:45:49 UTC
[sling-slingfeature-maven-plugin] branch master updated: Use latest
feature model and api regions extension
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-slingfeature-maven-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 9b374d9 Use latest feature model and api regions extension
9b374d9 is described below
commit 9b374d9faa74a9c1d73e930d47aaa3a0793d91c7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Sep 22 09:45:21 2020 +0200
Use latest feature model and api regions extension
---
pom.xml | 4 +-
.../sling/feature/maven/mojos/ApisJarMojo.java | 59 ++++++++--------------
2 files changed, 24 insertions(+), 39 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7726e0e..7381c9c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -170,7 +170,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.feature</artifactId>
- <version>1.2.8</version>
+ <version>1.2.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
@@ -180,7 +180,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.feature.extension.apiregions</artifactId>
- <version>1.1.6</version>
+ <version>1.1.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
diff --git a/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java b/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java
index 0442e65..53754cc 100644
--- a/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java
+++ b/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java
@@ -41,8 +41,6 @@ import java.util.jar.Manifest;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import javax.json.JsonArray;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.felix.utils.manifest.Clause;
import org.apache.felix.utils.manifest.Parser;
@@ -78,8 +76,6 @@ import org.apache.maven.shared.utils.logging.MessageUtils;
import org.apache.sling.feature.Artifact;
import org.apache.sling.feature.ArtifactId;
import org.apache.sling.feature.ExecutionEnvironmentExtension;
-import org.apache.sling.feature.Extension;
-import org.apache.sling.feature.Extensions;
import org.apache.sling.feature.Feature;
import org.apache.sling.feature.builder.ArtifactProvider;
import org.apache.sling.feature.extension.apiregions.api.ApiExport;
@@ -426,43 +422,32 @@ public class ApisJarMojo extends AbstractIncludingFeatureMojo {
private ApiRegions getApiRegions(final Feature feature) throws MojoExecutionException {
ApiRegions regions = new ApiRegions();
- Extensions extensions = feature.getExtensions();
- Extension apiRegionsExtension = extensions.getByName(ApiRegions.EXTENSION_NAME);
- if (apiRegionsExtension != null) {
- if (apiRegionsExtension.getJSONStructure() == null) {
- getLog().info(
- "Feature file " + feature.getId().toMvnId() + " declares an empty '" + ApiRegions.EXTENSION_NAME
- + "' extension, no API JAR will be created");
- regions = null;
- } else {
- ApiRegions sourceRegions;
- try {
- sourceRegions = ApiRegions
- .parse((JsonArray) apiRegionsExtension.getJSONStructure());
- } catch (final IOException ioe) {
- throw new MojoExecutionException(ioe.getMessage(), ioe);
- }
-
- // calculate all api-regions first, taking the inheritance in account
- for (final ApiRegion r : sourceRegions.listRegions()) {
- if (r.getParent() != null && !this.incrementalApis) {
- for (final ApiExport exp : r.getParent().listExports()) {
- r.add(exp);
- }
- }
- if (isRegionIncluded(r.getName())) {
- getLog().debug("API Region " + r.getName()
- + " will not processed due to the configured include/exclude list");
- regions.add(r);
+ final ApiRegions sourceRegions;
+ try {
+ sourceRegions = ApiRegions.getApiRegions(feature);
+ } catch ( final IllegalArgumentException iae ) {
+ throw new MojoExecutionException(iae.getMessage(), iae);
+ }
+ if ( sourceRegions != null ) {
+ // calculate all api-regions first, taking the inheritance in account
+ for (final ApiRegion r : sourceRegions.listRegions()) {
+ if (r.getParent() != null && !this.incrementalApis) {
+ for (final ApiExport exp : r.getParent().listExports()) {
+ r.add(exp);
}
}
-
- if (regions.isEmpty()) {
- getLog().info("Feature file " + feature.getId().toMvnId()
- + " has no included api regions, no API JAR will be created");
- regions = null;
+ if (isRegionIncluded(r.getName())) {
+ getLog().debug("API Region " + r.getName()
+ + " will not processed due to the configured include/exclude list");
+ regions.add(r);
}
}
+
+ if (regions.isEmpty()) {
+ getLog().info("Feature file " + feature.getId().toMvnId()
+ + " has no included api regions, no API JAR will be created");
+ regions = null;
+ }
} else {
// create exports on the fly
regions.add(new ApiRegion(ApiRegion.GLOBAL) {