You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/20 09:16:33 UTC
[maven-javadoc-plugin] 02/13: Group sets of sourcepaths per project,
in prepare of usage of module-source-path.
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master2
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
commit e1aedb7b0e3818df53e3d61efe4ae763211a51a3
Author: Robert Scholte <rf...@apache.org>
AuthorDate: Sat Nov 25 13:06:31 2017 +0000
Group sets of sourcepaths per project, in prepare of usage of module-source-path.
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1816292 13f79535-47bb-0310-9956-ffa450edef68
---
.../maven/plugins/javadoc/AbstractJavadocMojo.java | 50 +++++++++++++++-------
.../maven/plugins/javadoc/JavadocReport.java | 2 +-
2 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index df24821..b6ecbe0 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -1977,15 +1977,18 @@ public abstract class AbstractJavadocMojo
throw new MavenReportException( "Failed to generate javadoc options file: " + e.getMessage(), e );
}
- Collection<String> sourcePaths = getSourcePaths();
- List<String> files = getFiles( sourcePaths );
+ Collection<Collection<String>> sourcePaths = getSourcePaths();
+
+ Collection<String> collectedSourcePaths = collect( sourcePaths );
+
+ List<String> files = getFiles( collectedSourcePaths );
if ( !canGenerateReport( files ) )
{
return;
}
- List<String> packageNames = getPackageNames( sourcePaths, files );
- List<String> filesWithUnnamedPackages = getFilesWithUnnamedPackages( sourcePaths, files );
+ List<String> packageNames = getPackageNames( collectedSourcePaths, files );
+ List<String> filesWithUnnamedPackages = getFilesWithUnnamedPackages( collectedSourcePaths, files );
// ----------------------------------------------------------------------
// Find the javadoc executable and version
@@ -2177,6 +2180,16 @@ public abstract class AbstractJavadocMojo
}
}
+ protected final Collection<String> collect( Collection<Collection<String>> sourcePaths )
+ {
+ Collection<String> collectedSourcePaths = new LinkedHashSet<>();
+ for ( Collection<String> sp : sourcePaths )
+ {
+ collectedSourcePaths.addAll( sp );
+ }
+ return collectedSourcePaths;
+ }
+
/**
* Method to get the files on the specified source paths
*
@@ -2211,14 +2224,16 @@ public abstract class AbstractJavadocMojo
* @throws MavenReportException {@link MavenReportException}
* @see JavadocUtil#pruneDirs(MavenProject, List)
*/
- protected Collection<String> getSourcePaths()
+ protected Collection<Collection<String>> getSourcePaths()
throws MavenReportException
{
- Collection<String> sourcePaths;
+ Collection<Collection<String>> allSourcePaths = new ArrayList<>();
if ( StringUtils.isEmpty( sourcepath ) )
{
- sourcePaths = new ArrayList<>( JavadocUtil.pruneDirs( project, getProjectSourceRoots( project ) ) );
+
+ Collection<String> sourcePaths =
+ new ArrayList<>( JavadocUtil.pruneDirs( project, getProjectSourceRoots( project ) ) );
if ( project.getExecutionProject() != null )
{
@@ -2240,11 +2255,11 @@ public abstract class AbstractJavadocMojo
sourcePaths.addAll( l );
}
}
-
if ( includeDependencySources )
{
sourcePaths.addAll( getDependencySourcePaths() );
}
+ allSourcePaths.add( sourcePaths );
if ( isAggregator() && project.isExecutionRoot() )
{
@@ -2252,6 +2267,8 @@ public abstract class AbstractJavadocMojo
{
if ( subProject != project )
{
+ Collection<String> additionalSourcePaths = new ArrayList<>();
+
List<String> sourceRoots = getProjectSourceRoots( subProject );
if ( subProject.getExecutionProject() != null )
@@ -2262,7 +2279,7 @@ public abstract class AbstractJavadocMojo
ArtifactHandler artifactHandler = subProject.getArtifact().getArtifactHandler();
if ( "java".equals( artifactHandler.getLanguage() ) )
{
- sourcePaths.addAll( JavadocUtil.pruneDirs( subProject, sourceRoots ) );
+ additionalSourcePaths.addAll( JavadocUtil.pruneDirs( subProject, sourceRoots ) );
}
if ( getJavadocDirectory() != null )
@@ -2275,16 +2292,17 @@ public abstract class AbstractJavadocMojo
{
Collection<String> l = JavadocUtil.pruneDirs( subProject, Collections.singletonList(
javadocDir.getAbsolutePath() ) );
- sourcePaths.addAll( l );
+ additionalSourcePaths.addAll( l );
}
}
+ allSourcePaths.add( additionalSourcePaths );
}
}
}
}
else
{
- sourcePaths = new ArrayList<>( Arrays.asList( JavadocUtil.splitPath( sourcepath ) ) );
+ Collection<String> sourcePaths = new ArrayList<>( Arrays.asList( JavadocUtil.splitPath( sourcepath ) ) );
sourcePaths = JavadocUtil.pruneDirs( project, sourcePaths );
if ( getJavadocDirectory() != null )
{
@@ -2292,11 +2310,10 @@ public abstract class AbstractJavadocMojo
getJavadocDirectory().getAbsolutePath() ) );
sourcePaths.addAll( l );
}
+ allSourcePaths.add( sourcePaths );
}
- sourcePaths = JavadocUtil.pruneDirs( project, sourcePaths );
-
- return sourcePaths;
+ return allSourcePaths;
}
/**
@@ -4624,9 +4641,11 @@ public abstract class AbstractJavadocMojo
* @throws MavenReportException if any
* @see <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#javadocoptions">http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#javadocoptions</a>
*/
- private void addJavadocOptions( List<String> arguments, Collection<String> sourcePaths )
+ private void addJavadocOptions( List<String> arguments, Collection<Collection<String>> allSourcePaths )
throws MavenReportException
{
+ Collection<String> sourcePaths = collect( allSourcePaths );
+
validateJavadocOptions();
// see com.sun.tools.javadoc.Start#parseAndExecute(String argv[])
@@ -4721,6 +4740,7 @@ public abstract class AbstractJavadocMojo
{
sourcepath = StringUtils.join( sourcePaths.iterator(), File.pathSeparator );
}
+
addArgIfNotEmpty( arguments, "-sourcepath", JavadocUtil.quotedPathArgument( getSourcePath( sourcePaths ) ) );
if ( StringUtils.isNotEmpty( sourcepath ) && isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) )
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
index 3e8d01a..76b68c7 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
@@ -240,7 +240,7 @@ public class JavadocReport
List<String> files;
try
{
- sourcePaths = getSourcePaths();
+ sourcePaths = collect( getSourcePaths() );
files = getFiles( sourcePaths );
}
catch ( MavenReportException e )
--
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.