Upgrade to Gradle 6.7 and use toolchains feature to build on 11 and t… (#1829)

* Upgrade to Gradle 6.7 and use toolchains feature to build on 11 and test on 11/8.

* Debug (probably first JDK download taking some time)

* Remove now unnecessary java toolchain workarounds

* Remove debug

* Remove windows build for now

* bin

* Raise no_output_timeout since this change seems to eliminate cache and build doesn't finish.
This commit is contained in:
Anuraag Agrawal 2020-10-21 15:01:50 +09:00 committed by GitHub
parent e13e631847
commit 082791503b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 53 deletions

View File

@ -6,6 +6,8 @@ init_task: &init_task
build_task: &build_task
name: Build
command: make test-with-docker
# For slow build if cache is cleared
no_output_timeout: 60m
compile_benchmark_task: &compile_benchmark_task
name: Compile JMH
command: make benchmark
@ -28,8 +30,9 @@ jobs:
# Configure the JVM and Gradle to avoid OOM errors
_JAVA_OPTIONS: "-Xmx1g"
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
ORG_GRADLE_PROJECT_testAdditionalJavaVersions: true
docker:
- image: circleci/openjdk:8-jdk
- image: circleci/openjdk:11.0.6-jdk-buster
steps:
- checkout
- restore_cache:
@ -56,32 +59,6 @@ jobs:
paths:
- ~/.gradle
key: gradle-{{ checksum "build.gradle" }}
java11:
environment:
# Configure the JVM and Gradle to avoid OOM errors
_JAVA_OPTIONS: "-Xmx3g"
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
docker:
- image: circleci/openjdk:11.0.6-jdk-buster
steps:
- checkout
- restore_cache:
keys:
- java11-gradle-{{ checksum "build.gradle" }}
# make in missing in openjdk:9-jdk image
- run: sudo apt-get update && sudo apt-get install -y make
- run:
<<: *init_task
- run:
<<: *verify_task
- run:
<<: *build_task
- run:
<<: *compile_benchmark_task
- save_cache:
paths:
- ~/.gradle
key: java11-gradle-{{ checksum "build.gradle" }}
# Publish the released artifacts using the `build` job env.
release_job:
environment:
@ -113,4 +90,3 @@ workflows:
build_and_test:
jobs:
- build
- java11

View File

@ -17,29 +17,32 @@ jobs:
os:
- macos-latest
- ubuntu-latest
- windows-latest
java:
# Test all OS's with Java 11
- 11
include:
- os: ubuntu-latest
java: 11
testAdditionalJavaVersions: true
coverage: true
- os: ubuntu-latest
java: 8
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-java@v1
- id: setup-java-8
name: Setup Java 8
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
java-version: 8
java-package: jre
- id: setup-java-11
name: Setup Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: burrunan/gradle-cache-action@v1.5
with:
job-id: jdk${{ matrix.java }}
remote-build-cache-proxy-enabled: false
arguments: check --stacktrace ${{ matrix.coverage && ':opentelemetry-all:jacocoTestReport' || '' }}
properties: |
testAdditionalJavaVersions=${{ matrix.testAdditionalJavaVersions }}
enable.docker.tests=${{ matrix.os == 'ubuntu-latest' }}
org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-11.outputs.path }}
- uses: codecov/codecov-action@v1
if: ${{ matrix.coverage }}

View File

@ -169,15 +169,32 @@ configure(opentelemetryProjects) {
mavenLocal()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
withJavadocJar()
withSourcesJar()
}
tasks {
def testJava8 = register('testJava8', Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
}
jacoco.enabled = false
}
if (rootProject.findProperty('testAdditionalJavaVersions') == 'true') {
check.dependsOn(testJava8)
}
}
tasks.withType(JavaCompile) {
it.options.release = 8
it.options.compilerArgs += [
"-Xlint:all",
// We suppress the "try" warning because it disallows managing an auto-closeable with
@ -370,15 +387,10 @@ configure(opentelemetryProjects) {
// The ErrorProne plugin defaults to the latest, which would break our
// build if error prone releases a new version with a new check
errorprone libraries.errorprone_core
if (!JavaVersion.current().isJava9Compatible()) {
errorproneJavac libraries.errorprone_javac
}
if (JavaVersion.current().isJava9Compatible()) {
// Workaround for @javax.annotation.Generated
// see: https://github.com/grpc/grpc-java/issues/3633
compileOnly libraries.javax_annotations
}
// Workaround for @javax.annotation.Generated
// see: https://github.com/grpc/grpc-java/issues/3633
compileOnly libraries.javax_annotations
}
tasks.withType(Test) {
@ -465,8 +477,7 @@ configure(opentelemetryProjects) {
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = '6.6'
gradleVersion = '6.7'
}
tasks.register("updateVersionInDocs") {

View File

@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionSha256Sum=8ad57759019a9233dc7dc4d1a530cefe109dc122000d57f7e623f8cf4ba9dfc4
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionSha256Sum=8ad57759019a9233dc7dc4d1a530cefe109dc122000d57f7e623f8cf4ba9dfc4
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists