diff options
author | Roman Timushev <rtimush@gmail.com> | 2017-12-29 22:23:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-29 22:23:57 +0100 |
commit | 81d4cfb6f63512b314fbbf49c4ba415aedc469d7 (patch) | |
tree | 384952c3be58592a9d54af40f4ce7edefed3eee5 /scalaplugin/src/main | |
parent | 19ecb2b4b9d6e91c6a765e7dbae79e3c1e968888 (diff) | |
parent | 417f2ea33202c4dd5d3732cb9fbc6a35f8b7b4ed (diff) | |
download | mill-81d4cfb6f63512b314fbbf49c4ba415aedc469d7.tar.gz mill-81d4cfb6f63512b314fbbf49c4ba415aedc469d7.tar.bz2 mill-81d4cfb6f63512b314fbbf49c4ba415aedc469d7.zip |
Merge pull request #67 from lihaoyi/scalajs
Scala.js support
Diffstat (limited to 'scalaplugin/src/main')
-rw-r--r-- | scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala | 4 | ||||
-rw-r--r-- | scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala | 31 |
2 files changed, 19 insertions, 16 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala b/scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala index 7dad791d..de1906ab 100644 --- a/scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala +++ b/scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala @@ -26,8 +26,8 @@ object ZincWorker extends Worker[ZincWorker]{ def make() = new ZincWorker } class ZincWorker{ - var scalaClassloaderCache = Option.empty[(Long, ClassLoader)] - var scalaInstanceCache = Option.empty[(Long, ScalaInstance)] + @volatile var scalaClassloaderCache = Option.empty[(Long, ClassLoader)] + @volatile var scalaInstanceCache = Option.empty[(Long, ScalaInstance)] } object Lib{ case class MockedLookup(am: File => Optional[CompileAnalysis]) extends PerClasspathEntryLookup { diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala index b1102234..13e91c2a 100644 --- a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala +++ b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala @@ -257,29 +257,32 @@ trait ScalaModule extends Module with TaskModule { outer => options = Seq("-usejavacp") ) } -} - -trait PublishModule extends ScalaModule { outer => - import mill.scalaplugin.publish._ - - def publishName: T[String] = basePath.last.toString - def publishVersion: T[String] = "0.0.1-SNAPSHOT" - def pomSettings: T[PomSettings] // publish artifact with name "mill_2.12.4" instead of "mill_2.12" - def publishWithFullScalaVersion: Boolean = false + def crossFullScalaVersion: T[Boolean] = false + def artifactName: T[String] = basePath.last.toString def artifactScalaVersion: T[String] = T { - if (publishWithFullScalaVersion) scalaVersion() + if (crossFullScalaVersion()) scalaVersion() else scalaBinaryVersion() } + def artifactId: T[String] = T { s"${artifactName()}_${artifactScalaVersion()}" } + +} + +trait PublishModule extends ScalaModule { outer => + import mill.scalaplugin.publish._ + + def pomSettings: T[PomSettings] + def publishVersion: T[String] = "0.0.1-SNAPSHOT" + def pom = T { val dependencies = ivyDeps().map(Artifact.fromDep(_, scalaVersion(), scalaBinaryVersion())) - val pom = Pom(artifact(), dependencies, publishName(), pomSettings()) + val pom = Pom(artifact(), dependencies, artifactName(), pomSettings()) - val pomPath = T.ctx().dest / s"${publishName()}_${artifactScalaVersion()}-${publishVersion()}.pom" + val pomPath = T.ctx().dest / s"${artifactId()}-${publishVersion()}.pom" write.over(pomPath, pom) PathRef(pomPath) } @@ -294,7 +297,7 @@ trait PublishModule extends ScalaModule { outer => } def artifact: T[Artifact] = T { - Artifact(pomSettings().organization, s"${publishName()}_${artifactScalaVersion()}", publishVersion()) + Artifact(pomSettings().organization, artifactId(), publishVersion()) } def publishLocal(): define.Command[Unit] = T.command { @@ -313,7 +316,7 @@ trait PublishModule extends ScalaModule { outer => def sonatypeSnapshotUri: String = "https://oss.sonatype.org/content/repositories/snapshots" def publish(credentials: String, gpgPassphrase: String): define.Command[Unit] = T.command { - val baseName = s"${publishName()}_${artifactScalaVersion()}-${publishVersion()}" + val baseName = s"${artifactId()}-${publishVersion()}" val artifacts = Seq( jar().path -> s"${baseName}.jar", sourcesJar().path -> s"${baseName}-sources.jar", |