Skip to content

Commit

Permalink
--write-locks no longer implicitly runs checkClassUniqueness task (#1389
Browse files Browse the repository at this point in the history
)

Running `./gradlew --write-locks` should be faster now, as it doesn't update your `baseline-class-uniqueness.lock` file implicitly anymore. To update this, you need to run `./gradlew checkClassUniqueness --write-locks`.
  • Loading branch information
iamdanfox authored Jun 11, 2020
1 parent f8fa3d1 commit 09ca77a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
7 changes: 7 additions & 0 deletions changelog/@unreleased/pr-1389.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: improvement
improvement:
description: Running `./gradlew --write-locks` should be faster now, as it doesn't
update your `baseline-class-uniqueness.lock` file implicitly anymore. To update
this, you need to run `./gradlew checkClassUniqueness --write-locks`.
links:
- https://github.com/palantir/gradle-baseline/pull/1389
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

package com.palantir.baseline.plugins;

import com.google.common.collect.ImmutableList;
import com.palantir.baseline.tasks.CheckClassUniquenessLockTask;
import java.util.List;
import org.gradle.StartParameter;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.plugins.JavaPlugin;
Expand Down Expand Up @@ -53,16 +50,5 @@ public final void apply(Project project) {
t.dependsOn(runtimeClasspath);
});
});

// Wire up dependencies so running `./gradlew --write-locks` will update the lock file
StartParameter startParam = project.getGradle().getStartParameter();
if (startParam.isWriteDependencyLocks()
&& !startParam.getTaskNames().contains(checkClassUniqueness.getName())) {
List<String> taskNames = ImmutableList.<String>builder()
.addAll(startParam.getTaskNames())
.add(checkClassUniqueness.getName())
.build();
startParam.setTaskNames(taskNames);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class BaselineClassUniquenessPluginIntegrationTest extends AbstractPluginTest {
result.getOutput().contains("javax.el.ArrayELResolver");
!lockfile.exists()

with("--write-locks").build()
with("checkClassUniqueness", "--write-locks").build()
lockfile.exists()

File expected = new File("src/test/resources/com/palantir/baseline/baseline-class-uniqueness.expected.lock")
Expand Down

0 comments on commit 09ca77a

Please sign in to comment.