Skip to content
Closed
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: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
matrix:
kind: [maven, gradle]
# Test on the latest Java version once Gradle & Maven support it.
jre: [17, 21, 24]
jre: [17, 21, 25]
os: [ubuntu-latest, windows-latest]
include:
# npm on linux only (crazy slow on windows)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ private static FormatterStep createInternally(String name, String groupArtifact,
.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
.addMin(25, "1.27.0")
.add(17, "1.28.0"); // default version

public static String defaultGroupArtifact() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2025 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 @@ -31,7 +31,7 @@ void integration() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
" googleJavaFormat('1.17.0')",
" googleJavaFormat('1.27.0')",
" }",
"}");

Expand All @@ -41,8 +41,8 @@ void integration() throws IOException {

checkRunsThenUpToDate();
replace("build.gradle",
"googleJavaFormat('1.17.0')",
"googleJavaFormat()");
"googleJavaFormat('1.27.0')",
"googleJavaFormat('1.28.0')");
checkRunsThenUpToDate();
}

Expand All @@ -57,7 +57,7 @@ void integrationWithReorderImports() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
" googleJavaFormat('1.17.0').aosp().reorderImports(true)",
" googleJavaFormat('1.27.0').aosp().reorderImports(true)",
" }",
"}");

Expand All @@ -67,8 +67,8 @@ void integrationWithReorderImports() throws IOException {

checkRunsThenUpToDate();
replace("build.gradle",
"googleJavaFormat('1.17.0')",
"googleJavaFormat()");
"googleJavaFormat('1.27.0')",
"googleJavaFormat('1.28.0')");
checkRunsThenUpToDate();
}

Expand All @@ -83,7 +83,7 @@ void integrationWithSkipJavadocFormatting() throws IOException {
"spotless {",
" java {",
" target file('test.java')",
" googleJavaFormat('1.17.0').skipJavadocFormatting()",
" googleJavaFormat('1.27.0').skipJavadocFormatting()",
" }",
"}");

Expand All @@ -93,8 +93,8 @@ void integrationWithSkipJavadocFormatting() throws IOException {

checkRunsThenUpToDate();
replace("build.gradle",
"googleJavaFormat('1.17.0')",
"googleJavaFormat()");
"googleJavaFormat('1.27.0')",
"googleJavaFormat('1.28.0')");
checkRunsThenUpToDate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ public enum GradleVersionSupport {
GradleVersionSupport(String version) {
String minVersionForRunningJRE;
switch (Jvm.version()) {
case 26:
throw new UnsupportedOperationException("TODO: gradle compat for " + Jvm.version() + " https://docs.gradle.org/current/userguide/compatibility.html");
case 25:
// TODO: https://docs.gradle.org/current/userguide/compatibility.html
minVersionForRunningJRE = "9.1.0";
break;
case 24:
minVersionForRunningJRE = "8.14";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void behavior() throws Exception {

@Test
void formatJavadoc() throws Exception {
FormatterStep step = PalantirJavaFormatStep.create("2.57.0", "PALANTIR", true, TestProvisioner.mavenCentral());
FormatterStep step = PalantirJavaFormatStep.create("2.71.0", "PALANTIR", true, TestProvisioner.mavenCentral());
StepHarness.forStep(step)
.testResource("java/palantirjavaformat/JavaCodeWithJavaDocUnformatted.test", "java/palantirjavaformat/JavaCodeWithJavaDocFormatted.test")
.testResource("java/palantirjavaformat/JavaCodeWithPackageUnformatted.test", "java/palantirjavaformat/JavaCodeWithPackageFormatted.test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
import com.diffplug.spotless.StepHarnessWithFile;
import com.diffplug.spotless.TestProvisioner;

import org.junit.jupiter.api.condition.DisabledOnJre;
import org.junit.jupiter.api.condition.JRE;

class KtLintStepTest extends ResourceHarness {
@Test
@DisabledOnJre(JRE.JAVA_25)
void works0_48_0() {
FormatterStep step = KtLintStep.create("0.48.0", TestProvisioner.mavenCentral());
StepHarnessWithFile.forStep(this, step)
Expand All @@ -33,6 +37,7 @@ void works0_48_0() {
}

@Test
@DisabledOnJre(JRE.JAVA_25)
void works0_48_1() {
FormatterStep step = KtLintStep.create("0.48.1", TestProvisioner.mavenCentral());
StepHarnessWithFile.forStep(this, step)
Expand All @@ -41,6 +46,7 @@ void works0_48_1() {
}

@Test
@DisabledOnJre(JRE.JAVA_25)
void works0_49_0() {
FormatterStep step = KtLintStep.create("0.49.0", TestProvisioner.mavenCentral());
StepHarnessWithFile.forStep(this, step)
Expand All @@ -49,6 +55,7 @@ void works0_49_0() {
}

@Test
@DisabledOnJre(JRE.JAVA_25)
void works0_49_1() {
FormatterStep step = KtLintStep.create("0.49.1", TestProvisioner.mavenCentral());
StepHarnessWithFile.forStep(this, step)
Expand All @@ -57,6 +64,7 @@ void works0_49_1() {
}

@Test
@DisabledOnJre(JRE.JAVA_25)
void works0_50_0() {
FormatterStep step = KtLintStep.create("0.50.0", TestProvisioner.mavenCentral());
StepHarnessWithFile.forStep(this, step)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

import com.diffplug.spotless.*;

import org.junit.jupiter.api.condition.DisabledOnJre;
import org.junit.jupiter.api.condition.JRE;

class KtfmtStepTest extends ResourceHarness {
@Test
void behavior() throws Exception {
Expand All @@ -37,20 +40,23 @@ void behaviorWithOptions() {
}

@Test
@DisabledOnJre(JRE.JAVA_25)
void dropboxStyle_0_16() throws Exception {
KtfmtStep.KtfmtFormattingOptions options = new KtfmtStep.KtfmtFormattingOptions();
FormatterStep step = KtfmtStep.create("0.16", TestProvisioner.mavenCentral(), KtfmtStep.Style.DROPBOX, options);
StepHarness.forStep(step).testResource("kotlin/ktfmt/basic.dirty", "kotlin/ktfmt/basic-dropboxstyle.clean");
}

@Test
@DisabledOnJre(JRE.JAVA_25)
void dropboxStyle_0_18() throws Exception {
KtfmtStep.KtfmtFormattingOptions options = new KtfmtStep.KtfmtFormattingOptions();
FormatterStep step = KtfmtStep.create("0.18", TestProvisioner.mavenCentral(), KtfmtStep.Style.DROPBOX, options);
StepHarness.forStep(step).testResource("kotlin/ktfmt/basic.dirty", "kotlin/ktfmt/basic-dropboxstyle.clean");
}

@Test
@DisabledOnJre(JRE.JAVA_25)
void dropboxStyle_0_22() throws Exception {
KtfmtStep.KtfmtFormattingOptions options = new KtfmtStep.KtfmtFormattingOptions();
FormatterStep step = KtfmtStep.create("0.22", TestProvisioner.mavenCentral(), KtfmtStep.Style.DROPBOX, options);
Expand Down
Loading