Skip to content

Commit

Permalink
Add checkOverbroadConstraints to check task (#1258)
Browse files Browse the repository at this point in the history
Add `checkOverbroadConstraints` to `check` task
  • Loading branch information
FinlayRJW authored Oct 28, 2024
1 parent 0b82090 commit 8318ac2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-1258.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Add `checkOverbroadConstraints` to `check` task
links:
- https://github.com/palantir/gradle-consistent-versions/pull/1258
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,14 @@ public final void apply(Project project) {
});
project.getTasks().named("check").configure(task -> task.dependsOn(checkNoUnusedConstraints));

// Currently checkOverbroadConstraints is not running as part of check while for testing - uncomment once
// testing is complete (also uncomment groovy test)
// TaskProvider<CheckOverbroadConstraints> checkOverbroadConstraints =
project.getTasks().register("checkOverbroadConstraints", CheckOverbroadConstraints.class, task -> {
task.getLockFile().set(project.getLayout().getProjectDirectory().file("versions.lock"));
task.getPropsFile()
.set(project.getLayout().getProjectDirectory().file("versions.props"));
});
// project.getTasks().named("check").configure(task ->
// task.dependsOn(checkOverbroadConstraints));
TaskProvider<CheckOverbroadConstraints> checkOverbroadConstraints = project.getTasks()
.register("checkOverbroadConstraints", CheckOverbroadConstraints.class, task -> {
task.getLockFile()
.set(project.getLayout().getProjectDirectory().file("versions.lock"));
task.getPropsFile()
.set(project.getLayout().getProjectDirectory().file("versions.props"));
});
project.getTasks().named("check").configure(task -> task.dependsOn(checkOverbroadConstraints));

// Create "platform" configuration in root project, which will hold the versions props constraints
project.getConfigurations().register(GCV_VERSIONS_PROPS_CONSTRAINTS_CONFIGURATION_NAME, conf -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ class CheckOverbroadConstraintsIntegrationSpec extends IntegrationSpec {
runTasks('checkOverbroadConstraints')
}

// Currently checkOverbroadConstraints is not running as part of check while for testing uncomment once re-added to check
// def 'Task should run as part of :check'() {
// expect:
// def result = runTasks('check', '-m')
// result.output.contains(':checkOverbroadConstraints')
// }
def 'Task should run as part of :check'() {
expect:
def result = runTasks('check', '-m')
result.output.contains(':checkOverbroadConstraints')
}

def 'All versions are pinned'() {
when:
Expand Down

0 comments on commit 8318ac2

Please sign in to comment.