summaryrefslogtreecommitdiff
path: root/core/src/main/scala
diff options
context:
space:
mode:
authorrockjam <5min4eq.unity@gmail.com>2017-12-10 23:33:46 +0300
committerNikolay Tatarinov <5min4eq.unity@gmail.com>2017-12-20 01:17:16 +0300
commit9d19d740c5b387704e08fb89412b8318549a4fc5 (patch)
tree203c7ede2212c916195a82c2cf6578e9c755de7b /core/src/main/scala
parent6a7f6cf910362cadf6b39f8c0795c46745e08742 (diff)
downloadmill-9d19d740c5b387704e08fb89412b8318549a4fc5.tar.gz
mill-9d19d740c5b387704e08fb89412b8318549a4fc5.tar.bz2
mill-9d19d740c5b387704e08fb89412b8318549a4fc5.zip
Add Sonatypype publishing;
now you can publish your module with `mill run MyModule.publish --credentials $SONATYPE_CREDENTIALS --gpgPassphrase $GPG_PASSPHRASE`
Diffstat (limited to 'core/src/main/scala')
-rw-r--r--core/src/main/scala/mill/define/Applicative.scala4
-rw-r--r--core/src/main/scala/mill/define/Task.scala4
-rw-r--r--core/src/main/scala/mill/modules/Jvm.scala10
-rw-r--r--core/src/main/scala/mill/util/Ctx.scala5
4 files changed, 17 insertions, 6 deletions
diff --git a/core/src/main/scala/mill/define/Applicative.scala b/core/src/main/scala/mill/define/Applicative.scala
index 32806643..ddbcccdc 100644
--- a/core/src/main/scala/mill/define/Applicative.scala
+++ b/core/src/main/scala/mill/define/Applicative.scala
@@ -53,6 +53,9 @@ object Applicative {
def zipMap[A, B, C, D, E, F, G, H, I, J, R](a: T[A], b: T[B], c: T[C], d: T[D], e: T[E], f: T[F], g: T[G], h: T[H], i: T[I], j: T[J])
(cb: (A, B, C, D, E, F, G, H, I, J, Ctx) => Z[R]) = mapCtx(zip(a, b, c, d, e, f, g, h, i, j)){case ((a, b, c, d, e, f, g, h, i, j), x) => cb(a, b, c, d, e, f, g, h, i, j, x)}
+ def zipMap[A, B, C, D, E, F, G, H, I, J, K, R](a: T[A], b: T[B], c: T[C], d: T[D], e: T[E], f: T[F], g: T[G], h: T[H], i: T[I], j: T[J], k: T[K])
+ (cb: (A, B, C, D, E, F, G, H, I, J, K, Ctx) => Z[R]) = mapCtx(zip(a, b, c, d, e, f, g, h, i, j, k)){case ((a, b, c, d, e, f, g, h, i, j, k), x) => cb(a, b, c, d, e, f, g, h, i, j, k, x)}
+
def zip(): T[Unit]
def zip[A](a: T[A]): T[Tuple1[A]]
def zip[A, B](a: T[A], b: T[B]): T[(A, B)]
@@ -64,6 +67,7 @@ object Applicative {
def zip[A, B, C, D, E, F, G, H](a: T[A], b: T[B], c: T[C], d: T[D], e: T[E], f: T[F], g: T[G], h: T[H]): T[(A, B, C, D, E, F, G, H)]
def zip[A, B, C, D, E, F, G, H, I](a: T[A], b: T[B], c: T[C], d: T[D], e: T[E], f: T[F], g: T[G], h: T[H], i: T[I]): T[(A, B, C, D, E, F, G, H, I)]
def zip[A, B, C, D, E, F, G, H, I, J](a: T[A], b: T[B], c: T[C], d: T[D], e: T[E], f: T[F], g: T[G], h: T[H], i: T[I], j: T[J]): T[(A, B, C, D, E, F, G, H, I, J)]
+ def zip[A, B, C, D, E, F, G, H, I, J, K](a: T[A], b: T[B], c: T[C], d: T[D], e: T[E], f: T[F], g: T[G], h: T[H], i: T[I], j: T[J], k: T[K]): T[(A, B, C, D, E, F, G, H, I, J, K)]
}
diff --git a/core/src/main/scala/mill/define/Task.scala b/core/src/main/scala/mill/define/Task.scala
index 59782f3d..17392725 100644
--- a/core/src/main/scala/mill/define/Task.scala
+++ b/core/src/main/scala/mill/define/Task.scala
@@ -125,6 +125,10 @@ object Target extends Applicative.Applyer[Task, Task, Result, Ctx]{
val inputs = Seq(a, b, c, d, e, f, g, h, i, j)
def evaluate(args: Ctx) = (args[A](0), args[B](1), args[C](2), args[D](3), args[E](4), args[F](5), args[G](6), args[H](7), args[I](8), args[J](9))
}
+ def zip[A, B, C, D, E, F, G, H, I, J, K](a: Task[A], b: Task[B], c: Task[C], d: Task[D], e: Task[E], f: Task[F], g: Task[G], h: Task[H], i: Task[I], j: Task[J], k: Task[K]) = new Task[(A, B, C, D, E, F, G, H, I, J, K)]{
+ val inputs = Seq(a, b, c, d, e, f, g, h, i, j, k)
+ def evaluate(args: Ctx) = (args[A](0), args[B](1), args[C](2), args[D](3), args[E](4), args[F](5), args[G](6), args[H](7), args[I](8), args[J](9), args[K](10))
+ }
}
class TargetImpl[+T](t: Task[T], enclosing: String) extends Target[T] {
val inputs = Seq(t)
diff --git a/core/src/main/scala/mill/modules/Jvm.scala b/core/src/main/scala/mill/modules/Jvm.scala
index ae13ccb2..f366a0e0 100644
--- a/core/src/main/scala/mill/modules/Jvm.scala
+++ b/core/src/main/scala/mill/modules/Jvm.scala
@@ -92,9 +92,9 @@ object Jvm {
m
}
- // TODO: outputPath default to ctx.dest
- def createJar(outputPath: Path, inputPaths: Seq[Path], mainClass: Option[String] = None)
+ def createJar(inputPaths: Seq[Path], mainClass: Option[String] = None)
(implicit ctx: Ctx.DestCtx): PathRef = {
+ val outputPath = ctx.dest
rm(outputPath)
if(inputPaths.nonEmpty) {
mkdir(outputPath/up)
@@ -126,13 +126,11 @@ object Jvm {
PathRef(outputPath)
}
-
- // TODO: outputPath default to ctx.dest
- def createAssembly(outputPath: Path,
- inputPaths: Seq[Path],
+ def createAssembly(inputPaths: Seq[Path],
mainClass: Option[String] = None,
prependShellScript: String = "")
(implicit ctx: Ctx.DestCtx): PathRef = {
+ val outputPath = ctx.dest
rm(outputPath)
if(inputPaths.nonEmpty) {
diff --git a/core/src/main/scala/mill/util/Ctx.scala b/core/src/main/scala/mill/util/Ctx.scala
index 38a8aee3..6549531f 100644
--- a/core/src/main/scala/mill/util/Ctx.scala
+++ b/core/src/main/scala/mill/util/Ctx.scala
@@ -5,12 +5,17 @@ import mill.define.Applicative.ImplicitStub
import mill.util.Ctx.{ArgCtx, DestCtx, LoaderCtx, LogCtx}
import scala.annotation.compileTimeOnly
+import scala.language.implicitConversions
object Ctx{
@compileTimeOnly("Target.ctx() can only be used with a T{...} block")
@ImplicitStub
implicit def taskCtx: Ctx = ???
+ object DestCtx {
+ implicit def pathToCtx(path: Path): DestCtx =
+ new DestCtx { def dest: Path = path }
+ }
trait DestCtx{
def dest: Path
}