diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-28 09:22:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-28 09:22:29 -0500 |
commit | 9f3c5f3a36ea70a8dec03b048cc41b6579eb6c4b (patch) | |
tree | 13ce0083a15f7289682dc2fd6bf5066d25ee52cd /plugins/scalajs | |
parent | fdb5d7cdb692ded3ccc1d865282169598d190c03 (diff) | |
parent | 03b066827b3d397fb30a689904fa8d55db43fc8e (diff) | |
download | cbt-9f3c5f3a36ea70a8dec03b048cc41b6579eb6c4b.tar.gz cbt-9f3c5f3a36ea70a8dec03b048cc41b6579eb6c4b.tar.bz2 cbt-9f3c5f3a36ea70a8dec03b048cc41b6579eb6c4b.zip |
Merge pull request #358 from cvogt/chris
various changes
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( |