Skip to content

Commit

Permalink
Check unused dependencies task can be up to date (#1426)
Browse files Browse the repository at this point in the history
* Check unused dependencies task can be up to date

Declare check unused dependencies as having no outputs. This means that
it should be up to date provided that inputs have not changed.

* Remove erroneous mavenCentral()

* Failures

* fix

* Add generated changelog entries
  • Loading branch information
j-baker authored Jun 23, 2020
1 parent 91fa68b commit 70d64e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-1426.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: Check unused dependencies task can be up to date
links:
- https://github.com/palantir/gradle-baseline/pull/1426
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public CheckUnusedDependenciesTask() {
sourceClasses = getProject().getObjects().property(FileCollection.class);
ignore = getProject().getObjects().setProperty(String.class);
ignore.set(Collections.emptySet());
getOutputs().upToDateWhen(_task -> true);
}

@TaskAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ class BaselineExactDependenciesTest extends AbstractPluginTest {
result.task(':sub-project-no-deps:checkImplicitDependencies').getOutcome() == TaskOutcome.SUCCESS
}

def 'check results can be up to date'() {
when:
setupMultiProject()
with(":sub-project-no-deps:checkUnusedDependencies").build();

then:
BuildResult result = with(":sub-project-no-deps:checkUnusedDependencies").build();
result.task(':sub-project-no-deps:checkUnusedDependencies').outcome == TaskOutcome.UP_TO_DATE
}

def 'checkUnusedDependencies fails when a redundant project dep is present'() {
when:
setupMultiProject()
Expand Down

0 comments on commit 70d64e5

Please sign in to comment.