summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Tatarinov <5min4eq.unity@gmail.com>2017-12-25 05:31:40 +0300
committerLi Haoyi <haoyi.sg@gmail.com>2017-12-24 18:31:40 -0800
commit048fe23d116793039e7d245edd4afdcc3bdd3cc2 (patch)
treec688d23775e3828e1645e1fc42df5b701070a832
parenta0d16d40156f639090235f67117fe11ce0dbb5e9 (diff)
downloadmill-048fe23d116793039e7d245edd4afdcc3bdd3cc2.tar.gz
mill-048fe23d116793039e7d245edd4afdcc3bdd3cc2.tar.bz2
mill-048fe23d116793039e7d245edd4afdcc3bdd3cc2.zip
prepare mill-bridges to be published to maven central (#78)
-rwxr-xr-xbuild.sc26
-rw-r--r--scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala2
-rw-r--r--scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala11
3 files changed, 24 insertions, 15 deletions
diff --git a/build.sc b/build.sc
index 9ed794ac..cf792507 100755
--- a/build.sc
+++ b/build.sc
@@ -5,8 +5,6 @@ import mill.scalaplugin._, publish._
import mill.modules.Jvm.createAssembly
trait MillPublishModule extends PublishModule {
- def publishVersion = "0.0.1"
-
def publishWithFullScalaVersion = true
def pomSettings = PomSettings(
@@ -54,11 +52,9 @@ trait MillModule extends SbtScalaModule{ outer =>
}
}
-object Core extends MillModule with MillPublishModule {
+object Core extends MillModule {
def projectDeps = Seq(CompilerPlugin)
- def publishName = "mill-core"
-
def compileIvyDeps = Seq(
Dep.Java("org.scala-lang", "scala-reflect", scalaVersion())
)
@@ -92,9 +88,17 @@ object Core extends MillModule with MillPublishModule {
val bridgeVersions = Seq("2.10.6", "2.11.8", "2.11.11", "2.12.3", "2.12.4")
-val bridges = for(crossVersion <- mill.define.Cross(bridgeVersions:_*)) yield new ScalaModule{
+val bridges = for(crossVersion <- mill.define.Cross(bridgeVersions:_*)) yield new MillPublishModule {
+ def publishName = "mill-bridge"
+ def publishVersion = "0.1"
+
def basePath = pwd / 'bridge
def scalaVersion = crossVersion
+ def sources = T.source {
+ val path = basePath / 'src
+ mkdir(path)
+ path
+ }
def allSources = T{
val v = crossVersion.split('.').dropRight(1).mkString(".")
@@ -117,9 +121,7 @@ val bridges = for(crossVersion <- mill.define.Cross(bridgeVersions:_*)) yield ne
)
}
-object ScalaPlugin extends MillModule with MillPublishModule {
- def publishName = "mill-scala"
-
+object ScalaPlugin extends MillModule {
def projectDeps = Seq(Core)
def basePath = pwd / 'scalaplugin
@@ -141,6 +143,10 @@ val assemblyProjects = Seq(ScalaPlugin)
def assemblyClasspath = mill.define.Task.traverse(assemblyProjects)(_.assemblyClasspath)
+def publishBridges(credentials: String, gpgPassphrase: String) = T.command {
+ mill.define.Task.traverse(bridges.items)(_._2.publish(credentials, gpgPassphrase))
+}
+
def assemblyBase(classpath: Seq[Path], extraArgs: String)
(implicit ctx: mill.util.Ctx.DestCtx) = {
createAssembly(
@@ -151,7 +157,7 @@ def assemblyBase(classpath: Seq[Path], extraArgs: String)
)
}
-def assembly = T{
+def devAssembly = T{
assemblyBase(assemblyClasspath().flatten, ScalaPlugin.testArgs().mkString(" "))
}
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala b/scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala
index c89254b0..b314454c 100644
--- a/scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala
+++ b/scalaplugin/src/main/scala/mill/scalaplugin/Lib.scala
@@ -204,7 +204,7 @@ object Lib{
Dep.Java("org.scala-lang", "scala-library", scalaVersion)
)
def compilerBridgeIvyDep(scalaVersion: String) =
- Dep.Point(coursier.Dependency(coursier.Module("com.lihaoyi", "mill-bridge"), "0.1-SNAPSHOT", transitive = false))
+ Dep.Point(coursier.Dependency(coursier.Module("com.lihaoyi", "mill-bridge"), "0.1", transitive = false))
val DefaultShellScript: Seq[String] = Seq(
"#!/usr/bin/env sh",
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
index 949682ca..49720863 100644
--- a/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
+++ b/scalaplugin/src/main/scala/mill/scalaplugin/ScalaModule.scala
@@ -143,10 +143,13 @@ trait ScalaModule extends Module with TaskModule { outer =>
Seq(dep)
)
classpath match {
- case Result.Success(Seq(single)) => PathRef(single.path, quick = true)
- case Result.Success(Seq()) => throw new Exception(dep + " resolution failed")
- case f: Result.Failure => throw new Exception(dep + s" resolution failed.\n + ${f.msg}")
- case _ => throw new Exception(dep + " resolution resulted in more than one file")
+ case Result.Success(resolved) =>
+ resolved.filterNot(_.path.ext == "pom") match {
+ case Seq(single) => PathRef(single.path, quick = true)
+ case Seq() => throw new Exception(dep + " resolution failed") // TODO: find out, is it possible?
+ case _ => throw new Exception(dep + " resolution resulted in more than one file")
+ }
+ case f: Result.Failure => throw new Exception(dep + s" resolution failed.\n + ${f.msg}") // TODO: remove, resolveDependencies will take care of this.
}
}
}