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 2021/04/28 08:18:48 UTC
[sling-slingfeature-maven-plugin] branch master updated:
SLING-10338 : Allow empty javadoc api jar
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 06c696f SLING-10338 : Allow empty javadoc api jar
06c696f is described below
commit 06c696fd5cae700e6a2e1fcbf0571da1e0003bf0
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Apr 28 10:18:33 2021 +0200
SLING-10338 : Allow empty javadoc api jar
---
.../sling/feature/maven/mojos/ApisJarMojo.java | 32 ++++++++--------------
1 file changed, 11 insertions(+), 21 deletions(-)
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 c461f30..a36b961 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
@@ -570,29 +570,18 @@ public class ApisJarMojo extends AbstractIncludingFeatureMojo {
ext != null ? ext.getFramework() : null);
final Collection<ArtifactInfo> infos = generateJavadoc(ctx, regionName, links, javadocsDir, regionSupport, ctx.getConfig().isUseApiDependenciesForJavadoc());
- if (infos != null) {
- ctx.setJavadocDir(javadocsDir);
- final File javadocJar = createArchive(ctx, apiRegion, ArtifactType.JAVADOC,
- this.apiJavadocResources, infos, report);
- report(ctx, javadocJar, ArtifactType.JAVADOC, regionSupport, apiRegion, ctx.getConfig().isUseApiDependenciesForJavadoc(), report, links);
- } else {
- getLog().warn("Javadoc JAR will NOT be generated - sources directory " + ctx.getDeflatedSourcesDir()
- + " was empty or contained no Java files!");
- }
+ ctx.setJavadocDir(javadocsDir);
+ final File javadocJar = createArchive(ctx, apiRegion, ArtifactType.JAVADOC,
+ this.apiJavadocResources, infos, report);
+ report(ctx, javadocJar, ArtifactType.JAVADOC, regionSupport, apiRegion, ctx.getConfig().isUseApiDependenciesForJavadoc(), report, links);
if ( ctx.getConfig().isUseApiDependencies() && ctx.getConfig().isGenerateJavadocForAllApi() ) {
final File javadocsAllDir = new File(regionDir, ArtifactType.JAVADOC_ALL.getId());
final Collection<ArtifactInfo> infosForAll = generateJavadoc(ctx, regionName, links, javadocsAllDir, regionSupport, false);
- if (infosForAll != null) {
- ctx.setJavadocDir(javadocsAllDir);
- final File javadocJar = createArchive(ctx, apiRegion, ArtifactType.JAVADOC_ALL,
- this.apiJavadocResources, infosForAll, report);
- report(ctx, javadocJar, ArtifactType.JAVADOC, regionSupport, apiRegion, false, report, links);
- } else {
- getLog().warn("Javadoc JAR will NOT be generated - sources directory " + ctx.getDeflatedSourcesDir()
- + " was empty or contained no Java files!");
- }
-
+ ctx.setJavadocDir(javadocsAllDir);
+ final File javadocAllJar = createArchive(ctx, apiRegion, ArtifactType.JAVADOC_ALL,
+ this.apiJavadocResources, infosForAll, report);
+ report(ctx, javadocAllJar, ArtifactType.JAVADOC, regionSupport, apiRegion, false, report, links);
}
}
@@ -1745,6 +1734,8 @@ public class ApisJarMojo extends AbstractIncludingFeatureMojo {
final RegionSupport regionSupport,
final boolean useDependencies)
throws MojoExecutionException {
+ javadocDir.mkdirs();
+
final Collection<ArtifactInfo> usedInfos = new ArrayList<>();
final List<String> sourceDirectories = new ArrayList<>();
@@ -1764,7 +1755,7 @@ public class ApisJarMojo extends AbstractIncludingFeatureMojo {
}
if (javadocPackages.isEmpty()) {
- return null;
+ return Collections.emptyList();
}
// handle additional packages
@@ -1813,7 +1804,6 @@ public class ApisJarMojo extends AbstractIncludingFeatureMojo {
}
}
}
- javadocDir.mkdirs();
final JavadocExecutor javadocExecutor = new JavadocExecutor(javadocDir.getParentFile())
.addArgument("-public")