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

Update spotless to 5.7.0 #358

Merged
merged 2 commits into from
Nov 5, 2020
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
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-358.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: Update spotless to 5.7.0
links:
- https://github.com/palantir/palantir-java-format/pull/358
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,25 @@
*/
package com.palantir.javaformat.gradle;

import com.google.common.collect.ImmutableList;
import org.gradle.api.Plugin;
import org.gradle.api.Project;

public class PalantirJavaFormatSpotlessPlugin implements Plugin<Project> {
// The spotless gradle plugin got renamed to 'com.diffplug.spotless' at version 5.0.0
private static final ImmutableList<String> SPOTLESS_PLUGINS =
ImmutableList.of("com.diffplug.gradle.spotless", "com.diffplug.spotless");

@Override
public void apply(Project project) {
project.getRootProject().getPluginManager().apply(PalantirJavaFormatProviderPlugin.class);

project.getPluginManager().withPlugin("java", plugin -> {
project.getPluginManager().withPlugin("com.diffplug.gradle.spotless", spotlessPlugin -> {
SpotlessInterop.addSpotlessJavaStep(project, PalantirJavaFormatProviderPlugin.CONFIGURATION_NAME);
});
SPOTLESS_PLUGINS.forEach(
spotlessPluginId -> project.getPluginManager().withPlugin(spotlessPluginId, spotlessPlugin -> {
SpotlessInterop.addSpotlessJavaStep(
project, PalantirJavaFormatProviderPlugin.CONFIGURATION_NAME);
}));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ class PalantirJavaFormatSpotlessPluginTest extends IntegrationTestKitSpec {

void setup() {
buildFile << """
buildscript {
dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.26.1"
}
}
// The 'com.diffplug.spotless:spotless-plugin-gradle' dependency is already added by palantir-java-format
plugins {
id 'java'
id 'com.palantir.java-format'
Expand All @@ -41,7 +37,7 @@ class PalantirJavaFormatSpotlessPluginTest extends IntegrationTestKitSpec {

def "formats with spotless when spotless is applied"() {
buildFile << """
apply plugin: 'com.diffplug.gradle.spotless'
apply plugin: 'com.diffplug.spotless'
""".stripIndent()

file('src/main/java/Main.java').text = invalidJavaFile
Expand Down
6 changes: 3 additions & 3 deletions versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
com.diffplug.durian:durian-collect:1.2.0 (3 constraints: 4d313bd2)
com.diffplug.durian:durian-core:1.2.0 (4 constraints: 2640ae56)
com.diffplug.durian:durian-io:1.2.0 (1 constraints: 1313c62d)
com.diffplug.spotless:spotless-lib:2.1.0 (2 constraints: 822455a4)
com.diffplug.spotless:spotless-lib-extra:2.1.0 (1 constraints: 1313c82d)
com.diffplug.spotless:spotless-plugin-gradle:4.5.1 (1 constraints: 0c050f36)
com.diffplug.spotless:spotless-lib:2.9.0 (2 constraints: 92242da6)
com.diffplug.spotless:spotless-lib-extra:2.9.0 (1 constraints: 1b13e02d)
com.diffplug.spotless:spotless-plugin-gradle:5.7.0 (1 constraints: 0e051936)
com.fasterxml.jackson.core:jackson-annotations:2.11.1 (1 constraints: 85123021)
com.fasterxml.jackson.core:jackson-core:2.11.1 (3 constraints: 5e41611c)
com.fasterxml.jackson.core:jackson-databind:2.11.1 (3 constraints: 10341167)
Expand Down
2 changes: 1 addition & 1 deletion versions.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
com.diffplug.spotless:spotless-plugin-gradle = 4.5.1
com.diffplug.spotless:spotless-plugin-gradle = 5.7.0
com.github.ben-manes.caffeine:caffeine = 2.8.5
com.google.auto.service:auto-service = 1.0-rc6
com.google.code.findbugs:jsr305 = 3.0.2
Expand Down