Skip to content

Commit

Permalink
Bump source compatibility version to Java 17 (elastic#80851)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira authored Dec 6, 2021
1 parent fbb395b commit 06d7e16
Show file tree
Hide file tree
Showing 46 changed files with 691 additions and 791 deletions.
2 changes: 1 addition & 1 deletion .ci/java-versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# build and test Elasticsearch for this branch. Valid Java versions
# are 'java' or 'openjdk' followed by the major release number.

ES_BUILD_JAVA=openjdk16
ES_BUILD_JAVA=openjdk17
ES_RUNTIME_JAVA=openjdk17
6 changes: 3 additions & 3 deletions build-conventions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ plugins {

group = "org.elasticsearch"

def minRuntimeJava = JavaVersion.toVersion(file('../build-tools-internal/src/main/resources/minimumRuntimeVersion').text)
targetCompatibility = minRuntimeJava
sourceCompatibility = minRuntimeJava
// This project contains Checkstyle rule implementations used by IDEs which use a Java 11 runtime
targetCompatibility = 11
sourceCompatibility = 11

gradlePlugin {
// We already configure publication and we don't need or want the one that comes
Expand Down
14 changes: 8 additions & 6 deletions build-tools-internal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ dependencies {
// for our ide tweaking
api 'gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.7'
// When upgrading forbidden apis, ensure dependency version is bumped in ThirdPartyPrecommitPlugin as well
api 'de.thetaphi:forbiddenapis:3.1'
api 'de.thetaphi:forbiddenapis:3.2'
api 'com.avast.gradle:gradle-docker-compose-plugin:0.14.0'
api 'org.apache.maven:maven-model:3.6.2'
api 'com.networknt:json-schema-validator:1.0.36'
api "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.getProperty('jackson')}"
api 'org.ow2.asm:asm:9.0'
api 'org.ow2.asm:asm-tree:9.0'
api 'org.ow2.asm:asm:9.2'
api 'org.ow2.asm:asm-tree:9.2'
api "org.apache.httpcomponents:httpclient:${versions.getProperty('httpclient')}"
api "org.apache.httpcomponents:httpcore:${versions.getProperty('httpcore')}"
compileOnly "com.puppycrawl.tools:checkstyle:${versions.getProperty('checkstyle')}"
Expand Down Expand Up @@ -253,16 +253,18 @@ dependencies {
because 'allows tests to run from IDEs that bundle older version of launcher'
}

testImplementation platform("org.spockframework:spock-bom:2.0-M5-groovy-3.0")
testImplementation platform("org.spockframework:spock-bom:2.0-groovy-3.0")
testImplementation("org.spockframework:spock-core") {
exclude module: "groovy"
}
integTestImplementation platform("org.spockframework:spock-bom:2.0-M5-groovy-3.0")
integTestImplementation platform("org.spockframework:spock-bom:2.0-groovy-3.0")
integTestImplementation("org.spockframework:spock-core") {
exclude module: "groovy"
}
// required as we rely on junit4 rules
integTestImplementation "org.spockframework:spock-junit4"
integTestImplementation("org.spockframework:spock-junit4") {
exclude module: "groovy"
}
testImplementation "org.spockframework:spock-junit4"
integTestImplementation "org.xmlunit:xmlunit-core:2.8.2"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import spock.lang.Unroll
* Test is ignored on ARM since this test case tests the ability to build certain older BWC branches that we don't support on ARM
*/

//@Ignore("https://github.com/elastic/elasticsearch/issues/79929")
@IgnoreIf({ Architecture.current() == Architecture.AARCH64 })
class InternalDistributionBwcSetupPluginFuncTest extends AbstractGitAwareGradleFuncTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
17
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static void configureCompile(Project project) {
// TODO Discuss moving compileOptions.getCompilerArgs() to use provider api with Gradle team.
List<String> compilerArgs = compileOptions.getCompilerArgs();
compilerArgs.add("-Werror");
compilerArgs.add("-Xlint:all,-path,-serial,-options,-deprecation,-try");
compilerArgs.add("-Xlint:all,-path,-serial,-options,-deprecation,-try,-removal");
compilerArgs.add("-Xdoclint:all");
compilerArgs.add("-Xdoclint:-missing");
compileOptions.setEncoding("UTF-8");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin;
import org.elasticsearch.gradle.internal.info.BuildParams;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.JavaVersion;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.plugins.ExtraPropertiesExtension;
Expand All @@ -41,6 +40,7 @@ public TaskProvider<? extends Task> createTask(Project project) {
resourcesTask.configure(t -> {
t.setOutputDir(resourcesDir.toFile());
t.copy("forbidden/jdk-signatures.txt");
t.copy("forbidden/jdk-deprecated.txt");
t.copy("forbidden/es-all-signatures.txt");
t.copy("forbidden/es-test-signatures.txt");
t.copy("forbidden/http-signatures.txt");
Expand All @@ -66,13 +66,13 @@ public TaskProvider<? extends Task> createTask(Project project) {
t.setClasspath(project.files(sourceSet.getRuntimeClasspath()).plus(sourceSet.getCompileClasspath()));

t.setTargetCompatibility(BuildParams.getRuntimeJavaVersion().getMajorVersion());
if (BuildParams.getRuntimeJavaVersion().compareTo(JavaVersion.VERSION_14) > 0) {
// TODO: forbidden apis does not yet support java 15, rethink using runtime version
t.setTargetCompatibility(JavaVersion.VERSION_14.getMajorVersion());
}
t.setBundledSignatures(Set.of("jdk-unsafe", "jdk-deprecated", "jdk-non-portable", "jdk-system-out"));
t.setBundledSignatures(Set.of("jdk-unsafe", "jdk-non-portable", "jdk-system-out"));
t.setSignaturesFiles(
project.files(resourcesDir.resolve("forbidden/jdk-signatures.txt"), resourcesDir.resolve("forbidden/es-all-signatures.txt"))
project.files(
resourcesDir.resolve("forbidden/jdk-signatures.txt"),
resourcesDir.resolve("forbidden/es-all-signatures.txt"),
resourcesDir.resolve("forbidden/jdk-deprecated.txt")
)
);
t.setSuppressAnnotations(Set.of("**.SuppressForbidden"));
if (t.getName().endsWith("Test")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class ThirdPartyAuditPrecommitPlugin extends PrecommitPlugin implements I
public TaskProvider<? extends Task> createTask(Project project) {
project.getPlugins().apply(CompileOnlyResolvePlugin.class);
project.getConfigurations().create("forbiddenApisCliJar");
project.getDependencies().add("forbiddenApisCliJar", "de.thetaphi:forbiddenapis:3.1");
project.getDependencies().add("forbiddenApisCliJar", "de.thetaphi:forbiddenapis:3.2");
Configuration jdkJarHellConfig = project.getConfigurations().create(JDK_JAR_HELL_CONFIG_NAME);
if (project.getPath().equals(LIBS_ELASTICSEARCH_CORE_PROJECT_PATH) == false) {
// Internal projects are not all plugins, so make sure the check is available
Expand Down
Loading

0 comments on commit 06d7e16

Please sign in to comment.