Skip to content

Commit f87791f

Browse files
committed
fix #1274: test for dotty bootstrap based on tasty
1 parent 01bd948 commit f87791f

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

project/Build.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,7 @@ object DottyBuild extends Build {
172172
// http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
173173
javaOptions <++= (dependencyClasspath in Runtime, packageBin in Compile) map { (attList, bin) =>
174174
// put the Scala {library, reflect} in the classpath
175-
val path = for {
176-
file <- attList.map(_.data)
177-
path = file.getAbsolutePath
178-
} yield "-Xbootclasspath/p:" + path
179-
// dotty itself needs to be in the bootclasspath
180-
val fullpath = ("-Xbootclasspath/p:" + "dotty.jar") :: ("-Xbootclasspath/a:" + bin) :: path.toList
181-
// System.err.println("BOOTPATH: " + fullpath)
175+
val fullpath = List("-classpath", attList.map(_.data.getAbsolutePath).mkString(":"))
182176

183177
val travis_build = // propagate if this is a travis build
184178
if (sys.props.isDefinedAt(JENKINS_BUILD))

src/dotty/tools/dotc/config/PathResolver.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,14 @@ class PathResolver(implicit ctx: Context) {
220220
import context._
221221

222222
// Assemble the elements!
223+
// Scala application class path takes precedence
223224
def basis = List[Traversable[ClassPath]](
224-
classesInPath(javaBootClassPath), // 1. The Java bootstrap class path.
225-
contentsOfDirsInPath(javaExtDirs), // 2. The Java extension class path.
226-
classesInExpandedPath(javaUserClassPath), // 3. The Java application class path.
227-
classesInPath(scalaBootClassPath), // 4. The Scala boot class path.
228-
contentsOfDirsInPath(scalaExtDirs), // 5. The Scala extension class path.
229-
classesInExpandedPath(userClassPath), // 6. The Scala application class path.
225+
classesInExpandedPath(userClassPath), // 1. The Scala application class path.
226+
classesInPath(javaBootClassPath), // 2. The Java bootstrap class path.
227+
contentsOfDirsInPath(javaExtDirs), // 3. The Java extension class path.
228+
classesInExpandedPath(javaUserClassPath), // 4. The Java application class path.
229+
classesInPath(scalaBootClassPath), // 5. The Scala boot class path.
230+
contentsOfDirsInPath(scalaExtDirs), // 6. The Scala extension class path.
230231
sourcesInPath(sourcePath) // 7. The Scala source path.
231232
)
232233

test/dotc/tests.scala

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class tests extends CompilerTest {
2323
val defaultOutputDir = "./out/"
2424

2525
implicit val defaultOptions = noCheckOptions ++ List(
26-
"-Yno-deep-subtypes", "-Yno-double-bindings", "-Yforce-sbt-phases",
26+
"-usejavacp", "-Yno-deep-subtypes", "-Yno-double-bindings", "-Yforce-sbt-phases",
2727
"-d", defaultOutputDir) ++ {
2828
if (isRunByJenkins) List("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef") // should be Ycheck:all, but #725
2929
else List("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef")
@@ -288,4 +288,23 @@ class tests extends CompilerTest {
288288
@Test def tasty_dotc_util = compileDir(dotcDir, "util", testPickling)
289289
@Test def tasty_tools_io = compileDir(toolsDir, "io", testPickling)
290290
@Test def tasty_tests = compileDir(testsDir, "tasty", testPickling)
291+
292+
@Test def tasty_bootstrap = {
293+
val opt = List("-classpath", defaultOutputDir)
294+
// first compile dotty
295+
compileDir(dottyDir, ".", List("-deep", "-Ycheck-reentrant", "-strict"))(allowDeepSubtypes)
296+
297+
compileDir(dottyDir, "tools", opt)
298+
compileDir(toolsDir, "dotc", opt)
299+
compileDir(dotcDir, "ast", opt)
300+
compileDir(dotcDir, "config", opt)
301+
compileDir(dotcDir, "parsing", opt)
302+
compileDir(dotcDir, "printing", opt)
303+
compileDir(dotcDir, "repl", opt)
304+
compileDir(dotcDir, "reporting", opt)
305+
compileDir(dotcDir, "rewrite", opt)
306+
compileDir(dotcDir, "transform", opt)
307+
compileDir(dotcDir, "typer", opt)
308+
compileDir(dotcDir, "util", opt)
309+
}
291310
}

test/test/CompilerTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ abstract class CompilerTest {
209209
val path = s"$prefix$fileName"
210210
val f = new PlainFile(path)
211211
val repl = new TestREPL(new String(f.toCharArray))
212-
repl.process(Array[String]())
212+
repl.process(Array[String]("-usejavacp"))
213213
repl.check()
214214
}
215215

0 commit comments

Comments
 (0)