aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/scalajs/ScalaJsLib.scala5
-rw-r--r--stage1/Stage1Lib.scala5
-rw-r--r--stage1/resolver.scala4
-rw-r--r--stage2/BasicBuild.scala5
-rw-r--r--stage2/Lib.scala6
-rw-r--r--stage2/ToolsTasks.scala12
-rw-r--r--stage2/plugins/Dotty.scala14
-rw-r--r--stage2/plugins/Frege.scala5
8 files changed, 23 insertions, 33 deletions
diff --git a/plugins/scalajs/ScalaJsLib.scala b/plugins/scalajs/ScalaJsLib.scala
index 7886478..5b231a1 100644
--- a/plugins/scalajs/ScalaJsLib.scala
+++ b/plugins/scalajs/ScalaJsLib.scala
@@ -15,14 +15,13 @@ case class ScalaJsLib(
outputPath.getParentFile.mkdirs
val scalaJsCliDep = dep( "scalajs-cli_"++lib.libMajorVersion(scalaVersion) )
outputPath.getParentFile.mkdirs
- lib.runMain(
+ scalaJsCliDep.runMain(
"org.scalajs.cli.Scalajsld",
Seq(
"--sourceMap",
"--stdlib", s"${scalaJsLibraryDependency.jar.getAbsolutePath}",
"--output", outputPath.string
- ) ++ scalaJsOptions ++ entriesToLink.map(_.getAbsolutePath),
- scalaJsCliDep.classLoader
+ ) ++ scalaJsOptions ++ entriesToLink.map(_.getAbsolutePath)
)
}
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala
index c46e00c..01115d4 100644
--- a/stage1/Stage1Lib.scala
+++ b/stage1/Stage1Lib.scala
@@ -272,12 +272,11 @@ class Stage1Lib( logger: Logger ) extends BaseLib{
redirectOutToErr{
System.err.println("Compiling to " ++ compileTarget.toString)
try{
- lib.runMain(
+ zinc.runMain(
_class,
dualArgs ++ singleArgs ++ (
if(cp.isEmpty) Nil else Seq("-cp", cp)
- ) ++ sourceFiles.map(_.string),
- zinc.classLoader
+ ) ++ sourceFiles.map(_.string)
)
} catch {
case scala.util.control.NonFatal(e) =>
diff --git a/stage1/resolver.scala b/stage1/resolver.scala
index 86cf5ab..1304f76 100644
--- a/stage1/resolver.scala
+++ b/stage1/resolver.scala
@@ -79,7 +79,7 @@ trait DependencyImplementation extends Dependency{
}
*/
- def runMain( className: String, args: String* ) = lib.runMain( className, args, classLoader )
+ def runMain( className: String, args: Seq[String] ) = lib.runMain( className, args, classLoader )
def flatClassLoader: Boolean = false
@@ -88,7 +88,7 @@ trait DependencyImplementation extends Dependency{
def runClass: Option[String] = lib.runClass( mainClasses ).map( _.getName )
def run( args: String* ): ExitCode = {
- runClass.map( runMain( _, args: _* ) ).getOrElse{
+ runClass.map( runMain( _, args ) ).getOrElse{
// FIXME: this just doing nothing when class is not found has been repeatedly
// surprising. Let's try to make this more visible than just logging an error.
// Currently blocked on task `recursive` trying every subbuild and would error
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala
index 5f74c99..0d8017f 100644
--- a/stage2/BasicBuild.scala
+++ b/stage2/BasicBuild.scala
@@ -196,15 +196,14 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
}
val scalac = new ScalaCompilerDependency(context.cbtLastModified, context.paths.mavenCache, scalaVersion)
- lib.runMain(
+ scalac.runMain(
"scala.tools.nsc.MainGenericRunner",
Seq(
"-bootclasspath",
scalac.classpath.string,
"-classpath",
classpath.string
- ) ++ context.args ,
- scalac.classLoader
+ ) ++ context.args
)
}
diff --git a/stage2/Lib.scala b/stage2/Lib.scala
index db1ee6d..46668b7 100644
--- a/stage2/Lib.scala
+++ b/stage2/Lib.scala
@@ -76,10 +76,8 @@ final class Lib(val logger: Logger) extends Stage1Lib(logger){
) ++ compileArgs ++ sourceFiles.map(_.toString)
logger.lib("creating docs for source files "+args.mkString(", "))
redirectOutToErr{
- runMain(
- "scala.tools.nsc.ScalaDoc",
- args,
- new ScalaDependencies(cbtLastModified,mavenCache,scalaVersion).classLoader
+ new ScalaDependencies(cbtLastModified,mavenCache,scalaVersion).runMain(
+ "scala.tools.nsc.ScalaDoc", args
)
}
Some(scaladocTarget)
diff --git a/stage2/ToolsTasks.scala b/stage2/ToolsTasks.scala
index eb41dd0..15052ae 100644
--- a/stage2/ToolsTasks.scala
+++ b/stage2/ToolsTasks.scala
@@ -49,22 +49,22 @@ class ToolsTasks(
def amm = ammonite
def ammonite = {
val version = args.lift(1).getOrElse(constants.scalaVersion)
- val classLoader = Resolver(mavenCentral).bindOne(
+ val ammonite = Resolver(mavenCentral).bindOne(
MavenDependency(
"com.lihaoyi","ammonite-repl_2.11.8",args.lift(1).getOrElse("0.5.8")
)
- ).classLoader
+ )
// FIXME: this does not work quite yet, throws NoSuchFileException: /ammonite/repl/frontend/ReplBridge$.class
- lib.runMain(
- "ammonite.repl.Main", args.drop(2), classLoader
+ ammonite.runMain(
+ "ammonite.repl.Main", args.drop(2)
)
}
def scala = {
val version = args.lift(1).getOrElse(constants.scalaVersion)
val scalac = new ScalaCompilerDependency( cbtLastModified, mavenCache, version )
val _args = Seq("-cp", scalac.classpath.string) ++ args.drop(2)
- lib.runMain(
- "scala.tools.nsc.MainGenericRunner", _args, scalac.classLoader
+ scalac.runMain(
+ "scala.tools.nsc.MainGenericRunner", _args
)
}
def cbtEarlyDependencies = {
diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala
index 8ffcdb6..01ffa27 100644
--- a/stage2/plugins/Dotty.scala
+++ b/stage2/plugins/Dotty.scala
@@ -78,15 +78,14 @@ class DottyLib(
def repl(args: Seq[String], classpath: ClassPath) = {
consoleOrFail("Use `cbt direct repl` instead")
- lib.runMain(
+ dottyCompiler.runMain(
"dotty.tools.dotc.repl.Main",
Seq(
"-bootclasspath",
dottyCompiler.classpath.string,
"-classpath",
classpath.string
- ) ++ args,
- dottyCompiler.classLoader
+ ) ++ args
)
}
@@ -144,27 +143,24 @@ class DottyLib(
"-d", compileTarget.toString
)
val singleArgs = dottyOptions.map( "-S" ++ _ )
- val urls = dottyCompiler.classpath.strings.map("file://"+_).map(new java.net.URL(_))
- val cl = new java.net.URLClassLoader( urls.to )
val code =
try{
System.err.println("Compiling with Dotty to " ++ compileTarget.toString)
compileTarget.mkdirs
redirectOutToErr{
- lib.runMain(
+ dottyCompiler.runMain(
_class,
dualArgs ++ singleArgs ++ Seq(
"-bootclasspath", dottyCompiler.classpath.string
) ++ (
if(cp.isEmpty) Nil else Seq("-classpath", cp) // let's put cp last. It so long
- ) ++ sourceFiles.map(_.toString),
- cl
+ ) ++ sourceFiles.map(_.toString)
)
}
} catch {
case e: Exception =>
System.err.println(red("Dotty crashed. See https://github.com/lampepfl/dotty/issues. To reproduce run:"))
- System.err.println(cl)
+ System.err.println(dottyCompiler.classLoader)
System.out.println(s"""
java -cp \\
${dottyCompiler.classpath.strings.mkString(":\\\n")} \\
diff --git a/stage2/plugins/Frege.scala b/stage2/plugins/Frege.scala
index 3598d08..3fcd56b 100644
--- a/stage2/plugins/Frege.scala
+++ b/stage2/plugins/Frege.scala
@@ -88,10 +88,9 @@ class FregeLib(
System.err.println("Compiling with Frege to " ++ compileTarget.toString)
compileTarget.mkdirs
redirectOutToErr{
- lib.runMain(
+ fregeDependency.runMain(
_class,
- dualArgs ++ singleArgs ++ sourceFiles.map(_.toString),
- fregeDependency.classLoader
+ dualArgs ++ singleArgs ++ sourceFiles.map(_.toString)
)
}
} catch {