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

Migrate to Java 17 #1649

Merged
merged 5 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
43 changes: 19 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11 ]
java: [ 17 ]
experimental: [false]
# include:
# - java: 17
# experimental: true
fail-fast: false
continue-on-error: ${{ matrix.experimental }}
name: Java ${{ matrix.Java }} build and test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up java ${{ matrix.Java }}
uses: actions/setup-java@v2
uses: actions/setup-java@v3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this change (v2 -> v3) do ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It stops github complaining that it's using deprecated stuff.

with:
java-version: ${{ matrix.Java }}
distribution: 'adopt'
Expand All @@ -40,11 +37,9 @@ jobs:
run: scripts/htsget-scripts/start-htsget-test-server.sh
- name: Run tests
run: ./gradlew test jacocoTestReport
# - name: Upload to codecov
# run: bash <(curl -s https://raw.githubusercontent.com/broadinstitute/codecov-bash-uploader/main/codecov-verified.bash)
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.Java }}
path: build/reports/tests
Expand All @@ -53,11 +48,11 @@ jobs:
runs-on: ubuntu-latest
name: Tests that require external APIs
steps:
- uses: actions/checkout@v2
- name: Set up java 8
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up java 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
Expand All @@ -70,7 +65,7 @@ jobs:
# run: bash <(curl -s https://raw.githubusercontent.com/broadinstitute/codecov-bash-uploader/main/codecov-verified.bash)
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: test-results-external-apis
path: build/reports/tests
Expand All @@ -79,11 +74,11 @@ jobs:
runs-on: ubuntu-latest
name: FTP tests
steps:
- uses: actions/checkout@v2
- name: Set up java 8
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up java 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
Expand All @@ -96,19 +91,19 @@ jobs:
# run: bash <(curl -s https://raw.githubusercontent.com/broadinstitute/codecov-bash-uploader/main/codecov-verified.bash)
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: test-results-ftp
path: build/reports/tests
spotBugs:
runs-on: ubuntu-latest
name: SpotBugs
steps:
- uses: actions/checkout@v2
- name: Set up java 8
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up java 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
Expand All @@ -117,7 +112,7 @@ jobs:
run: ./gradlew spotBugsMain spotBugsTest
- name: Upload spotBugs Report
if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: spotBugs-Report
path: build/reports/spotbugs
Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[![Coverage Status](https://codecov.io/gh/samtools/htsjdk/branch/master/graph/badge.svg)](https://codecov.io/gh/samtools/htsjdk)
[![Build and Test](https://github.com/samtools/htsjdk/actions/workflows/tests.yml/badge.svg?branch=master&event=push)](https://github.com/samtools/htsjdk/actions/workflows/tests.yml)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.samtools/htsjdk/badge.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.github.samtools%22%20AND%20a%3A%22htsjdk%22)
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samtools/htsjdk)
Expand Down Expand Up @@ -26,7 +25,7 @@ To receive announcements of releases and other significant project news please s

### Building HTSJDK

HTSJDK is now built using [gradle](http://gradle.org/).
HTSJDK is built using [gradle](http://gradle.org/).

A wrapper script (`gradlew`) is included which will download the appropriate version of gradle on the first invocation.

Expand Down Expand Up @@ -102,16 +101,19 @@ Broadly speaking the majority of the code is covered under the MIT license with
### Java Minimum Version Support Policy

Htsjdk currently targets Java 8 and is tested on both 8 and 11.
We do not currently plan to support versions of Java which are not long-term-support releases (ex: 9, 10, or 12).

We will notify the community at least 6 months before we plan to stop support for Java 8.
We intend to drop support for 8/11 and switch exclusively to 17+ in our next release (4.0.0).

Given our promise of 6 months of warning before a move off of 8, we will atttempt to provide 3.x releases on demand if
any critical bugs are discovered in the next 6 months.

Java SE Major Release | End of Java SE Oracle Public Updates / OpenJDK support | Proposed End of Support in HTSJDK | Actual End of Support in HTSJDK
---- | ---- | ---- | ----
6 | Feb 2013 | Aug 2013 | Oct 2015
7 | Apr 2015 | Oct 2015 | Oct 2015
8 | Jan 2019 | TBD | TBD
11 | Sep 2022 | TBD | TBD
---- | ---- |-----------------------------------| ----
6 | Feb 2013 | Aug 2013 | Oct 2015
7 | Apr 2015 | Oct 2015 | Oct 2015
8 | Jan 2019 | Feb 2022 | TBD
11 | Sep 2022 | Feb 2022 | TBD
17 | TBD | TBD | TBD


### Meaning of the Htsjdk version number
Expand Down
38 changes: 16 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
id 'signing'
id 'jacoco'
id 'com.palantir.git-version' version '0.11.0'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.spotbugs' version "5.0.13"
}

Expand All @@ -37,17 +37,25 @@ dependencies {
exclude group: "junit"
}

implementation 'org.openjdk.nashorn:nashorn-core:15.4'


api "gov.nih.nlm.ncbi:ngs-java:2.9.0"
api "org.apache.commons:commons-jexl:2.1.1"

testImplementation "org.testng:testng:6.14.3"
testImplementation "com.google.jimfs:jimfs:1.1"
testImplementation "com.google.guava:guava:26.0-jre"
testImplementation 'org.testng:testng:7.7.0'
testImplementation 'com.google.jimfs:jimfs:1.1'
testImplementation "com.google.guava:guava:31.1-jre"
testImplementation "org.apache.commons:commons-lang3:3.7"
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withJavadocJar()
withSourcesJar()
}

final isRelease = Boolean.getBoolean("release")
final gitVersion = gitVersion().replaceAll(".dirty", "")
Expand All @@ -64,6 +72,7 @@ tasks.withType(JavaCompile) {

tasks.withType(Javadoc) {
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('Xdoclint:none', '-quiet')
}

jar {
Expand Down Expand Up @@ -159,20 +168,6 @@ if(project == rootProject) {
}
}

tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}

task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from 'build/docs/javadoc'
}

task sourcesJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier.set('sources')
}

spotbugs {
reportLevel = 'high'
excludeFilter = file('gradle/spotbugs-exclude.xml')
Expand All @@ -197,8 +192,6 @@ publishing {
publications {
htsjdk(MavenPublication) {
from components.java
artifact javadocJar
artifact sourcesJar

pom {
name = 'HTSJDK'
Expand Down Expand Up @@ -250,6 +243,7 @@ signing {
required { isRelease && gradle.taskGraph.hasTask("publishHtsjdkPublicationToMavenRepository") }
sign publishing.publications.htsjdk
}

gradle.taskGraph.beforeTask { Task task ->
println "executing $task ..."
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/htsjdk/samtools/Defaults.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static SortedMap<String, Object> allDefaults(){
private static String getStringProperty(final String name, final String def) {
try {
return System.getProperty(Defaults.SAMJDK_PREFIX + name, def);
} catch (final java.security.AccessControlException error) {
} catch (final SecurityException error) {
log.warn(error,"java Security Manager forbids 'System.getProperty(\"" + name + "\")' , returning default value: " + def );
return def;
}
Expand All @@ -178,7 +178,7 @@ private static String getStringProperty(final String name, final String def) {
private static boolean hasProperty(final String name){
try {
return null != System.getProperty(Defaults.SAMJDK_PREFIX + name);
} catch (final java.security.AccessControlException error) {
} catch (final SecurityException error) {
log.warn(error,"java Security Manager forbids 'System.getProperty(\"" + name + "\")' , returning false");
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/htsjdk/samtools/TextTagCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ else if (SAMUtils.isValidUnsignedIntegerAttribute(lValue)) {
}
} else if (type.equals("f")) {
try {
return new Float(stringVal);
return Float.parseFloat(stringVal);
} catch (NumberFormatException e) {
throw new SAMFormatException("Tag of type f should have single-precision floating point value");
}
Expand Down
Loading