Skip to content

Commit

Permalink
Bump google-java-format to 1.19.2 (#1971)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg committed Jan 14, 2024
2 parents fd2cc2f + f4e631c commit 8b6157f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
* New static method to `DiffMessageFormatter` which allows to retrieve diffs with their line numbers ([#1960](https://github.com/diffplug/spotless/issues/1960))
### Changes
* Use palantir-java-format 2.39.0 on Java 21. ([#1948](https://github.com/diffplug/spotless/pull/1948))
* Bump default `googleJavaFormat` version to latest `1.18.1` -> `1.19.2`. ([#1971](https://github.com/diffplug/spotless/pull/1971))

## [2.43.1] - 2023-12-04
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ dependencies {
gherkinCompileOnly 'io.cucumber:gherkin-utils:8.0.2'
gherkinCompileOnly 'org.slf4j:slf4j-api:2.0.0'
// googleJavaFormat
googleJavaFormatCompileOnly 'com.google.googlejavaformat:google-java-format:1.18.1'
googleJavaFormatCompileOnly 'com.google.googlejavaformat:google-java-format:1.19.2'
// gson
gsonCompileOnly 'com.google.code.gson:gson:2.10.1'
// jackson
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2024 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 @@ -83,7 +83,7 @@ public static FormatterStep create(String groupArtifact, String version, String
.addMin(11, "1.8") // we only support google-java-format >= 1.8 due to api changes
.addMin(16, "1.10.0") // java 16 requires at least 1.10.0 due to jdk api changes in JavaTokenizer
.addMin(21, "1.17.0") // java 21 requires at least 1.17.0 due to https://github.com/google/google-java-format/issues/898
.add(11, "1.18.1"); // default version
.add(11, "1.19.2"); // default version

public static String defaultGroupArtifact() {
return MAVEN_COORDINATE;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2024 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
1 change: 1 addition & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
## [Unreleased]
### Changes
* Use palantir-java-format 2.39.0 on Java 21. ([#1948](https://github.com/diffplug/spotless/pull/1948))
* Bump default `googleJavaFormat` version to latest `1.18.1` -> `1.19.2`. ([#1971](https://github.com/diffplug/spotless/pull/1971))
* Bump default `diktat` version to latest `1.2.5` -> `2.0.0`. ([#1972](https://github.com/diffplug/spotless/pull/1972))

## [6.23.3] - 2023-12-04
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2024 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 @@ -36,8 +36,6 @@
import com.diffplug.common.base.Unhandled;
import com.diffplug.common.collect.ImmutableList;
import com.diffplug.spotless.Provisioner;
import com.diffplug.spotless.java.GoogleJavaFormatStep;
import com.diffplug.spotless.java.PalantirJavaFormatStep;

/** Should be package-private. */
class GradleProvisioner {
Expand Down Expand Up @@ -119,16 +117,7 @@ private static Provisioner forConfigurationContainer(Project project, Configurat
+ new Request(withTransitives, mavenCoords).hashCode());
mavenCoords.stream()
.map(dependencies::create)
.forEach(dependency -> {
config.getDependencies().add(dependency);
String coordinate = dependency.getGroup() + ":" + dependency.getName();
if (coordinate.startsWith(GoogleJavaFormatStep.MAVEN_COORDINATE) ||
coordinate.startsWith(PalantirJavaFormatStep.MAVEN_COORDINATE)) {
// Use Guava 32.1.3, see https://github.com/google/guava/issues/6657.
// TODO: May remove this after https://github.com/google/google-java-format/pull/996 and https://github.com/palantir/palantir-java-format/issues/957 are released.
config.getDependencies().add(dependencies.create("com.google.guava:guava:32.1.3-jre"));
}
});
.forEach(config.getDependencies()::add);
config.setDescription(mavenCoords.toString());
config.setTransitive(withTransitives);
config.setCanBeConsumed(false);
Expand Down
1 change: 1 addition & 0 deletions plugin-maven/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
* M2E support: Emit file specific errors during incremental build. ([#1960](https://github.com/diffplug/spotless/issues/1960))
### Changes
* Use palantir-java-format 2.39.0 on Java 21. ([#1948](https://github.com/diffplug/spotless/pull/1948))
* Bump default `googleJavaFormat` version to latest `1.18.1` -> `1.19.2`. ([#1971](https://github.com/diffplug/spotless/pull/1971))
* Bump default `diktat` version to latest `1.2.5` -> `2.0.0`. ([#1972](https://github.com/diffplug/spotless/pull/1972))

## [2.41.1] - 2023-12-04
Expand Down
15 changes: 2 additions & 13 deletions testlib/src/main/java/com/diffplug/spotless/TestProvisioner.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2024 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Stream;

import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
Expand All @@ -42,8 +41,6 @@
import com.diffplug.common.base.Suppliers;
import com.diffplug.common.collect.ImmutableSet;
import com.diffplug.common.io.Files;
import com.diffplug.spotless.java.GoogleJavaFormatStep;
import com.diffplug.spotless.java.PalantirJavaFormatStep;

public class TestProvisioner {
public static Project gradleProject(File dir) {
Expand All @@ -68,15 +65,7 @@ private static Provisioner createWithRepositories(Consumer<RepositoryHandler> re
Project project = TestProvisioner.gradleProject(tempDir);
repoConfig.accept(project.getRepositories());
return (withTransitives, mavenCoords) -> {
boolean forceGuava = mavenCoords.stream().anyMatch(coordinate -> coordinate.startsWith(GoogleJavaFormatStep.MAVEN_COORDINATE) ||
coordinate.startsWith(PalantirJavaFormatStep.MAVEN_COORDINATE));
Stream<String> coordinateStream = mavenCoords.stream();
if (forceGuava) {
// Use Guava 32.1.3, see https://github.com/google/guava/issues/6657.
// TODO: May remove this after https://github.com/google/google-java-format/pull/996 and https://github.com/palantir/palantir-java-format/issues/957 are released.
coordinateStream = Stream.concat(coordinateStream, Stream.of("com.google.guava:guava:32.1.3-jre"));
}
Dependency[] deps = coordinateStream
Dependency[] deps = mavenCoords.stream()
.map(project.getDependencies()::create)
.toArray(Dependency[]::new);
Configuration config = project.getConfigurations().detachedConfiguration(deps);
Expand Down

0 comments on commit 8b6157f

Please sign in to comment.