diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-26 22:11:04 +0800 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-27 18:44:52 +0800 |
commit | db054b4d44afdb938baa1f93b6e5d212f918af64 (patch) | |
tree | 5e026c677dcc0b31bb9010141cd5cec3a8ce1fe1 /plugins | |
parent | 3ab41fcbfc26f972b6e55f0c9f9b443cc699e0f1 (diff) | |
download | cbt-db054b4d44afdb938baa1f93b6e5d212f918af64.tar.gz cbt-db054b4d44afdb938baa1f93b6e5d212f918af64.tar.bz2 cbt-db054b4d44afdb938baa1f93b6e5d212f918af64.zip |
fix / cleanup scalajs plugin
- create target directory if not existent
- remove dead code wrt modes
- default path for generated .js file
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/scalajs/ScalaJsBuild.scala | 12 | ||||
-rw-r--r-- | plugins/scalajs/ScalaJsLib.scala | 19 |
2 files changed, 9 insertions, 22 deletions
diff --git a/plugins/scalajs/ScalaJsBuild.scala b/plugins/scalajs/ScalaJsBuild.scala index 0c7222c..1b61b6e 100644 --- a/plugins/scalajs/ScalaJsBuild.scala +++ b/plugins/scalajs/ScalaJsBuild.scala @@ -23,17 +23,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( |