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

Bump CI from java 15 to 17 #1094

Merged
merged 7 commits into from
Jan 13, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix GJF (and detekt) on Java 16+
nedtwigg committed Jan 13, 2022
commit a2bf06ad9cf9783b918c7a7436deafed55cceaab
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@

import com.diffplug.common.base.Unhandled;
import com.diffplug.common.io.Resources;
import com.diffplug.spotless.Jvm;
import com.diffplug.spotless.ResourceHarness;

public class MavenIntegrationHarness extends ResourceHarness {
@@ -81,6 +82,17 @@ public class MavenIntegrationHarness extends ResourceHarness {
@BeforeEach
void gitAttributes() throws IOException {
setFile(".gitattributes").toContent("* text eol=lf");
if (Jvm.version() >= 16) {
// for GJF https://github.com/diffplug/spotless/issues/834
setFile(".mvn/jvm.config").toContent(
"--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" +
" --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" +
" --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" +
" --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" +
" --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" +
// this last line is for Detekt
" --add-opens java.base/java.lang=ALL-UNNAMED");
}
// copy the mvnw resources
copy("mvnw").setExecutable(true);
copy("mvnw.cmd");
15 changes: 14 additions & 1 deletion testlib/build.gradle
Original file line number Diff line number Diff line change
@@ -21,7 +21,20 @@ dependencies {
// we'll hold the testlib to a low standard (prize brevity)
spotbugs { reportLevel = 'high' } // low|medium|high (low = sensitive to even minor mistakes)

test { useJUnitPlatform() }
test {
useJUnitPlatform()
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) {
// for GJF https://github.com/diffplug/spotless/issues/834
def args = [
'--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
]
jvmArgs args
}
}

apply from: rootProject.file('gradle/special-tests.gradle')

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.
@@ -17,6 +17,7 @@

import static org.junit.jupiter.api.condition.JRE.JAVA_11;
import static org.junit.jupiter.api.condition.JRE.JAVA_13;
import static org.junit.jupiter.api.condition.JRE.JAVA_15;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -41,7 +42,7 @@ void jvm13Features() throws Exception {
}

@Test
@EnabledForJreRange(min = JAVA_11) // google-java-format requires JRE 11+
@EnabledForJreRange(min = JAVA_11, max = JAVA_15) // google-java-format requires JRE 11+
void behavior18() throws Exception {
FormatterStep step = GoogleJavaFormatStep.create("1.8", TestProvisioner.mavenCentral());
StepHarness.forStep(step)