From 102ddfd655fd0ae8cf505b0a12519ff8e2655eb6 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 8 Jun 2019 12:18:11 +0800 Subject: replace testFrameworksJvmClasspath and testClasspathJvm with just runClasspath (#627) --- scalanativelib/src/ScalaNativeModule.scala | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'scalanativelib') diff --git a/scalanativelib/src/ScalaNativeModule.scala b/scalanativelib/src/ScalaNativeModule.scala index b04b00a1..d6fb66bd 100644 --- a/scalanativelib/src/ScalaNativeModule.scala +++ b/scalanativelib/src/ScalaNativeModule.scala @@ -173,7 +173,7 @@ trait TestScalaNativeModule extends ScalaNativeModule with TestModule { testOute // The test frameworks run under the JVM and communicate with the native binary over a socket // therefore the test framework is loaded from a JVM classloader val testClassloader = - new URLClassLoader(testClasspathJvm().map(_.path.toIO.toURI.toURL).toArray, + new URLClassLoader(runClasspath().map(_.path.toIO.toURI.toURL).toArray, this.getClass.getClassLoader) val frameworkInstances = TestRunner.frameworks(testFrameworks())(testClassloader) val testBinary = testRunnerNative.nativeLink().toIO @@ -186,7 +186,7 @@ trait TestScalaNativeModule extends ScalaNativeModule with TestModule { testOute val (doneMsg, results) = TestRunner.runTests( nativeFrameworks, - testClasspathJvm().map(_.path), + runClasspath().map(_.path), Agg(compile().classes.path), args ) @@ -194,25 +194,6 @@ trait TestScalaNativeModule extends ScalaNativeModule with TestModule { testOute TestModule.handleResults(doneMsg, results) } - private val supportedTestFrameworks = Set("utest", "scalatest") - - // get the JVM classpath entries for supported test frameworks - def testFrameworksJvmClasspath = T{ - Lib.resolveDependencies( - repositories, - Lib.depToDependency(_, scalaVersion(), ""), - transitiveIvyDeps().filter(d => d.cross.isBinary && supportedTestFrameworks(d.dep.module.name.value)), - ctx = Some(implicitly[mill.util.Ctx.Log]) - ) - } - - def testClasspathJvm = T{ - localClasspath() ++ - transitiveLocalClasspath() ++ - unmanagedClasspath() ++ - testFrameworksJvmClasspath() - } - // creates a specific binary used for running tests - has a different (generated) main class // which knows the names of all the tests and references to invoke them object testRunnerNative extends ScalaNativeModule { @@ -243,7 +224,7 @@ trait TestScalaNativeModule extends ScalaNativeModule with TestModule { testOute val frameworkInstances = TestRunner.frameworks(testFrameworks()) _ val testClasses = - Jvm.inprocess(testClasspathJvm().map(_.path), classLoaderOverrideSbtTesting = true, isolated = true, closeContextClassLoaderWhenDone = true, + Jvm.inprocess(runClasspath().map(_.path), classLoaderOverrideSbtTesting = true, isolated = true, closeContextClassLoaderWhenDone = true, cl => { frameworkInstances(cl).flatMap { framework => val df = Lib.discoverTests(cl, framework, Agg(compile().classes.path)) -- cgit v1.2.3