-
Notifications
You must be signed in to change notification settings - Fork 6k
Add package-list #9562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add package-list #9562
Conversation
package io.spring.gradle.convention; | ||
|
||
import java.io.File; | ||
import java.util.Collections; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.regex.Pattern; | ||
|
||
import org.gradle.api.Action; | ||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.plugins.JavaPluginConvention; | ||
import org.gradle.api.tasks.SourceSet; | ||
import org.gradle.api.tasks.javadoc.Javadoc; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
package io.spring.gradle.convention | ||
|
||
|
||
import java.util.regex.Pattern | ||
|
||
import org.gradle.api.Action | ||
import org.gradle.api.JavaVersion | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.plugins.JavaPluginConvention | ||
import org.gradle.api.tasks.SourceSet | ||
import org.gradle.api.tasks.javadoc.Javadoc | ||
import org.slf4j.Logger | ||
import org.slf4j.LoggerFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like these lines should probably be part of another commit?
@@ -49,6 +46,13 @@ public class JavadocApiPlugin implements Plugin<Project> { | |||
|
|||
api.setGroup("Documentation"); | |||
api.setDescription("Generates aggregated Javadoc API documentation."); | |||
api.doLast { | |||
if (JavaVersion.current().isJava11Compatible()) { | |||
File packageList = new File(api.destinationDir, 'package-list') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use project.file to create references to files as it is more robust. See https://docs.gradle.org/current/userguide/working_with_files.html#sec:single_file_paths
Never use new File(relative path) because this creates a path relative to the current working directory (CWD). Gradle can make no guarantees about the location of the CWD, which means builds that rely on it may break at any time.
Obviously this works if the path is absolute, but absolute paths have the problem of causing a cache miss if the build happens in one directory and then tries to run again in another directory. This is a common scenario when using Gradle enterprise cache (which we use) with a build happening on one machine that adds a cache entry and then someone building on another machine in a different directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be preferable to use Project.copy to copy the files as it is build in.
Closes gh-9528