Skip to content
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

Update gradle wrapper to 7.4 #81963

Merged
merged 7 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix deprecations on ignoring empty folders for task inputs
  • Loading branch information
breskeby committed Feb 8, 2022
commit 0e0e8760605f595757d096181965ee59764bfc7a
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.gradle.api.file.FileCollection;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.IgnoreEmptyDirectories;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
Expand Down Expand Up @@ -68,6 +69,7 @@ public LicenseHeadersTask() {
* constructor can write to it.
*/
@InputFiles
@IgnoreEmptyDirectories
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the deprecation exactly? When is the annotation required?

Copy link
Contributor Author

@breskeby breskeby Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exact deprecation is "Relying on FileTrees for ignoring empty directories when using @SkipWhenEmpty has been deprecated" and here you can see how it affected our build when I initially tested 7.4-rc-1

https://gradle-enterprise.elastic.co/s/johhiz7bfeq7c/deprecations#0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read that documentation about 10 times and I'm still confused 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is, that this fileTree is considered empty when @SkipWhenEmpty is used:

dir
|__emptyDir1
|__emptyDir2

but for non empty fileTree inputs like

dir
|__emptyDir1
|__someFile.txt

and

dir
|__emptyDir1
|__emptyDir2
|__someFile.txt

those two would not considered equal as they have different empty dirs in it. This in combination with @SkipWhenEmpty is deprecated. Adding @IgnoreEmptyDirectories makes both fileTrees considered to be identical by gradle when calculating inputs / outputs

@SkipWhenEmpty
@PathSensitive(PathSensitivity.RELATIVE)
public List<FileCollection> getJavaFiles() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.gradle.api.file.FileTree;
import org.gradle.api.file.ProjectLayout;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.tasks.IgnoreEmptyDirectories;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.OutputFile;
Expand Down Expand Up @@ -75,6 +76,7 @@ private static boolean isExecutableFile(File file) {
* Returns the files this task will check
*/
@InputFiles
@IgnoreEmptyDirectories
@SkipWhenEmpty
public FileCollection getFiles() {
return getSources().get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.IgnoreEmptyDirectories;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
Expand Down Expand Up @@ -90,6 +91,7 @@ public ForbiddenPatternsTask(ProjectLayout projectLayout) {
}

@InputFiles
@IgnoreEmptyDirectories
@PathSensitive(PathSensitivity.RELATIVE)
@SkipWhenEmpty
public FileCollection getFiles() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.gradle.api.file.FileSystemOperations;
import org.gradle.api.file.FileTree;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.tasks.IgnoreEmptyDirectories;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
Expand Down Expand Up @@ -417,6 +418,7 @@ public DirectoryProperty getOutputDirectory() {
}

@SkipWhenEmpty
@IgnoreEmptyDirectories
@InputFiles
public FileTree getTestFiles() {
return sourceDirectory.getAsFileTree().matching(testPatternSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.gradle.api.file.ProjectLayout;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.tasks.IgnoreEmptyDirectories;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
Expand Down Expand Up @@ -86,6 +87,7 @@ public boolean isSkipHasRestTestCheck() {
}

@SkipWhenEmpty
@IgnoreEmptyDirectories
@InputFiles
public FileTree getInputDir() {
FileTree coreFileTree = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.gradle.api.file.ProjectLayout;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.tasks.IgnoreEmptyDirectories;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Optional;
Expand Down Expand Up @@ -98,6 +99,7 @@ public Map<String, String> getSubstitutions() {
}

@SkipWhenEmpty
@IgnoreEmptyDirectories
@InputFiles
public FileTree getInputDir() {
FileTree coreFileTree = null;
Expand Down