summaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-11-16 03:40:58 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-16 03:42:08 -0800
commit28dbe29a2ab566249642e81405a953f33507828a (patch)
treef70dae7ddd6b741b040d585d85a135c58b920a96 /core/src/main
parentc2a3514c70ad357f73c0ed209966616e01f9d703 (diff)
downloadmill-28dbe29a2ab566249642e81405a953f33507828a.tar.gz
mill-28dbe29a2ab566249642e81405a953f33507828a.tar.bz2
mill-28dbe29a2ab566249642e81405a953f33507828a.zip
Vendor `com.lihaoyi:acyclic` codebase as a cross-building example, first non-working experiments in cross building working...
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/scala/mill/define/Cross.scala18
-rw-r--r--core/src/main/scala/mill/define/Task.scala2
2 files changed, 19 insertions, 1 deletions
diff --git a/core/src/main/scala/mill/define/Cross.scala b/core/src/main/scala/mill/define/Cross.scala
new file mode 100644
index 00000000..c84e9b3d
--- /dev/null
+++ b/core/src/main/scala/mill/define/Cross.scala
@@ -0,0 +1,18 @@
+package mill.define
+
+
+case class Cross[+T](items: T*){
+ def flatMap[V](f: T => Cross[V]): Cross[(T, V)] = {
+ val flattened = for{
+ i <- items
+ k <- f(i).items
+ } yield (i, k)
+ Cross(flattened:_*)
+ }
+ def map[V](f: T => V): Cross[(T, V)] = {
+ Cross(items.map(i => i -> f(i)):_*)
+ }
+ def withFilter(f: T => Boolean) = {
+ Cross(items.filter(f):_*)
+ }
+}
diff --git a/core/src/main/scala/mill/define/Task.scala b/core/src/main/scala/mill/define/Task.scala
index ea197039..0853b06b 100644
--- a/core/src/main/scala/mill/define/Task.scala
+++ b/core/src/main/scala/mill/define/Task.scala
@@ -50,7 +50,7 @@ object Task extends Applicative.Applyer[Task, Task, Args]{
def source(path: ammonite.ops.Path) = new Source(path)
- trait Cacher extends mill.define.Cacher[Task, Target]{
+ trait Module extends mill.define.Cacher[Task, Target]{
def wrapCached[T](t: Task[T], enclosing: String): Target[T] = new TargetImpl(t, enclosing)
}
class Task0[T](t: T) extends Task[T]{