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

Build and test on java 11 #1291

Merged
merged 1 commit into from
Feb 20, 2019
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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cache:
jdk:
- oraclejdk8
- openjdk8
- openjdk11
matrix:
fast_finish: true
allow_failures:
Expand All @@ -36,5 +37,5 @@ after_success:
- echo "TRAVIS_BRANCH='$TRAVIS_BRANCH'";
echo "JAVA_HOME='$JAVA_HOME'";
if [ "$TRAVIS_BRANCH" == "master" ]; then
./gradlew uploadArchives;
./gradlew publish;
fi
100 changes: 44 additions & 56 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ buildscript {
plugins {
id 'java'
id 'scala'
id 'maven'
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'com.palantir.git-version' version '0.11.0'
id 'com.github.johnrengelman.shadow' version '2.0.4'
id 'com.github.maiflai.scalatest' version '0.22'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id 'com.github.maiflai.scalatest' version '0.23'
}

repositories {
Expand All @@ -22,7 +22,6 @@ repositories {
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)

reports {
xml.enabled = true // codecov depends on xml format report
Expand All @@ -38,7 +37,7 @@ dependencies {
compile "org.tukaani:xz:1.5"
compile "gov.nih.nlm.ncbi:ngs-java:2.9.0"

testCompile "org.scala-lang:scala-library:2.12.6"
testCompile "org.scala-lang:scala-library:2.12.8"
testCompile "org.scalatest:scalatest_2.12:3.0.5"
testRuntime 'org.pegdown:pegdown:1.6.0' // Necessary for generating HTML reports with ScalaTest
testCompile "org.testng:testng:6.14.3"
Expand All @@ -58,6 +57,8 @@ group = 'com.github.samtools'

defaultTasks 'jar'



jar {
manifest {
attributes 'Implementation-Title': 'HTSJDK',
Expand Down Expand Up @@ -141,92 +142,79 @@ task testExternalApis(type: Test) {
}

wrapper {
gradleVersion = '4.8.1'
gradleVersion = '5.2.1'
}

// This is a hack to disable the java 8 default javadoc lint until we fix the html formatting
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}

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

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

/**
* This specifies what artifacts will be built and uploaded when performing a maven upload.
*/
artifacts {
archives jar
archives javadocJar
archives sourcesJar
archiveClassifier.set('sources')
}

/**
* Sign non-snapshot releases with our secret key. This should never need to be invoked directly.
*/
signing {
required { isRelease && gradle.taskGraph.hasTask("uploadArchives") }
required { isRelease && gradle.taskGraph.hasTask("publishHtsjdkPublicationToMavenRepository") }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the uppercase 'H' in "Htsjdk" significant? It seems to work ok locally (it winds up in "htsjdk"ok).

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't believe it's meaningful. I think it's case insensitive but the examples on the gradle website use camel case so I did as well.

sign configurations.archives
}

/**
* Upload a release to sonatype. You must be an authorized uploader and have your sonatype
* username and password information in your gradle properties file. See the readme for more info.
*
* For releasing to your local maven repo, use gradle install
*/
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
publishing {
publications {
htsjdk(MavenPublication) {
from components.java
artifact javadocJar
artifact sourcesJar

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: project.findProperty("sonatypeUsername"), password: project.findProperty("sonatypePassword"))
}

snapshotRepository(url: "https://broadinstitute.jfrog.io/broadinstitute/libs-snapshot-local/") {
authentication(userName: System.env.ARTIFACTORY_USERNAME, password: System.env.ARTIFACTORY_PASSWORD)
}

pom.project {
name 'HTSJDK'
packaging 'jar'
description 'A Java API for high-throughput sequencing data (HTS) formats'
url 'http://samtools.github.io/htsjdk/'
pom {
name = 'HTSJDK'
packaging = 'jar'
description = 'A Java API for high-throughput sequencing data (HTS) formats'
url = 'http://samtools.github.io/htsjdk/'

developers {
developer {
id 'picard'
name 'Picard Team'
url 'http://broadinstitute.github.io/picard'
id = 'picard'
name = 'Picard Team'
url = 'http://broadinstitute.github.io/picard'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unrelated and tangential, but this seems like ancient history. And if you look there, you see nothing about htsjdk.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I noticed that too but decided to leave it for later... I'll open a follow up to change it. Not sure to what though...

}
}

scm {
url '[email protected]:samtools/htsjdk.git'
connection 'scm:git:[email protected]:samtools/htsjdk.git'
url = '[email protected]:samtools/htsjdk.git'
connection = 'scm:git:[email protected]:samtools/htsjdk.git'
}

licenses {
license {
name 'MIT License'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
name = 'MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
}
}
}
doFirst {
System.out.println("Uploading version $version")

repositories {
maven {
credentials {
username = isRelease ? project.findProperty("sonatypeUsername") : System.env.ARTIFACTORY_USERNAME
password = isRelease ? project.findProperty("sonatypePassword") : System.env.ARTIFACTORY_PASSWORD
}
def release = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshot = "https://broadinstitute.jfrog.io/broadinstitute/libs-snapshot-local/"
url = isRelease ? release : snapshot
}
}
}

task install(dependsOn:publishToMavenLocal)
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m"'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wondering what triggered this change ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Rebuilding the wrapper triggered it. I think they reduced gradle's memory requirement so they added a small default one.


# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/htsjdk/samtools/util/MergingIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,11 @@ public MergingIterator(final Comparator<T> comparator, final Collection<Closeabl
// should we throw? it's prob'ly an error.
}

/**
* @see java.util.Iterator<T>.hasNext
*/
@Override
public boolean hasNext() {
return ! this.queue.isEmpty();
}

/**
* @see java.util.Iterator<T>.next
*/
@Override
public T next() {
if ( ! this.hasNext()) throw new NoSuchElementException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class FastqReaderWriterTest extends UnitSpec {
""".stripMargin.trim

Range.inclusive(1, 3).foreach { n =>
val text = fastq.lines.take(n).mkString("\n")
val text = fastq.linesIterator.take(n).mkString("\n")
val reader = new BufferedReader(new StringReader(text))
an[Exception] shouldBe thrownBy { new FastqReader(null, reader).iterator().toSeq }
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/htsjdk/samtools/util/StringUtilTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ class StringUtilTest extends UnitSpec {

it should "wrap text when lines are longer than length give" in {
val result = StringUtil.wordWrap(textForWrapping, 15)
result.lines.size shouldBe 5
result.lines.foreach(line => line.length should be <= 15)
result.linesIterator.size shouldBe 5
result.linesIterator.foreach(line => line.length should be <= 15)
}

"StringUtil.intValuesToString(int[])" should "generate a CSV string of ints" in {
Expand Down