diff options
Diffstat (limited to 'plugins/scalajs')
-rw-r--r-- | plugins/scalajs/ScalaJsBuild.scala | 13 | ||||
-rw-r--r-- | plugins/scalajs/ScalaJsLib.scala | 19 |
2 files changed, 10 insertions, 22 deletions
diff --git a/plugins/scalajs/ScalaJsBuild.scala b/plugins/scalajs/ScalaJsBuild.scala index 0c7222c..b6df9e9 100644 --- a/plugins/scalajs/ScalaJsBuild.scala +++ b/plugins/scalajs/ScalaJsBuild.scala @@ -2,6 +2,7 @@ package cbt import java.io.File import java.net.URL +// TODO: maybe move this into stage2 to avoid having to call zinc separately for this as a plugin trait ScalaJsBuild extends DynamicOverrides{ final protected val scalaJsLib = ScalaJsLib( scalaJsVersion, scalaVersion, context.cbtLastModified, context.paths.mavenCache @@ -23,17 +24,17 @@ trait ScalaJsBuild extends DynamicOverrides{ } override def compile = { - super.compile - scalaJsLib.link( - scalaJsTargetFile, scalaJsOptions, target +: dependencies.collect{case d: BoundMavenDependency => d.jar} - ) - None // FIXME: we need to rethink the concept of a "compile" task I think. There is no time to return here. + val res = super.compile + scalaJsLib.link( scalaJsTargetFile, scalaJsOptions, target +: dependencyClasspath.files ) + res + // FIXME: we need to rethink the concept of a "compile" task I think. + // An exit code would probably be more appropriate here. } def scalaJsOptions: Seq[String] = Seq() /** Where to put the generated js file */ - def scalaJsTargetFile: File + def scalaJsTargetFile: File = target / "app.js" override def cleanFiles = super.cleanFiles :+ scalaJsTargetFile :+ (scalaJsTargetFile ++ ".map") diff --git a/plugins/scalajs/ScalaJsLib.scala b/plugins/scalajs/ScalaJsLib.scala index ae37bde..7886478 100644 --- a/plugins/scalajs/ScalaJsLib.scala +++ b/plugins/scalajs/ScalaJsLib.scala @@ -4,28 +4,15 @@ import java.io.File case class ScalaJsLib( scalaJsVersion: String, scalaVersion: String, cbtLastModified: Long, mavenCache: File )(implicit logger: Logger, transientCache: java.util.Map[AnyRef,AnyRef], classLoaderCache: ClassLoaderCache){ - sealed trait ScalaJsOutputMode { - def option: String - def fileSuffix: String - } - case object FastOptJS extends ScalaJsOutputMode{ - override val option = "--fastOpt" - override val fileSuffix = "fastopt" - } - case object FullOptJS extends ScalaJsOutputMode{ - override val option = "--fullOpt" - override val fileSuffix = "fullopt" - } - val lib = new Lib(logger) def dep(artifactId: String) = MavenResolver( cbtLastModified, mavenCache, mavenCentral ).bindOne( MavenDependency("org.scala-js", artifactId, scalaJsVersion) ) def link( - outputPath: File, - scalaJsOptions: Seq[String], entriesToLink: Seq[File] - ) = { + outputPath: File, scalaJsOptions: Seq[String], entriesToLink: Seq[File] + ): ExitCode = { + outputPath.getParentFile.mkdirs val scalaJsCliDep = dep( "scalajs-cli_"++lib.libMajorVersion(scalaVersion) ) outputPath.getParentFile.mkdirs lib.runMain( |