diff --git a/.drone.yml b/.drone.yml index 3fbbe84d4b..d407db73cb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -29,6 +29,24 @@ matrix: "frontend/it:run" \ "gradleBloop212/test" \ "docs/run" + TEST_BLOOP_JDK11: + - bin/sbt-ci.sh \ + "show version" \ + "benchmarks/compile" \ + "jsonConfig210/test" \ + "jsonConfig211/test" \ + "jsonConfig212/test" \ + "millBloop/compile" \ + "mavenBloop/compile" \ + "sbtBloop013/publishLocal" \ + "sbtBloop10/publishLocal" \ + "frontend/testOnly bloop.ScalaVersionsSpec" \ + "backend/test" \ + "jsBridge06/test" \ + "jsBridge10/test" \ + "jsBridge06/publishLocal" \ + "jsBridge10/publishLocal" \ + "frontend/testOnly -bloop.ScalaVersionsSpec" RUN_COMMUNITY_BUILD_EXTRA: - bin/sbt-ci.sh \ @@ -63,6 +81,7 @@ matrix: OPS: - basic - community-build + - jdk11 - extra clone: git: @@ -128,6 +147,24 @@ pipeline: - ${TEST_BLOOP} - . bin/check-good-practices.sh # Check that good practices in the repo hold + build-jdk11: + image: eed3si9n/scala-docs:1.6-M2 + group: build + when: + ref: [ refs/heads/master, refs/tags/*, refs/pull/*/head ] + matrix: + OS: linux + OPS: jdk11 + commands: + - export JAVA_HOME="/usr/lib/jvm/jdk11/bin" + - java -version + - export DRONE_DIR="/drone" + - git log --oneline --graph | head -n 20 + - . bin/set-up-community-build-infra.sh # Source it because it exports variables + - . bin/detect-community-build.sh # Source it because it exports variables + - ${TEST_BLOOP_JDK11} + - . bin/check-good-practices.sh # Check that good practices in the repo hold + run_benchmarks_scripted: image: scalacenter/scala-docs:1.4 group: build diff --git a/.jvmopts b/.jvmopts index 18dacf397c..7cfa489391 100644 --- a/.jvmopts +++ b/.jvmopts @@ -1 +1 @@ --XX:ReservedCodeCacheSize=256m +-XX:ReservedCodeCacheSize=512m diff --git a/frontend/src/main/scala/bloop/testing/TestInternals.scala b/frontend/src/main/scala/bloop/testing/TestInternals.scala index 97f65ae891..d60bb13791 100644 --- a/frontend/src/main/scala/bloop/testing/TestInternals.scala +++ b/frontend/src/main/scala/bloop/testing/TestInternals.scala @@ -34,7 +34,7 @@ import scala.util.control.NonFatal object TestInternals { private final val sbtOrg = "org.scala-sbt" private final val testAgentId = "test-agent" - private final val testAgentVersion = "1.0.4" + private final val testAgentVersion = "1.2.8" private implicit val logContext: DebugFilter = DebugFilter.Test @@ -45,7 +45,15 @@ object TestInternals { lazy val filteredLoader = { val filter = new IncludePackagesFilter( - Set("java.", "javax.", "sun.", "sbt.testing.", "org.scalatools.testing.", "org.xml.sax.") + Set( + "jdk.", + "java.", + "javax.", + "sun.", + "sbt.testing.", + "org.scalatools.testing.", + "org.xml.sax." + ) ) new FilteredLoader(getClass.getClassLoader, filter) } diff --git a/frontend/src/test/resources/scala-seed-project/build.sbt b/frontend/src/test/resources/scala-seed-project/build.sbt new file mode 100644 index 0000000000..82113a0a94 --- /dev/null +++ b/frontend/src/test/resources/scala-seed-project/build.sbt @@ -0,0 +1,16 @@ +import Dependencies._ + +bloopExportJarClassifiers in Global := Some(Set("sources")) +bloopConfigDir in Global := baseDirectory.value / "bloop-config" + +ThisBuild / scalaVersion := "2.12.9" +ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / organization := "com.example" +ThisBuild / organizationName := "example" + +lazy val root = (project in file(".")) + .settings( + name := "Scala Seed Project", + libraryDependencies += scalaTest % Test, + fork in Test := true + ) diff --git a/frontend/src/test/resources/scala-seed-project/project/Dependencies.scala b/frontend/src/test/resources/scala-seed-project/project/Dependencies.scala new file mode 100644 index 0000000000..858a1fe4c0 --- /dev/null +++ b/frontend/src/test/resources/scala-seed-project/project/Dependencies.scala @@ -0,0 +1,5 @@ +import sbt._ + +object Dependencies { + lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.8" +} diff --git a/frontend/src/test/resources/scala-seed-project/project/build.properties b/frontend/src/test/resources/scala-seed-project/project/build.properties new file mode 100644 index 0000000000..c0bab04941 --- /dev/null +++ b/frontend/src/test/resources/scala-seed-project/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.2.8 diff --git a/frontend/src/test/resources/scala-seed-project/project/plugins.sbt b/frontend/src/test/resources/scala-seed-project/project/plugins.sbt new file mode 100644 index 0000000000..cc57238f4d --- /dev/null +++ b/frontend/src/test/resources/scala-seed-project/project/plugins.sbt @@ -0,0 +1,30 @@ +val typesafeConfig = "com.typesafe" % "config" % "1.3.2" +val metaconfigCore = "com.geirsson" %% "metaconfig-core" % "0.6.0" +val metaconfigConfig = "com.geirsson" %% "metaconfig-typesafe-config" % "0.6.0" +val metaconfigDocs = "com.geirsson" %% "metaconfig-docs" % "0.6.0" +val circeDerivation = "io.circe" %% "circe-derivation" % "0.9.0-M3" + +// Let's add our sbt plugin to the sbt too ;) +unmanagedSourceDirectories in Compile ++= { + val baseDir = + baseDirectory.value.getParentFile.getParentFile.getParentFile.getParentFile.getParentFile.getParentFile + val integrationsMainDir = baseDir / "integrations" + if (!integrationsMainDir.exists()) Nil + else { + val pluginMainDir = integrationsMainDir / "sbt-bloop" / "src" / "main" + List( + baseDir / "config" / "src" / "main" / "scala", + baseDir / "config" / "src" / "main" / "scala-2.11-12", + pluginMainDir / "scala", + pluginMainDir / s"scala-sbt-${sbt.Keys.sbtBinaryVersion.value}" + ) + } +} + +libraryDependencies ++= List( + typesafeConfig, + metaconfigCore, + metaconfigDocs, + metaconfigConfig, + circeDerivation +) diff --git a/frontend/src/test/resources/scala-seed-project/src/main/scala/example/Hello.scala b/frontend/src/test/resources/scala-seed-project/src/main/scala/example/Hello.scala new file mode 100644 index 0000000000..80ea40a9b3 --- /dev/null +++ b/frontend/src/test/resources/scala-seed-project/src/main/scala/example/Hello.scala @@ -0,0 +1,9 @@ +package example + +object Hello extends Greeting with App { + println(greeting) +} + +trait Greeting { + lazy val greeting: String = "hello" +} diff --git a/frontend/src/test/resources/scala-seed-project/src/test/scala/example/HelloSpec.scala b/frontend/src/test/resources/scala-seed-project/src/test/scala/example/HelloSpec.scala new file mode 100644 index 0000000000..56f5e66f6e --- /dev/null +++ b/frontend/src/test/resources/scala-seed-project/src/test/scala/example/HelloSpec.scala @@ -0,0 +1,9 @@ +package example + +import org.scalatest._ + +class HelloSpec extends FlatSpec with Matchers { + "The Hello object" should "say hello" in { + Hello.greeting shouldEqual "hello" + } +} diff --git a/frontend/src/test/scala/bloop/BuildPipeliningSpec.scala b/frontend/src/test/scala/bloop/BuildPipeliningSpec.scala index 5ff8d8efa6..97c3674fe4 100644 --- a/frontend/src/test/scala/bloop/BuildPipeliningSpec.scala +++ b/frontend/src/test/scala/bloop/BuildPipeliningSpec.scala @@ -59,7 +59,7 @@ object BuildPipeliningSpec extends bloop.testing.BaseSuite { } } - test("compile simple build using Scala 2.10 (without pipelining)") { + testOnlyOnJava8("compile simple build using Scala 2.10 (without pipelining)") { TestUtil.withinWorkspace { workspace => object Sources { val `A.scala` = diff --git a/frontend/src/test/scala/bloop/RunSpec.scala b/frontend/src/test/scala/bloop/RunSpec.scala index f88acd82a3..39054cb586 100644 --- a/frontend/src/test/scala/bloop/RunSpec.scala +++ b/frontend/src/test/scala/bloop/RunSpec.scala @@ -120,81 +120,93 @@ class RunSpec { @Test def runCanSeeCompileResources: Unit = { - val mainClassName = "hello.AppWithResources" - val state = loadTestProject("cross-test-build-0.6") - val command = Commands.Run(List("test-project"), Some(mainClassName), args = List.empty) - runAndCheck(state, command) { messages => - assert(messages.contains(("info", "Resources were found"))) + TestUtil.runOnlyOnJava8 { + val mainClassName = "hello.AppWithResources" + val state = loadTestProject("cross-test-build-0.6") + val command = Commands.Run(List("test-project"), Some(mainClassName), args = List.empty) + runAndCheck(state, command) { messages => + assert(messages.contains(("info", "Resources were found"))) + } } } @Test def runIncludesTransitiveResourcesInAggregatedProjects: Unit = { - val target = "cross-test-build-0-6" - val state = loadTestProject("cross-test-build-0.6") - state.build.getProjectFor(target) match { - case Some(rootWithAggregation) => - val dag = state.build.getDagFor(rootWithAggregation) - // Create dependent resources so that they appear in the full dependency classpath - val dependentResources = Dag.dfs(dag).flatMap(_.resources) - dependentResources.foreach { resource => - if (resource.exists) () - else Files.createDirectories(resource.underlying) - } + TestUtil.runOnlyOnJava8 { + val target = "cross-test-build-0-6" + val state = loadTestProject("cross-test-build-0.6") + state.build.getProjectFor(target) match { + case Some(rootWithAggregation) => + val dag = state.build.getDagFor(rootWithAggregation) + // Create dependent resources so that they appear in the full dependency classpath + val dependentResources = Dag.dfs(dag).flatMap(_.resources) + dependentResources.foreach { resource => + if (resource.exists) () + else Files.createDirectories(resource.underlying) + } - val fullClasspath = rootWithAggregation.fullClasspath(dag, state.client).toList - Assert.assertFalse(dependentResources.isEmpty) - dependentResources.foreach { r => - Assert.assertTrue(s"Missing $r in $fullClasspath", fullClasspath.contains(r)) - } - case None => Assert.fail(s"Missing root $target") + val fullClasspath = rootWithAggregation.fullClasspath(dag, state.client).toList + Assert.assertFalse(dependentResources.isEmpty) + dependentResources.foreach { r => + Assert.assertTrue(s"Missing $r in $fullClasspath", fullClasspath.contains(r)) + } + case None => Assert.fail(s"Missing root $target") + } } } @Test def canRunMainFromSourceDependency: Unit = { - val mainClassName = "hello.App" - val state = loadTestProject("cross-test-build-0.6") - val command = Commands.Run(List("test-project-test"), Some(mainClassName), args = List.empty) - runAndCheck(state, command) { messages => - assert(messages.contains(("info", "Hello, world!"))) + TestUtil.runOnlyOnJava8 { + val mainClassName = "hello.App" + val state = loadTestProject("cross-test-build-0.6") + val command = Commands.Run(List("test-project-test"), Some(mainClassName), args = List.empty) + runAndCheck(state, command) { messages => + assert(messages.contains(("info", "Hello, world!"))) + } } } @Test def canRunDefaultMainClass: Unit = { - // The default main class is set to hello.App build.sbt. Therefore, no error must be triggered here. - val state = loadTestProject("cross-test-build-0.6") - val command = Commands.Run(List("test-project"), None, args = List.empty) - runAndCheck(state, command) { messages => - assert(messages.contains(("info", "Hello, world!"))) + TestUtil.runOnlyOnJava8 { + // The default main class is set to hello.App build.sbt. Therefore, no error must be triggered here. + val state = loadTestProject("cross-test-build-0.6") + val command = Commands.Run(List("test-project"), None, args = List.empty) + runAndCheck(state, command) { messages => + assert(messages.contains(("info", "Hello, world!"))) + } } } @Test def canRunMainFromBinaryDependency: Unit = { - val mainClassName = "App" - val state = loadTestProject("cross-test-build-0.6") - val command = Commands.Run(List("test-project"), Some(mainClassName), args = List.empty) - runAndCheck(state, command) { messages => - assert(messages.contains(("info", "Hello, world!"))) + TestUtil.runOnlyOnJava8 { + val mainClassName = "App" + val state = loadTestProject("cross-test-build-0.6") + val command = Commands.Run(List("test-project"), Some(mainClassName), args = List.empty) + runAndCheck(state, command) { messages => + assert(messages.contains(("info", "Hello, world!"))) + } } } @Test def setCorrectCwd: Unit = { - val mainClassName = "hello.ShowCwd" - val state = loadTestProject("cross-test-build-0.6") - val command = Commands.Run(List("test-project"), Some(mainClassName), args = List.empty) - val targetMsg = { - if (bloop.util.CrossPlatform.isWindows) "cross-test-build-0.6\\test-project\\jvm" - else "cross-test-build-0.6/test-project/jvm" - } + TestUtil.runOnlyOnJava8 { + val mainClassName = "hello.ShowCwd" + val state = loadTestProject("cross-test-build-0.6") + val command = Commands.Run(List("test-project"), Some(mainClassName), args = List.empty) + val targetMsg = { + if (bloop.util.CrossPlatform.isWindows) "cross-test-build-0.6\\test-project\\jvm" + else "cross-test-build-0.6/test-project/jvm" + } - runAndCheck(state, command) { messages => - assert( - messages.reverse.find(_._1 == "info").exists(_._2.endsWith(targetMsg)) - ) + runAndCheck(state, command) { messages => + assert( + messages.reverse.find(_._1 == "info").exists(_._2.endsWith(targetMsg)) + ) + } } } diff --git a/frontend/src/test/scala/bloop/ScalaVersionsSpec.scala b/frontend/src/test/scala/bloop/ScalaVersionsSpec.scala index e7e6380e5b..b985b0d22a 100644 --- a/frontend/src/test/scala/bloop/ScalaVersionsSpec.scala +++ b/frontend/src/test/scala/bloop/ScalaVersionsSpec.scala @@ -40,9 +40,13 @@ object ScalaVersionsSpec extends bloop.testing.BaseSuite { val `2.10` = compileProjectFor("2.10.7") val `2.11` = compileProjectFor("2.11.11") - val `2.12` = compileProjectFor("2.12.8") - val `2.13` = compileProjectFor("2.13.0-RC2") - val all = List(`2.10`, `2.11`, `2.12`, `2.13`) + val `2.12` = compileProjectFor("2.12.9") + val `2.13` = compileProjectFor("2.13.0") + val all = { + if (TestUtil.isJdk8) List(`2.10`, `2.11`, `2.12`, `2.13`) + else List(`2.12`, `2.13`) + } + TestUtil.await(FiniteDuration(60, "s"), ExecutionContext.ioScheduler) { Task.gatherUnordered(all).map(_ => ()) } diff --git a/frontend/src/test/scala/bloop/TestSpec.scala b/frontend/src/test/scala/bloop/TestSpec.scala index 0f66a39117..aae548f754 100644 --- a/frontend/src/test/scala/bloop/TestSpec.scala +++ b/frontend/src/test/scala/bloop/TestSpec.scala @@ -19,16 +19,17 @@ import scala.concurrent.duration.FiniteDuration import monix.eval.Task import monix.execution.CancelableFuture -abstract class BaseTestSpec(val projectName: String) - extends ProjectBaseSuite("cross-test-build-0.6") { - testProject("project compiles") { (build, logger) => +abstract class BaseTestSpec(val projectName: String, buildName: String) + extends ProjectBaseSuite(buildName) { + val testOnlyOnJava8 = buildName == "cross-test-build-0.6" + testProject("project compiles", testOnlyOnJava8) { (build, logger) => val project = build.projectFor(projectName) val compiledState = build.state.compile(project) assert(compiledState.status == ExitStatus.Ok) } val expectedFullTestsOutput: String - testProject("runs all available suites") { (build, logger) => + testProject("runs all available suites", testOnlyOnJava8) { (build, logger) => val project = build.projectFor(projectName) val testState = build.state.test(project) assert(logger.errors.size == 0) @@ -39,7 +40,23 @@ abstract class BaseTestSpec(val projectName: String) } } -object JsTestSpec extends BaseTestSpec("test-projectJS-test") { +object SeedTestSpec extends BaseTestSpec("root-test", "scala-seed-project") { + val expectedFullTestsOutput: String = + """|HelloSpec: + |The Hello object + |- should say hello + |Execution took ??? + |1 tests, 1 passed + |All tests in example.HelloSpec passed + | + |=============================================== + |Total duration: ??? + |All 1 test suites passed. + |=============================================== + |""".stripMargin +} + +object JsTestSpec extends BaseTestSpec("test-projectJS-test", "cross-test-build-0.6") { val expectedFullTestsOutput: String = { """|Execution took ??? |1 tests, 1 passed @@ -87,7 +104,7 @@ object JsTestSpec extends BaseTestSpec("test-projectJS-test") { } } -object JvmTestSpec extends BaseTestSpec("test-project-test") { +object JvmTestSpec extends BaseTestSpec("test-project-test", "cross-test-build-0.6") { val expectedFullTestsOutput: String = { """|Test run started |Test hello.JUnitTest.myTest started @@ -144,26 +161,27 @@ object JvmTestSpec extends BaseTestSpec("test-project-test") { |===============================================""".stripMargin } - testProject("test options work when one framework is singled out") { (build, logger) => - val project = build.projectFor(projectName) - val testState = build.state.test(project, List("hello.JUnitTest"), List("*myTest*")) - assertNoDiff( - logger.renderTimeInsensitiveTestInfos, - """Test run started - |Test hello.JUnitTest.myTest started - |Test run finished: 0 failed, 0 ignored, 1 total, ??? - |Execution took ??? - |1 tests, 1 passed - |All tests in hello.JUnitTest passed - | - |=============================================== - |Total duration: ??? - |All 1 test suites passed. - |===============================================""".stripMargin - ) + testProject("test options work when one framework is singled out", runOnlyOnJava8 = true) { + (build, logger) => + val project = build.projectFor(projectName) + val testState = build.state.test(project, List("hello.JUnitTest"), List("*myTest*")) + assertNoDiff( + logger.renderTimeInsensitiveTestInfos, + """Test run started + |Test hello.JUnitTest.myTest started + |Test run finished: 0 failed, 0 ignored, 1 total, ??? + |Execution took ??? + |1 tests, 1 passed + |All tests in hello.JUnitTest passed + | + |=============================================== + |Total duration: ??? + |All 1 test suites passed. + |===============================================""".stripMargin + ) } - testProject("test exclusions work") { (build, logger) => + testProject("test exclusions work", runOnlyOnJava8 = true) { (build, logger) => val project = build.projectFor(projectName) val testState = build.state.test(project, List("-hello.JUnitTest"), Nil) assertNoDiff( @@ -217,7 +235,7 @@ object JvmTestSpec extends BaseTestSpec("test-project-test") { ) } - testProject("specifying -h in Scalatest runner works") { (build, logger) => + testProject("specifying -h in Scalatest runner works", runOnlyOnJava8 = true) { (build, logger) => val project = build.projectFor(projectName) val scalatestArgs = List("-h", "target/test-reports") val testState = build.state.test(project, List("hello.ScalaTestTest"), scalatestArgs) @@ -237,74 +255,75 @@ object JvmTestSpec extends BaseTestSpec("test-project-test") { ) } - testProject("test options don't work when none framework is singled out") { (build, logger) => - val project = build.projectFor(projectName) - val testState = build.state.test(project, Nil, List("*myTest*")) + testProject("test options don't work when none framework is singled out", runOnlyOnJava8 = true) { + (build, logger) => + val project = build.projectFor(projectName) + val testState = build.state.test(project, Nil, List("*myTest*")) - assertNoDiff( - logger.warnings.mkString(System.lineSeparator()), - "Ignored CLI test options 'List(*myTest*)' can only be applied to one framework, found: JUnit, ScalaCheck, ScalaTest, specs2, utest" - ) + assertNoDiff( + logger.warnings.mkString(System.lineSeparator()), + "Ignored CLI test options 'List(*myTest*)' can only be applied to one framework, found: JUnit, ScalaCheck, ScalaTest, specs2, utest" + ) - assertNoDiff( - logger.renderTimeInsensitiveTestInfos, - """|Test run started - |Test hello.JUnitTest.myTest started - |Test run finished: 0 failed, 0 ignored, 1 total, ??? - |Execution took ??? - |1 tests, 1 passed - |All tests in hello.JUnitTest passed - | - |Execution took ??? - |No test suite was run - | - |+ Greeting.is personal: OK, passed 100 tests. - |Execution took ??? - |1 tests, 1 passed - |All tests in hello.ScalaCheckTest passed - | - |ResourcesTest: - |Resources - |- should be found - |Execution took ??? - |1 tests, 1 passed - |All tests in hello.ResourcesTest passed - | - |ScalaTestTest: - |A greeting - |- should be very personal - |Execution took ??? - |1 tests, 1 passed - |All tests in hello.ScalaTestTest passed - | - |Specs2Test - | - | This is a specification to check the `Hello` object. - | - | A greeting - | + is very personal - | - |Total for specification Specs2Test - |Finished in ??? 1 example, 0 failure, 0 error - | - |Execution took ??? - |1 tests, 1 passed - |All tests in hello.Specs2Test passed - | - |-------------------------------- Running Tests -------------------------------- - |+ hello.UTestTest.Greetings are very personal ??? - |Execution took ??? - |1 tests, 1 passed - |All tests in hello.UTestTest passed - | - |=============================================== - |Total duration: ??? - |6 passed - |===============================================""".stripMargin - ) + assertNoDiff( + logger.renderTimeInsensitiveTestInfos, + """|Test run started + |Test hello.JUnitTest.myTest started + |Test run finished: 0 failed, 0 ignored, 1 total, ??? + |Execution took ??? + |1 tests, 1 passed + |All tests in hello.JUnitTest passed + | + |Execution took ??? + |No test suite was run + | + |+ Greeting.is personal: OK, passed 100 tests. + |Execution took ??? + |1 tests, 1 passed + |All tests in hello.ScalaCheckTest passed + | + |ResourcesTest: + |Resources + |- should be found + |Execution took ??? + |1 tests, 1 passed + |All tests in hello.ResourcesTest passed + | + |ScalaTestTest: + |A greeting + |- should be very personal + |Execution took ??? + |1 tests, 1 passed + |All tests in hello.ScalaTestTest passed + | + |Specs2Test + | + | This is a specification to check the `Hello` object. + | + | A greeting + | + is very personal + | + |Total for specification Specs2Test + |Finished in ??? 1 example, 0 failure, 0 error + | + |Execution took ??? + |1 tests, 1 passed + |All tests in hello.Specs2Test passed + | + |-------------------------------- Running Tests -------------------------------- + |+ hello.UTestTest.Greetings are very personal ??? + |Execution took ??? + |1 tests, 1 passed + |All tests in hello.UTestTest passed + | + |=============================================== + |Total duration: ??? + |6 passed + |===============================================""".stripMargin + ) } - testProject("cancel test execution works") { (build, logger) => + testProject("cancel test execution works", runOnlyOnJava8 = true) { (build, logger) => object Sources { val `JUnitTest.scala` = """package hello diff --git a/frontend/src/test/scala/bloop/testing/BaseSuite.scala b/frontend/src/test/scala/bloop/testing/BaseSuite.scala index d914beeaab..b3235fce05 100644 --- a/frontend/src/test/scala/bloop/testing/BaseSuite.scala +++ b/frontend/src/test/scala/bloop/testing/BaseSuite.scala @@ -553,6 +553,11 @@ class BaseSuite extends TestSuite with BloopHelpers { ) } + def testOnlyOnJava8(name: String)(fun: => Any): Unit = { + if (TestUtil.isJdk8) test(name)(fun) + else ignore(name, label = s"IGNORED ON JAVA v${TestUtil.jdkVersion}")(fun) + } + def test(name: String)(fun: => Any): Unit = { myTests += FlatTest(name, () => { fun; () }) } diff --git a/frontend/src/test/scala/bloop/testing/ProjectBaseSuite.scala b/frontend/src/test/scala/bloop/testing/ProjectBaseSuite.scala index 5775f881cc..15a8384bd9 100644 --- a/frontend/src/test/scala/bloop/testing/ProjectBaseSuite.scala +++ b/frontend/src/test/scala/bloop/testing/ProjectBaseSuite.scala @@ -8,13 +8,16 @@ class ProjectBaseSuite(buildName: String) extends BaseSuite { val workspace = AbsolutePath(Files.createTempDirectory(s"workspace-${buildName}")) val build: TestBuild = { val logger = new RecordingLogger(ansiCodesSupported = false) - loadBuildFromResources("cross-test-build-0.6", workspace, logger) + loadBuildFromResources(buildName, workspace, logger) } - def testProject(name: String)(fun: (TestBuild, RecordingLogger) => Any): Unit = { + def testProject(name: String, runOnlyOnJava8: Boolean)( + fun: (TestBuild, RecordingLogger) => Any + ): Unit = { val newLogger = new RecordingLogger(ansiCodesSupported = false) val newBuild = build.withLogger(newLogger) - test(name)(fun(newBuild, newLogger)) + if (runOnlyOnJava8) testOnlyOnJava8(name)(fun(newBuild, newLogger)) + else test(name)(fun(newBuild, newLogger)) } override def test(name: String)(fun: => Any): Unit = { diff --git a/frontend/src/test/scala/bloop/util/TestUtil.scala b/frontend/src/test/scala/bloop/util/TestUtil.scala index 38ca9ed38e..ff319be032 100644 --- a/frontend/src/test/scala/bloop/util/TestUtil.scala +++ b/frontend/src/test/scala/bloop/util/TestUtil.scala @@ -48,6 +48,14 @@ object TestUtil { def getProject(name: String, state: State): Project = state.build.getProjectFor(name).getOrElse(sys.error(s"Project '$name' does not exist!")) + val jdkVersion = sys.props("java.version") + def isJdk8 = jdkVersion.startsWith("8") || jdkVersion.startsWith("1.8") + + def runOnlyOnJava8(thunk: => Unit): Unit = { + if (isJdk8) thunk + else () + } + final val componentProvider = ZincInternals.getComponentProvider(bloop.io.Paths.getCacheDirectory("components")) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 376ee82230..312139c570 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -18,7 +18,7 @@ object Dependencies { val caseAppVersion = "1.2.0-faster-compile-time" val sourcecodeVersion = "0.1.4" val sbtTestInterfaceVersion = "1.0" - val sbtTestAgentVersion = "1.0.4" + val sbtTestAgentVersion = "1.2.8" val junitVersion = "0.11" val junitSystemRulesVersion = "1.19.0" val graphvizVersion = "0.2.2"