Skip to content

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

Merged
merged 1 commit into from
Apr 9, 2021
Merged

Add package-list #9562

merged 1 commit into from
Apr 9, 2021

Conversation

jzheaux
Copy link
Contributor

@jzheaux jzheaux commented Apr 6, 2021

Closes gh-9528

@jzheaux jzheaux added in: build An issue in the build type: bug A general bug labels Apr 6, 2021
@jzheaux jzheaux added this to the 5.5.0-RC1 milestone Apr 6, 2021
Comment on lines 17 to 30
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
Copy link
Member

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')
Copy link
Member

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.

Copy link
Member

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.

@jzheaux jzheaux merged commit 3641756 into spring-projects:master Apr 9, 2021
@jzheaux jzheaux deleted the gh-9528 branch April 9, 2021 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: build An issue in the build type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Javadoc error when linking to Spring Security's javadoc using Java 8
2 participants