Skip to content

Commit

Permalink
Set a different jdk went running forking test (fix scala#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
MasseGuillaume committed Jul 3, 2018
1 parent a4f7b08 commit 5d25244
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ scala:
- 2.12.6
- 2.13.0-M4
jdk:
- openjdk7
- openjdk6
- oraclejdk8
env:
global:
Expand All @@ -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

# ?
Expand All @@ -45,9 +45,9 @@ matrix:

# | 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 | |
Expand All @@ -58,6 +58,7 @@ matrix:
before_script: ./checkCLA.sh
script:
- java -version
- echo $JAVA_HOME
- admin/build.sh

cache:
Expand Down
9 changes: 8 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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 += {
Expand Down
25 changes: 25 additions & 0 deletions compat/src/test/scala/test/scala/collection/JdkVersionTest.scala
Original file line number Diff line number Diff line change
@@ -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")
}
}
}
}

0 comments on commit 5d25244

Please sign in to comment.