Skip to content

Commit

Permalink
No need for clean to trigger configuration of the spotless tasks if '…
Browse files Browse the repository at this point in the history
…base' was already applied (#1068)
  • Loading branch information
nedtwigg authored Jan 6, 2022
2 parents 0d95529 + 6f4fafa commit b3a6e36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).

## [Unreleased]
### Fixed
* If the `base` plugin has already been applied, then there is no need for configuration of the `clean` task to trigger configuration of the Spotless tasks ([#1068](https://github.com/diffplug/spotless/pull/1068)).
### Changed
* Bumped default DiKTat from `0.4.0` to `1.0.1`. This is a breaking change for DiKTat users on the default version, because some rules were renamed/changed. Check [DiKTat changelog](https://github.com/analysis-dev/diktat/releases) for details.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 DiffPlug
* Copyright 2016-2022 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,7 +63,13 @@ static void configureCleanTask(Project project, Consumer<Delete> onClean) {

/** clean removes the SpotlessCache, so we have to run after clean. */
static void taskMustRunAfterClean(Project project, TaskProvider<?> task) {
configureCleanTask(project, clean -> task.get().mustRunAfter(clean));
if (project.getPlugins().hasPlugin(BasePlugin.class)) {
// if we know that the clean task is around, then we can configure lazily
task.configure(t -> t.mustRunAfter(BasePlugin.CLEAN_TASK_NAME));
} else {
// otherwise, we trigger configuration when the clean task gets configured
configureCleanTask(project, clean -> task.get().mustRunAfter(clean));
}
}

static String capitalize(String input) {
Expand Down

0 comments on commit b3a6e36

Please sign in to comment.