Skip to content

Commit

Permalink
Don't bother tracking inputs since they might not even exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed Dec 18, 2024
1 parent ca4ed37 commit 799baf9
Showing 1 changed file with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,26 +128,14 @@ private static void configureBwcProject(
List<DistributionProject> distributionProjects = resolveArchiveProjects(checkoutDir.get(), bwcVersion.get());

// Setup gradle user home directory
// We manually setup input/outputs here to avoid having the entire gradle user home directory as an output directory, as that
// makes task output snapshotting very expensive
// We don't use a normal `Copy` task here as snapshotting the entire gradle user home is very expensive. This task is cheap, so
// up-to-date checking doesn't buy us much
project.getTasks().register("setupGradleUserHome", task -> {
task.getInputs()
.file(new File(project.getGradle().getGradleUserHomeDir().getAbsolutePath(), "gradle.properties"))
.withPathSensitivity(PathSensitivity.NONE);
task.getInputs()
.dir(new File(project.getGradle().getGradleUserHomeDir().getAbsolutePath(), "init.d"))
.withPathSensitivity(PathSensitivity.NONE);
task.getOutputs()
.file(
new File(project.getGradle().getGradleUserHomeDir().getAbsolutePath() + "-" + project.getName(), "gradle.properties")
);
task.getOutputs()
.dir(new File(project.getGradle().getGradleUserHomeDir().getAbsolutePath() + "-" + project.getName(), "init.d"));

task.doLast(t -> {
fileSystemOperations.copy(copy -> {
copy.into(project.getGradle().getGradleUserHomeDir().getAbsolutePath() + "-" + project.getName());
copy.from(project.getGradle().getGradleUserHomeDir().getAbsolutePath(), copySpec -> {
String gradleUserHome = project.getGradle().getGradleUserHomeDir().getAbsolutePath();
copy.into(gradleUserHome + "-" + project.getName());
copy.from(gradleUserHome, copySpec -> {
copySpec.include("gradle.properties");
copySpec.include("init.d/*");
});
Expand Down

0 comments on commit 799baf9

Please sign in to comment.