Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need for clean to trigger configuration of the spotless tasks if 'base' was already applied #1068

Merged
merged 8 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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