Skip to content

Commit dd320ae

Browse files
committed
CompilationTests.tastyBootstrap: Avoid hardcoding path
The hardcoded scala-2.12 won't be valid once we bootstrap.
1 parent d249926 commit dd320ae

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

compiler/test/dotty/Properties.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package dotty
22

3+
import java.nio.file._
4+
35
/** Runtime properties from defines or environmnent */
46
object Properties {
57

@@ -36,6 +38,9 @@ object Properties {
3638
*/
3739
val testsSafeMode: Boolean = sys.props.isDefinedAt("dotty.tests.safemode")
3840

41+
/** Extra directory containing sources for the compiler */
42+
def dottyCompilerManagedSources: Path = Paths.get(sys.props("dotty.tests.dottyCompilerManagedSources"))
43+
3944
/** dotty-interfaces jar */
4045
def dottyInterfaces: String = sys.props("dotty.tests.classes.dottyInterfaces")
4146

compiler/test/dotty/tools/TestSources.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object TestSources {
6262
(fileName.endsWith(".scala") || fileName.endsWith(".java")) && !excludedFiles.contains(fileName)
6363
}
6464

65-
assert(Files.isDirectory(path))
65+
assert(Files.isDirectory(path), s"Not a directory: $path")
6666
val files = if (shallow) Files.list(path) else Files.walk(path)
6767
try {
6868
val sources = files

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,10 @@ class CompilationTests extends ParallelTesting {
239239
defaultOptions.and("-Ycheck-reentrant", "-strict", "-priorityclasspath", defaultOutputDir))(libGroup)
240240

241241
val compilerSources = sources(Paths.get("compiler/src"))
242+
val compilerManagedSources = sources(Properties.dottyCompilerManagedSources)
242243

243-
val scalaJSIRDir = Paths.get("compiler/target/scala-2.12/src_managed/main/scalajs-ir-src/org/scalajs/ir")
244-
val scalaJSIRSources = sources(scalaJSIRDir, shallow = true)
245-
246-
val dotty1 = compileList("dotty", compilerSources ++ scalaJSIRSources, opt)(dotty1Group)
247-
val dotty2 = compileList("dotty", compilerSources ++ scalaJSIRSources, opt)(dotty2Group)
244+
val dotty1 = compileList("dotty", compilerSources ++ compilerManagedSources, opt)(dotty1Group)
245+
val dotty2 = compileList("dotty", compilerSources ++ compilerManagedSources, opt)(dotty2Group)
248246

249247
val tests = {
250248
lib.keepOutput :: dotty1.keepOutput :: {
@@ -262,7 +260,7 @@ class CompilationTests extends ParallelTesting {
262260
compileShallowFilesInDir("compiler/src/dotty/tools/dotc/util", opt) +
263261
compileShallowFilesInDir("compiler/src/dotty/tools/backend", opt) +
264262
compileShallowFilesInDir("compiler/src/dotty/tools/backend/jvm", opt) +
265-
compileList("shallow-scalajs-ir", scalaJSIRSources, opt)
263+
compileList("managed-sources", compilerManagedSources, opt)
266264
}.keepOutput :: Nil
267265
}.map(_.checkCompile())
268266

project/Build.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ object Build {
461461
else List()
462462

463463
val jarOpts = List(
464+
"-Ddotty.tests.dottyCompilerManagedSources=" + (sourceManaged in Compile).value,
464465
"-Ddotty.tests.classes.dottyInterfaces=" + jars("dotty-interfaces"),
465466
"-Ddotty.tests.classes.dottyLibrary=" + jars("dotty-library"),
466467
"-Ddotty.tests.classes.dottyCompiler=" + jars("dotty-compiler"),

0 commit comments

Comments
 (0)