diff --git a/.travis.yml b/.travis.yml index 80eaa60a..f0e8a91d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ scala: - 2.12.6 - 2.13.0-M4 jdk: - - openjdk7 + - openjdk6 - oraclejdk8 env: global: @@ -23,10 +23,10 @@ env: matrix: exclude: # > 2.12 requires jdk8 - - jdk: openjdk7 + - jdk: openjdk6 scala: 2.12.6 - - jdk: openjdk7 + - jdk: openjdk6 scala: 2.13.0-M4 # ? @@ -43,11 +43,17 @@ matrix: jdk: oraclejdk8 env: TEST_SCALAFIX=true + - addons: + apt: + packages: + - openjdk-6-jdk + jdk: openjdk6 + # | jdk | scala | scala target | scala target version | scalafix test | # | ----------- | --------- | ------------ | -------------------- |---------------| -# | openjdk7 | 2.11.12 | jvm | | | -# | openjdk7 | 2.11.12 | js | 0.6.23 | | -# | openjdk7 | 2.11.12 | js | 1.0.0-M3 | | +# | openjdk6 | 2.11.12 | jvm | | | +# | openjdk6 | 2.11.12 | js | 0.6.23 | | +# | openjdk6 | 2.11.12 | js | 1.0.0-M3 | | # | oraclejdk8 | 2.12.6 | jvm | | | # | oraclejdk8 | 2.12.6 | js | 0.6.23 | | # | oraclejdk8 | 2.12.6 | js | 1.0.0-M3 | | @@ -57,7 +63,8 @@ matrix: before_script: ./checkCLA.sh script: - - java -version + - java -version # always oraclejdk8 + - echo $JAVA_HOME - admin/build.sh cache: diff --git a/admin/build.sh b/admin/build.sh index 52a555dd..6e47dfea 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -62,4 +62,4 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then fi fi -sbt -Dhttps.protocols=TLSv1.2 -sbt-dir=/home/travis/.sbt ";$crossScalaVersion ;$publishVersion ;$projectPrefix/clean ;$testProjectPrefix/test ;$projectPrefix/publishLocal ;$publishTask" +sbt -Dhttps.protocols=TLSv1.2 ";$crossScalaVersion ;$publishVersion ;$projectPrefix/clean ;$testProjectPrefix/test ;$projectPrefix/publishLocal ;$publishTask" diff --git a/build.sbt b/build.sbt index cc7362c6..de8b7d82 100644 --- a/build.sbt +++ b/build.sbt @@ -32,7 +32,14 @@ lazy val compat = crossProject(JSPlatform, JVMPlatform) ) .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.collection.compat.*;version=${version.value}"), - libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test" + libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test", + javaHome := { + val oldValue = javaHome.value + val isOnCi = sys.env.get("CI").isDefined + + if (isOnCi) Some(file(sys.env("JAVA_HOME"))) + else oldValue + } ) .jsSettings( scalacOptions += { diff --git a/compat/src/test/scala/test/scala/collection/JdkVersionTest.scala b/compat/src/test/scala/test/scala/collection/JdkVersionTest.scala new file mode 100644 index 00000000..36412003 --- /dev/null +++ b/compat/src/test/scala/test/scala/collection/JdkVersionTest.scala @@ -0,0 +1,25 @@ +package test.scala.collection + +import org.junit.Assert._ +import org.junit.Test + +class JdkVersionTest { + + @Test + def testJavaVersion: Unit = { + val isOnCi = sys.env.get("CI").isDefined + + if (isOnCi) { + val travisJdkVersion = sys.env("TRAVIS_JDK_VERSION") + val jdkVersion = sys.props("java.specification.version") + + if (travisJdkVersion == "openjdk6") { + assertEquals(jdkVersion, "1.6") + } else if (travisJdkVersion == "oraclejdk8") { + assertEquals(jdkVersion, "1.8") + } else { + throw new Exception(s"Unknown CI jdk version: $travisJdkVersion") + } + } + } +}