Skip to content

Commit

Permalink
Add gradle toolchain for jdk bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Aug 31, 2021
1 parent 330ecc6 commit 16283e5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
strategy:
matrix:
java: [ 11, 16 ]
env:
JAVA_VERSION: ${{ matrix.java }}
steps:
- uses: actions/checkout@v2.3.4
- name: Set up JDK ${{ matrix.java }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
strategy:
matrix:
java: [ 11, 16 ]
env:
JAVA_VERSION: ${{ matrix.java }}
steps:
- uses: actions/checkout@v2.3.4
- name: Set up JDK ${{ matrix.java }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
strategy:
matrix:
java: [ 11, 16 ]
env:
JAVA_VERSION: ${{ matrix.java }}
steps:
- uses: actions/checkout@v2.3.4
- name: Set up JDK ${{ matrix.java }}
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ env:
ORG_GRADLE_PROJECT_checksumFailOn: build_finish
ORG_GRADLE_PROJECT_checksumIgnore: false
ORG_GRADLE_PROJECT_checksumPrint: true
JAVA_VERSION: 11

jobs:
qodana:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 16 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Cache Gradle packages
uses: actions/cache@v2.1.6
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
~/.sonar/cache
key: ${{ runner.os }}-${{ github.job }}-${{ matrix.java }}-${{ hashFiles('**/*.gradle') }}
key: ${{ runner.os }}-${{ github.job }}-${{ env.JAVA_VERSION }}-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build
run: ./gradlew build -x test
Expand All @@ -30,15 +33,15 @@ jobs:
with:
path: |
~/work/_temp/_github_home/qodana-cache
key: ${{ runner.os }}-qodana-${{ matrix.java }}-${{ github.ref }}
key: ${{ runner.os }}-qodana-${{ env.JAVA_VERSION }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-qodana-${{ github.ref }}
${{ runner.os }}-qodana-
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@v2.0-eap
- uses: actions/upload-artifact@v2
with:
name: qodana-${{ matrix.java }}
name: qodana-${{ env.JAVA_VERSION }}
path: ${{ github.workspace }}/qodana
- name: View Instructions
run: |
Expand Down
13 changes: 2 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ subprojects {
apply from: "${rootDir}/gradle/dependencies.gradle"
apply from: "${rootDir}/gradle/objectLayout.gradle"

sourceCompatibility = JavaVersion.VERSION_11
java.toolchain.languageVersion = JavaLanguageVersion.of(System.env.'JAVA_VERSION' ?: 11)

configurations {
all {
Expand All @@ -67,6 +67,7 @@ subprojects {

dependencies {
testImplementation libraries.guava
testImplementation libraries.slf4jNop
testImplementation testLibraries.truth
testImplementation testLibraries.mockito
testImplementation testLibraries.hamcrest
Expand Down Expand Up @@ -158,13 +159,3 @@ tasks.coveralls {
dependsOn jacocoRootReport
onlyIf { System.env.'CI' }
}

def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}

dependencyUpdates.rejectVersionIf {
it.candidate.group == 'org.slf4j' && isNonStable(it.candidate.version)
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.LogManager;

import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
Expand All @@ -48,11 +47,6 @@
*/
@SuppressWarnings("FutureReturnValueIgnored")
public final class SchedulerTest {
static {
// disable logging warnings caused by exceptions
LogManager.getLogManager().reset();
}

private final NullPointerTester npeTester = new NullPointerTester();

@Test(dataProvider = "schedulers")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.LogManager;
import java.util.stream.Stream;

import org.testng.annotations.DataProvider;
Expand All @@ -44,11 +43,6 @@
*/
public final class CacheProvider {

static {
// disable logging warnings caused by exceptions in asynchronous computations
LogManager.getLogManager().reset();
}

private CacheProvider() {}

/** Returns the lazily generated test scenarios. */
Expand Down
7 changes: 5 additions & 2 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ext {
ohc: '0.6.1',
osgiComponentAnnotations: '1.4.0',
picocli: '4.6.1',
slf4j: '1.7.32',
slf4j: '2.0.0-alpha5',
tcache: '2.0.1',
stream: '2.9.8',
univocityParsers: '2.9.1',
Expand Down Expand Up @@ -142,7 +142,10 @@ ext {
ohc: "org.caffinitas.ohc:ohc-core-j8:${versions.ohc}",
osgiComponentAnnotations: "org.osgi:org.osgi.service.component.annotations:${versions.osgiComponentAnnotations}",
picocli: "info.picocli:picocli:${versions.picocli}",
slf4jNop: "org.slf4j:slf4j-nop:${versions.slf4j}",
slf4jNop: [
"org.slf4j:slf4j-nop:${versions.slf4j}",
"org.slf4j:slf4j-jdk-platform-logging:${versions.slf4j}",
],
tcache: "com.trivago:triava:${versions.tcache}",
stream: "com.clearspring.analytics:stream:${versions.stream}",
univocityParsers: "com.univocity:univocity-parsers:${versions.univocityParsers}",
Expand Down

0 comments on commit 16283e5

Please sign in to comment.