Skip to content

Commit

Permalink
Update to use Java 17
Browse files Browse the repository at this point in the history
* change to gradle 8.0.2
* minor changes to support java 17
* remove test module configuration and use gradle test platform instead
  • Loading branch information
lbergelson committed Sep 29, 2023
1 parent 396c7e2 commit fcf2300
Show file tree
Hide file tree
Showing 16 changed files with 249 additions and 303 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/gradle_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: temurin
- name: Cache Gradle packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
Expand All @@ -30,4 +31,4 @@ jobs:
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
rm -f ~/.gradle/caches/modules-2/gc.properties
71 changes: 27 additions & 44 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ repositories {
mavenCentral()
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

sourceSets {
main {
resources {
Expand Down Expand Up @@ -128,10 +134,13 @@ dependencies {
)

testImplementation(
[group: 'junit', name: 'junit', version: '4.12'],
[group: 'junit', name: 'junit', version: '4.13'],
[group: 'com.sparkjava', name: 'spark-core', version: '2.2'],
[group: 'org.glassfish.jersey.core', name: 'jersey-common', version: '2.22.4']
)
testRuntimeOnly(
[group: 'org.junit.vintage', name:'junit-vintage-engine', version:'5.8.2']
)
}


Expand Down Expand Up @@ -179,35 +188,7 @@ tasks.withType(Test) {
systemProperties['org.xerial.snappy.tempdir'] = 'build/tmp'
maxHeapSize = '2g'
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}

compileTestJava {
inputs.property("moduleName", moduleName)
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'junit',
'--patch-module', "$moduleName=" + files(sourceSets.test.java.srcDirs).asPath,
]
classpath = files()
}
}

test {
inputs.property("moduleName", moduleName)

doFirst {
jvmArgs = [
'-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize',
'--module-path', classpath.asPath,
'--add-modules', 'junit',
'--add-modules', 'ALL-MODULE-PATH',
'--add-reads', "$moduleName=junit",
'@scripts/test_suite.args',
'--patch-module', "$moduleName=" + files(sourceSets.test.java.outputDir, sourceSets.main.output.resourcesDir).asPath,
]
classpath = files()
}
useJUnitPlatform()
}

task createDist(type: Copy, dependsOn: jar) {
Expand Down Expand Up @@ -244,32 +225,32 @@ tasks.distTar.enabled = false
tasks.startScripts.enabled = false

task createDistZip(type: Zip, dependsOn: createDist) {
archiveName = "IGV_${version}.zip"
archiveFileName = "IGV_${archiveVersion}.zip"
from("${buildDir}/IGV-dist")
into "IGV_${version}"
into "IGV_${archiveVersion}"
}

task createLinuxDistZip(type: Zip, dependsOn: createDist) {
archiveName = "IGV_Linux_${version}.zip"
archiveFileName = "IGV_Linux_${archiveVersion}.zip"
from("${buildDir}/IGV-dist") {
exclude "*.bat"
exclude "*.command"
exclude 'igvtools*'
exclude 'lib/genomes'
}
into "IGV_Linux_${version}"
into "IGV_Linux_${archiveVersion}"
}

task createLinuxWithJavaDistZip(type: Zip, dependsOn: createDist) {
archiveName = "IGV_Linux_${version}_WithJava.zip"
archiveFileName = "IGV_Linux_${archiveVersion}_WithJava.zip"
with copySpec { from jdkBundleLinux into "jdk-11" }
from("${buildDir}/IGV-dist") {
exclude "*.bat"
exclude "*.command"
exclude 'igvtools*'
exclude 'lib/genomes'
}
into "IGV_Linux_${version}"
into "IGV_Linux_${archiveVersion}"
doLast {
if (jdkBundleLinux == "") {
throw new GradleException("Required property not set: jdkBundleLinux");
Expand All @@ -278,26 +259,27 @@ task createLinuxWithJavaDistZip(type: Zip, dependsOn: createDist) {
}

task createMacDistZip(type: Zip, dependsOn: createDist) {
archiveName = "IGV_Mac_${version}.zip"
archiveFileName = "IGV_Mac_${archiveVersion}.zip"
from("${buildDir}/IGV-dist") {
exclude "*.bat"
exclude "*_hidpi*"
exclude "igvtools*"
exclude 'lib/genomes'
}
into "IGV_Mac_${version}"

into "IGV_Mac_${archiveVersion}"
}

task createMacWithJavaDistZip(type: Zip, dependsOn: createDist) {
archiveName = "IGV_Mac_${version}_WithJava.zip"
archiveFileName = "IGV_Mac_${archiveVersion}_WithJava.zip"
with copySpec { from jdkBundleMac into "jdk-11" }
from("${buildDir}/IGV-dist") {
exclude "*.bat"
exclude "*_hidpi*"
exclude "igvtools*"
exclude 'lib/genomes'
}
into "IGV_Mac_${version}"
into "IGV_Mac_${archiveVersion}"
doLast {
if (jdkBundleMac == "") {
throw new GradleException("Required property not set: jdkBundleMac");
Expand Down Expand Up @@ -339,7 +321,7 @@ task createMacAppDist(type: Copy, dependsOn: createDist) {
}

task createMacAppDistZip(type: Zip, dependsOn: createMacAppDist) {
archiveName = "IGV_MacApp_${version}.zip"
archiveFileName = "IGV_MacApp_${archiveVersion}.zip"
from("${buildDir}/IGV-MacApp-dist")

doLast {
Expand All @@ -348,8 +330,8 @@ task createMacAppDistZip(type: Zip, dependsOn: createMacAppDist) {
}

task createMacAppWithJavaDistZip(type: Zip, dependsOn: createMacAppDist) {
archiveName = "IGV_MacApp_${version}_WithJava.zip"
with copySpec { from jdkBundleMac into "IGV_${version}.app/Contents/jdk-11" }
archiveFileName = "IGV_MacApp_${archiveVersion}_WithJava.zip"
with copySpec { from jdkBundleMac into "IGV_${archiveVersion}.app/Contents/jdk-11" }
from("${buildDir}/IGV-MacApp-dist")

doLast {
Expand Down Expand Up @@ -465,7 +447,8 @@ task fullJar(type: Jar, dependsOn: jar) {
"Application-Name": "IGV",
"Built-By": System.getProperty('user.name'),
"Main-Class": mainClassName,
"Class-Path": configurations.default.collect { it.getName() }.join(' ')

"Class-Path": configurations.runtimeClasspath.collect { it.getName() }.join(' ')
)
}
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit fcf2300

Please sign in to comment.