diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/api/src/mill/api/KeyedLockedCache.scala | 44 | ||||
-rw-r--r-- | main/client/src/InputPumper.java (renamed from main/client/src/mill/main/client/InputPumper.java) | 0 | ||||
-rw-r--r-- | main/client/src/Lock.java (renamed from main/client/src/mill/main/client/Lock.java) | 0 | ||||
-rw-r--r-- | main/client/src/Locked.java (renamed from main/client/src/mill/main/client/Locked.java) | 0 | ||||
-rw-r--r-- | main/client/src/Locks.java (renamed from main/client/src/mill/main/client/Locks.java) | 0 | ||||
-rw-r--r-- | main/client/src/MillClientMain.java (renamed from main/client/src/mill/main/client/MillClientMain.java) | 0 | ||||
-rw-r--r-- | main/client/src/ProxyOutputStream.java (renamed from main/client/src/mill/main/client/ProxyOutputStream.java) | 0 | ||||
-rw-r--r-- | main/client/src/ProxyStreamPumper.java (renamed from main/client/src/mill/main/client/ProxyStreamPumper.java) | 0 | ||||
-rw-r--r-- | main/client/src/Util.java (renamed from main/client/src/mill/main/client/Util.java) | 0 | ||||
-rw-r--r-- | main/client/test/src/ClientTests.java (renamed from main/client/test/src/mill/main/client/ClientTests.java) | 0 | ||||
-rw-r--r-- | main/core/src/define/Applicative.scala (renamed from main/core/src/mill/define/Applicative.scala) | 0 | ||||
-rw-r--r-- | main/core/src/define/BaseModule.scala (renamed from main/core/src/mill/define/BaseModule.scala) | 0 | ||||
-rw-r--r-- | main/core/src/define/Caller.scala (renamed from main/core/src/mill/define/Caller.scala) | 0 | ||||
-rw-r--r-- | main/core/src/define/Cross.scala (renamed from main/core/src/mill/define/Cross.scala) | 0 | ||||
-rw-r--r-- | main/core/src/define/Ctx.scala (renamed from main/core/src/mill/define/Ctx.scala) | 0 | ||||
-rw-r--r-- | main/core/src/define/Discover.scala (renamed from main/core/src/mill/define/Discover.scala) | 7 | ||||
-rw-r--r-- | main/core/src/define/Graph.scala (renamed from main/core/src/mill/define/Graph.scala) | 2 | ||||
-rw-r--r-- | main/core/src/define/Module.scala (renamed from main/core/src/mill/define/Module.scala) | 0 | ||||
-rw-r--r-- | main/core/src/define/Task.scala (renamed from main/core/src/mill/define/Task.scala) | 0 | ||||
-rw-r--r-- | main/core/src/eval/Evaluator.scala (renamed from main/core/src/mill/eval/Evaluator.scala) | 2 | ||||
-rw-r--r-- | main/core/src/eval/Tarjans.scala (renamed from main/core/src/mill/eval/Tarjans.scala) | 0 | ||||
-rw-r--r-- | main/core/src/eval/package.scala (renamed from main/core/src/mill/eval/package.scala) | 0 | ||||
-rw-r--r-- | main/core/src/mill/util/AggWrapper.scala | 119 | ||||
-rw-r--r-- | main/core/src/util/EitherOps.scala (renamed from main/core/src/mill/util/EitherOps.scala) | 0 | ||||
-rw-r--r-- | main/core/src/util/EnclosingClass.scala (renamed from main/core/src/mill/util/EnclosingClass.scala) | 0 | ||||
-rw-r--r-- | main/core/src/util/JsonFormatters.scala (renamed from main/core/src/mill/util/JsonFormatters.scala) | 0 | ||||
-rw-r--r-- | main/core/src/util/Loggers.scala (renamed from main/core/src/mill/util/Loggers.scala) | 0 | ||||
-rw-r--r-- | main/core/src/util/MultiBiMap.scala (renamed from main/core/src/mill/util/MultiBiMap.scala) | 2 | ||||
-rw-r--r-- | main/core/src/util/ParseArgs.scala (renamed from main/core/src/mill/util/ParseArgs.scala) | 0 | ||||
-rw-r--r-- | main/core/src/util/Router.scala (renamed from main/core/src/mill/util/Router.scala) | 0 | ||||
-rw-r--r-- | main/core/src/util/Scripts.scala (renamed from main/core/src/mill/util/Scripts.scala) | 0 | ||||
-rw-r--r-- | main/core/src/util/Watched.scala (renamed from main/core/src/mill/util/Watched.scala) | 0 | ||||
-rw-r--r-- | main/core/src/util/package.scala (renamed from main/core/src/mill/util/package.scala) | 0 | ||||
-rw-r--r-- | main/graphviz/src/GraphvizTools.scala (renamed from main/graphviz/src/mill/main/graphviz/GraphvizTools.scala) | 0 | ||||
-rw-r--r-- | main/moduledefs/src/AutoOverridePlugin.scala (renamed from main/moduledefs/src/mill/moduledefs/AutoOverridePlugin.scala) | 0 | ||||
-rw-r--r-- | main/moduledefs/src/Cacher.scala (renamed from main/moduledefs/src/mill/moduledefs/Cacher.scala) | 0 | ||||
-rw-r--r-- | main/moduledefs/src/Scaladoc.java (renamed from main/moduledefs/src/mill/moduledefs/Scaladoc.java) | 0 | ||||
-rw-r--r-- | main/src/MillMain.scala (renamed from main/src/mill/MillMain.scala) | 0 | ||||
-rw-r--r-- | main/src/main/MainModule.scala (renamed from main/src/mill/main/MainModule.scala) | 4 | ||||
-rw-r--r-- | main/src/main/MainRunner.scala (renamed from main/src/mill/main/MainRunner.scala) | 0 | ||||
-rw-r--r-- | main/src/main/MainScopts.scala (renamed from main/src/mill/main/MainScopts.scala) | 0 | ||||
-rw-r--r-- | main/src/main/MillServerMain.scala (renamed from main/src/mill/main/MillServerMain.scala) | 0 | ||||
-rw-r--r-- | main/src/main/ReplApplyHandler.scala (renamed from main/src/mill/main/ReplApplyHandler.scala) | 2 | ||||
-rw-r--r-- | main/src/main/Resolve.scala (renamed from main/src/mill/main/Resolve.scala) | 0 | ||||
-rw-r--r-- | main/src/main/RunScript.scala (renamed from main/src/mill/main/RunScript.scala) | 2 | ||||
-rw-r--r-- | main/src/main/VisualizeModule.scala (renamed from main/src/mill/main/VisualizeModule.scala) | 0 | ||||
-rw-r--r-- | main/src/modules/Assembly.scala (renamed from main/src/mill/modules/Assembly.scala) | 0 | ||||
-rw-r--r-- | main/src/modules/Jvm.scala (renamed from main/src/mill/modules/Jvm.scala) | 2 | ||||
-rw-r--r-- | main/src/modules/Util.scala (renamed from main/src/mill/modules/Util.scala) | 5 | ||||
-rw-r--r-- | main/src/package.scala (renamed from main/src/mill/package.scala) | 4 | ||||
-rw-r--r-- | main/test/resources/examples/javac/build.sc | 2 | ||||
-rw-r--r-- | main/test/src/TestMain.scala (renamed from main/test/src/mill/TestMain.scala) | 0 | ||||
-rw-r--r-- | main/test/src/UTestFramework.scala (renamed from main/test/src/mill/UTestFramework.scala) | 0 | ||||
-rw-r--r-- | main/test/src/define/ApplicativeTests.scala (renamed from main/test/src/mill/define/ApplicativeTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/define/BasePathTests.scala (renamed from main/test/src/mill/define/BasePathTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/define/CacherTests.scala (renamed from main/test/src/mill/define/CacherTests.scala) | 2 | ||||
-rw-r--r-- | main/test/src/define/DiscoverTests.scala (renamed from main/test/src/mill/define/DiscoverTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/define/GraphTests.scala (renamed from main/test/src/mill/define/GraphTests.scala) | 2 | ||||
-rw-r--r-- | main/test/src/define/MacroErrorTests.scala (renamed from main/test/src/mill/define/MacroErrorTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/eval/CrossTests.scala (renamed from main/test/src/mill/eval/CrossTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/eval/EvaluationTests.scala (renamed from main/test/src/mill/eval/EvaluationTests.scala) | 2 | ||||
-rw-r--r-- | main/test/src/eval/FailureTests.scala (renamed from main/test/src/mill/eval/FailureTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/eval/JavaCompileJarTests.scala (renamed from main/test/src/mill/eval/JavaCompileJarTests.scala) | 7 | ||||
-rw-r--r-- | main/test/src/eval/ModuleTests.scala (renamed from main/test/src/mill/eval/ModuleTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/eval/TarjanTests.scala (renamed from main/test/src/mill/eval/TarjanTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/eval/TaskTests.scala (renamed from main/test/src/mill/eval/TaskTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/main/ClientServerTests.scala (renamed from main/test/src/mill/main/ClientServerTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/main/ForeignBuildsTest.scala (renamed from main/test/src/mill/main/ForeignBuildsTest.scala) | 0 | ||||
-rw-r--r-- | main/test/src/main/ForeignConflictTest.scala (renamed from main/test/src/mill/main/ForeignConflictTest.scala) | 0 | ||||
-rw-r--r-- | main/test/src/main/JavaCompileJarTests.scala (renamed from main/test/src/mill/main/JavaCompileJarTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/main/MainTests.scala (renamed from main/test/src/mill/main/MainTests.scala) | 0 | ||||
-rw-r--r-- | main/test/src/util/ParseArgsTest.scala (renamed from main/test/src/mill/util/ParseArgsTest.scala) | 0 | ||||
-rw-r--r-- | main/test/src/util/ScriptTestSuite.scala (renamed from main/test/src/mill/util/ScriptTestSuite.scala) | 0 | ||||
-rw-r--r-- | main/test/src/util/TestEvaluator.scala (renamed from main/test/src/mill/util/TestEvaluator.scala) | 2 | ||||
-rw-r--r-- | main/test/src/util/TestGraphs.scala (renamed from main/test/src/mill/util/TestGraphs.scala) | 0 | ||||
-rw-r--r-- | main/test/src/util/TestUtil.scala (renamed from main/test/src/mill/util/TestUtil.scala) | 2 |
76 files changed, 74 insertions, 140 deletions
diff --git a/main/api/src/mill/api/KeyedLockedCache.scala b/main/api/src/mill/api/KeyedLockedCache.scala new file mode 100644 index 00000000..47fdd888 --- /dev/null +++ b/main/api/src/mill/api/KeyedLockedCache.scala @@ -0,0 +1,44 @@ +package mill.api + +/** + * A combination lock & cache; users provide a key, value-factory, and a + * body function to be called with the value. [[KeyedLockedCache]] ensures that + * the body function is called with the computed/cached value sequentially. + */ +trait KeyedLockedCache[T]{ + def withCachedValue[V](key: Long)(f: => T)(f2: T => V): V +} + +object KeyedLockedCache{ + class RandomBoundedCache[T](hotParallelism: Int, coldCacheSize: Int) extends KeyedLockedCache[T]{ + private[this] val random = new scala.util.Random(313373) + val available = new java.util.concurrent.Semaphore(hotParallelism) + + // Awful asymptotic complexity, but our caches are tiny n < 10 so it doesn't matter + var cache = Array.fill[Option[(Long, T)]](coldCacheSize)(None) + + def withCachedValue[V](key: Long)(f: => T)(f2: T => V): V = { + available.acquire() + val pickedValue = synchronized{ + cache.indexWhere(_.exists(_._1 == key)) match { + case -1 => f + case i => + val (k, v) = cache(i).get + cache(i) = None + v + } + } + val result = f2(pickedValue) + synchronized{ + cache.indexWhere(_.isEmpty) match{ + // Random eviction #YOLO + case -1 => cache(random.nextInt(cache.length)) = Some((key, pickedValue)) + case i => cache(i) = Some((key, pickedValue)) + } + } + + available.release() + result + } + } +} diff --git a/main/client/src/mill/main/client/InputPumper.java b/main/client/src/InputPumper.java index 5205be0b..5205be0b 100644 --- a/main/client/src/mill/main/client/InputPumper.java +++ b/main/client/src/InputPumper.java diff --git a/main/client/src/mill/main/client/Lock.java b/main/client/src/Lock.java index 6e5f18b0..6e5f18b0 100644 --- a/main/client/src/mill/main/client/Lock.java +++ b/main/client/src/Lock.java diff --git a/main/client/src/mill/main/client/Locked.java b/main/client/src/Locked.java index e6ad3d63..e6ad3d63 100644 --- a/main/client/src/mill/main/client/Locked.java +++ b/main/client/src/Locked.java diff --git a/main/client/src/mill/main/client/Locks.java b/main/client/src/Locks.java index 64259293..64259293 100644 --- a/main/client/src/mill/main/client/Locks.java +++ b/main/client/src/Locks.java diff --git a/main/client/src/mill/main/client/MillClientMain.java b/main/client/src/MillClientMain.java index 3857caff..3857caff 100644 --- a/main/client/src/mill/main/client/MillClientMain.java +++ b/main/client/src/MillClientMain.java diff --git a/main/client/src/mill/main/client/ProxyOutputStream.java b/main/client/src/ProxyOutputStream.java index 339e0150..339e0150 100644 --- a/main/client/src/mill/main/client/ProxyOutputStream.java +++ b/main/client/src/ProxyOutputStream.java diff --git a/main/client/src/mill/main/client/ProxyStreamPumper.java b/main/client/src/ProxyStreamPumper.java index 977323f3..977323f3 100644 --- a/main/client/src/mill/main/client/ProxyStreamPumper.java +++ b/main/client/src/ProxyStreamPumper.java diff --git a/main/client/src/mill/main/client/Util.java b/main/client/src/Util.java index 54361734..54361734 100644 --- a/main/client/src/mill/main/client/Util.java +++ b/main/client/src/Util.java diff --git a/main/client/test/src/mill/main/client/ClientTests.java b/main/client/test/src/ClientTests.java index f3fcf154..f3fcf154 100644 --- a/main/client/test/src/mill/main/client/ClientTests.java +++ b/main/client/test/src/ClientTests.java diff --git a/main/core/src/mill/define/Applicative.scala b/main/core/src/define/Applicative.scala index 5e63b1cc..5e63b1cc 100644 --- a/main/core/src/mill/define/Applicative.scala +++ b/main/core/src/define/Applicative.scala diff --git a/main/core/src/mill/define/BaseModule.scala b/main/core/src/define/BaseModule.scala index cd79f73e..cd79f73e 100644 --- a/main/core/src/mill/define/BaseModule.scala +++ b/main/core/src/define/BaseModule.scala diff --git a/main/core/src/mill/define/Caller.scala b/main/core/src/define/Caller.scala index 6d2d4d1d..6d2d4d1d 100644 --- a/main/core/src/mill/define/Caller.scala +++ b/main/core/src/define/Caller.scala diff --git a/main/core/src/mill/define/Cross.scala b/main/core/src/define/Cross.scala index aa730e0d..aa730e0d 100644 --- a/main/core/src/mill/define/Cross.scala +++ b/main/core/src/define/Cross.scala diff --git a/main/core/src/mill/define/Ctx.scala b/main/core/src/define/Ctx.scala index c21e53b4..c21e53b4 100644 --- a/main/core/src/mill/define/Ctx.scala +++ b/main/core/src/define/Ctx.scala diff --git a/main/core/src/mill/define/Discover.scala b/main/core/src/define/Discover.scala index f0c668e6..c7dab54c 100644 --- a/main/core/src/mill/define/Discover.scala +++ b/main/core/src/define/Discover.scala @@ -79,9 +79,12 @@ object Discover { } if overridesRoutes.nonEmpty } yield { + // by wrapping the `overridesRoutes` in a lambda function we kind of work around + // the problem of generating a *huge* macro method body that finally exceeds the + // JVM's maximum allowed method size + val overridesLambda = q"(() => $overridesRoutes)()" val lhs = q"classOf[${discoveredModuleType.typeSymbol.asClass}]" - val rhs = q"scala.Seq[(Int, mill.util.Router.EntryPoint[_])](..$overridesRoutes)" - q"$lhs -> $rhs" + q"$lhs -> $overridesLambda" } c.Expr[Discover[T]](q"mill.define.Discover(scala.collection.immutable.Map(..$mapping))") diff --git a/main/core/src/mill/define/Graph.scala b/main/core/src/define/Graph.scala index 3119f2fb..5b29bd7b 100644 --- a/main/core/src/mill/define/Graph.scala +++ b/main/core/src/define/Graph.scala @@ -2,7 +2,7 @@ package mill.define import mill.eval.Tarjans import mill.util.MultiBiMap -import mill.util.Strict.Agg +import mill.api.Strict.Agg object Graph { diff --git a/main/core/src/mill/define/Module.scala b/main/core/src/define/Module.scala index a8fc5be7..a8fc5be7 100644 --- a/main/core/src/mill/define/Module.scala +++ b/main/core/src/define/Module.scala diff --git a/main/core/src/mill/define/Task.scala b/main/core/src/define/Task.scala index a464bf18..a464bf18 100644 --- a/main/core/src/mill/define/Task.scala +++ b/main/core/src/define/Task.scala diff --git a/main/core/src/mill/eval/Evaluator.scala b/main/core/src/eval/Evaluator.scala index 8709064e..dbaf9433 100644 --- a/main/core/src/mill/eval/Evaluator.scala +++ b/main/core/src/eval/Evaluator.scala @@ -10,7 +10,7 @@ import mill.define.{Ctx => _, _} import mill.api.Result.OuterStack import mill.util import mill.util._ -import mill.util.Strict.Agg +import mill.api.Strict.Agg import scala.collection.mutable import scala.util.control.NonFatal diff --git a/main/core/src/mill/eval/Tarjans.scala b/main/core/src/eval/Tarjans.scala index ade335a9..ade335a9 100644 --- a/main/core/src/mill/eval/Tarjans.scala +++ b/main/core/src/eval/Tarjans.scala diff --git a/main/core/src/mill/eval/package.scala b/main/core/src/eval/package.scala index 433f9074..433f9074 100644 --- a/main/core/src/mill/eval/package.scala +++ b/main/core/src/eval/package.scala diff --git a/main/core/src/mill/util/AggWrapper.scala b/main/core/src/mill/util/AggWrapper.scala deleted file mode 100644 index 6c107875..00000000 --- a/main/core/src/mill/util/AggWrapper.scala +++ /dev/null @@ -1,119 +0,0 @@ -package mill.util - - - -import scala.collection.mutable -object Strict extends AggWrapper(true) -object Loose extends AggWrapper(false) -sealed class AggWrapper(strictUniqueness: Boolean){ - /** - * A collection with enforced uniqueness, fast contains and deterministic - * ordering. Raises an exception if a duplicate is found; call - * `toSeq.distinct` if you explicitly want to make it swallow duplicates - */ - trait Agg[V] extends TraversableOnce[V]{ - def contains(v: V): Boolean - def items: Iterator[V] - def indexed: IndexedSeq[V] - def flatMap[T](f: V => TraversableOnce[T]): Agg[T] - def map[T](f: V => T): Agg[T] - def filter(f: V => Boolean): Agg[V] - def withFilter(f: V => Boolean): Agg[V] - def collect[T](f: PartialFunction[V, T]): Agg[T] - def zipWithIndex: Agg[(V, Int)] - def reverse: Agg[V] - def zip[T](other: Agg[T]): Agg[(V, T)] - def ++[T >: V](other: TraversableOnce[T]): Agg[T] - def length: Int - } - - object Agg{ - def empty[V]: Agg[V] = new Agg.Mutable[V] - implicit def jsonFormat[T: upickle.default.ReadWriter]: upickle.default.ReadWriter[Agg[T]] = - upickle.default.readwriter[Seq[T]].bimap[Agg[T]]( - _.toList, - Agg.from(_) - ) - - def apply[V](items: V*) = from(items) - - implicit def from[V](items: TraversableOnce[V]): Agg[V] = { - val set = new Agg.Mutable[V]() - items.foreach(set.append) - set - } - - - class Mutable[V]() extends Agg[V]{ - - private[this] val set0 = mutable.LinkedHashSet.empty[V] - def contains(v: V) = set0.contains(v) - def append(v: V) = if (!contains(v)){ - set0.add(v) - - }else if (strictUniqueness){ - throw new Exception("Duplicated item inserted into OrderedSet: " + v) - } - def appendAll(vs: Seq[V]) = vs.foreach(append) - def items = set0.iterator - def indexed: IndexedSeq[V] = items.toIndexedSeq - def set: collection.Set[V] = set0 - - def map[T](f: V => T): Agg[T] = { - val output = new Agg.Mutable[T] - for(i <- items) output.append(f(i)) - output - } - def flatMap[T](f: V => TraversableOnce[T]): Agg[T] = { - val output = new Agg.Mutable[T] - for(i <- items) for(i0 <- f(i)) output.append(i0) - output - } - def filter(f: V => Boolean): Agg[V] = { - val output = new Agg.Mutable[V] - for(i <- items) if (f(i)) output.append(i) - output - } - def withFilter(f: V => Boolean): Agg[V] = filter(f) - - def collect[T](f: PartialFunction[V, T]) = this.filter(f.isDefinedAt).map(x => f(x)) - - def zipWithIndex = { - var i = 0 - this.map{ x => - i += 1 - (x, i-1) - } - } - - def reverse = Agg.from(indexed.reverseIterator) - - def zip[T](other: Agg[T]) = Agg.from(items.zip(other.items)) - def ++[T >: V](other: TraversableOnce[T]) = Agg.from(items ++ other) - def length: Int = set0.size - - // Members declared in scala.collection.GenTraversableOnce - def isTraversableAgain: Boolean = items.isTraversableAgain - def toIterator: Iterator[V] = items.toIterator - def toStream: Stream[V] = items.toStream - - // Members declared in scala.collection.TraversableOnce - def copyToArray[B >: V](xs: Array[B], start: Int,len: Int): Unit = items.copyToArray(xs, start, len) - def exists(p: V => Boolean): Boolean = items.exists(p) - def find(p: V => Boolean): Option[V] = items.find(p) - def forall(p: V => Boolean): Boolean = items.forall(p) - def foreach[U](f: V => U): Unit = items.foreach(f) - def hasDefiniteSize: Boolean = items.hasDefiniteSize - def isEmpty: Boolean = items.isEmpty - def seq: scala.collection.TraversableOnce[V] = items - def toTraversable: Traversable[V] = items.toTraversable - - override def hashCode() = items.map(_.hashCode()).sum - override def equals(other: Any) = other match{ - case s: Agg[_] => items.sameElements(s.items) - case _ => super.equals(other) - } - override def toString = items.mkString("Agg(", ", ", ")") - } - } -} diff --git a/main/core/src/mill/util/EitherOps.scala b/main/core/src/util/EitherOps.scala index da2552c8..da2552c8 100644 --- a/main/core/src/mill/util/EitherOps.scala +++ b/main/core/src/util/EitherOps.scala diff --git a/main/core/src/mill/util/EnclosingClass.scala b/main/core/src/util/EnclosingClass.scala index a69cc525..a69cc525 100644 --- a/main/core/src/mill/util/EnclosingClass.scala +++ b/main/core/src/util/EnclosingClass.scala diff --git a/main/core/src/mill/util/JsonFormatters.scala b/main/core/src/util/JsonFormatters.scala index 830782c6..830782c6 100644 --- a/main/core/src/mill/util/JsonFormatters.scala +++ b/main/core/src/util/JsonFormatters.scala diff --git a/main/core/src/mill/util/Loggers.scala b/main/core/src/util/Loggers.scala index aab1a324..aab1a324 100644 --- a/main/core/src/mill/util/Loggers.scala +++ b/main/core/src/util/Loggers.scala diff --git a/main/core/src/mill/util/MultiBiMap.scala b/main/core/src/util/MultiBiMap.scala index 73bb42c4..51ea63f2 100644 --- a/main/core/src/mill/util/MultiBiMap.scala +++ b/main/core/src/util/MultiBiMap.scala @@ -1,7 +1,7 @@ package mill.util import scala.collection.mutable -import Strict.Agg +import mill.api.Strict.Agg /** * A map from keys to collections of values: you can assign multiple values diff --git a/main/core/src/mill/util/ParseArgs.scala b/main/core/src/util/ParseArgs.scala index fc1a8ab3..fc1a8ab3 100644 --- a/main/core/src/mill/util/ParseArgs.scala +++ b/main/core/src/util/ParseArgs.scala diff --git a/main/core/src/mill/util/Router.scala b/main/core/src/util/Router.scala index 5dd3c947..5dd3c947 100644 --- a/main/core/src/mill/util/Router.scala +++ b/main/core/src/util/Router.scala diff --git a/main/core/src/mill/util/Scripts.scala b/main/core/src/util/Scripts.scala index 65eb6b2b..65eb6b2b 100644 --- a/main/core/src/mill/util/Scripts.scala +++ b/main/core/src/util/Scripts.scala diff --git a/main/core/src/mill/util/Watched.scala b/main/core/src/util/Watched.scala index 29be53c3..29be53c3 100644 --- a/main/core/src/mill/util/Watched.scala +++ b/main/core/src/util/Watched.scala diff --git a/main/core/src/mill/util/package.scala b/main/core/src/util/package.scala index ec5d2efc..ec5d2efc 100644 --- a/main/core/src/mill/util/package.scala +++ b/main/core/src/util/package.scala diff --git a/main/graphviz/src/mill/main/graphviz/GraphvizTools.scala b/main/graphviz/src/GraphvizTools.scala index 9812c81f..9812c81f 100644 --- a/main/graphviz/src/mill/main/graphviz/GraphvizTools.scala +++ b/main/graphviz/src/GraphvizTools.scala diff --git a/main/moduledefs/src/mill/moduledefs/AutoOverridePlugin.scala b/main/moduledefs/src/AutoOverridePlugin.scala index a870e7ec..a870e7ec 100644 --- a/main/moduledefs/src/mill/moduledefs/AutoOverridePlugin.scala +++ b/main/moduledefs/src/AutoOverridePlugin.scala diff --git a/main/moduledefs/src/mill/moduledefs/Cacher.scala b/main/moduledefs/src/Cacher.scala index 023f03be..023f03be 100644 --- a/main/moduledefs/src/mill/moduledefs/Cacher.scala +++ b/main/moduledefs/src/Cacher.scala diff --git a/main/moduledefs/src/mill/moduledefs/Scaladoc.java b/main/moduledefs/src/Scaladoc.java index 7a7d700b..7a7d700b 100644 --- a/main/moduledefs/src/mill/moduledefs/Scaladoc.java +++ b/main/moduledefs/src/Scaladoc.java diff --git a/main/src/mill/MillMain.scala b/main/src/MillMain.scala index e953e65d..e953e65d 100644 --- a/main/src/mill/MillMain.scala +++ b/main/src/MillMain.scala diff --git a/main/src/mill/main/MainModule.scala b/main/src/main/MainModule.scala index 34145668..dbe92cc2 100644 --- a/main/src/mill/main/MainModule.scala +++ b/main/src/main/MainModule.scala @@ -32,6 +32,10 @@ trait MainModule extends mill.Module{ implicit def millDiscover: mill.define.Discover[_] implicit def millScoptTasksReads[T] = new mill.main.Tasks.Scopt[T]() implicit def millScoptEvaluatorReads[T] = new mill.main.EvaluatorScopt[T]() + + /** + * Show the mill version. + */ def version() = mill.T.command { val res = System.getProperty("MILL_VERSION") println(res) diff --git a/main/src/mill/main/MainRunner.scala b/main/src/main/MainRunner.scala index e50ed370..e50ed370 100644 --- a/main/src/mill/main/MainRunner.scala +++ b/main/src/main/MainRunner.scala diff --git a/main/src/mill/main/MainScopts.scala b/main/src/main/MainScopts.scala index 718a30e6..718a30e6 100644 --- a/main/src/mill/main/MainScopts.scala +++ b/main/src/main/MainScopts.scala diff --git a/main/src/mill/main/MillServerMain.scala b/main/src/main/MillServerMain.scala index 26ca99e6..26ca99e6 100644 --- a/main/src/mill/main/MillServerMain.scala +++ b/main/src/main/MillServerMain.scala diff --git a/main/src/mill/main/ReplApplyHandler.scala b/main/src/main/ReplApplyHandler.scala index a8e467d4..786a1409 100644 --- a/main/src/mill/main/ReplApplyHandler.scala +++ b/main/src/main/ReplApplyHandler.scala @@ -6,7 +6,7 @@ import mill.define.Segment.Label import mill.define._ import mill.eval.{Evaluator, Result} -import mill.util.Strict.Agg +import mill.api.Strict.Agg import scala.collection.mutable object ReplApplyHandler{ diff --git a/main/src/mill/main/Resolve.scala b/main/src/main/Resolve.scala index a2c186ed..a2c186ed 100644 --- a/main/src/mill/main/Resolve.scala +++ b/main/src/main/Resolve.scala diff --git a/main/src/mill/main/RunScript.scala b/main/src/main/RunScript.scala index 47526631..b858c8b9 100644 --- a/main/src/mill/main/RunScript.scala +++ b/main/src/main/RunScript.scala @@ -11,7 +11,7 @@ import mill.define._ import mill.eval.{Evaluator, PathRef, Result} import mill.util.{EitherOps, ParseArgs, Watched} import mill.api.Logger -import mill.util.Strict.Agg +import mill.api.Strict.Agg import scala.collection.mutable import scala.reflect.ClassTag diff --git a/main/src/mill/main/VisualizeModule.scala b/main/src/main/VisualizeModule.scala index e950973f..e950973f 100644 --- a/main/src/mill/main/VisualizeModule.scala +++ b/main/src/main/VisualizeModule.scala diff --git a/main/src/mill/modules/Assembly.scala b/main/src/modules/Assembly.scala index 141bc226..141bc226 100644 --- a/main/src/mill/modules/Assembly.scala +++ b/main/src/modules/Assembly.scala diff --git a/main/src/mill/modules/Jvm.scala b/main/src/modules/Jvm.scala index 1a51ed8b..e17631e3 100644 --- a/main/src/mill/modules/Jvm.scala +++ b/main/src/modules/Jvm.scala @@ -15,7 +15,7 @@ import mill.main.client.InputPumper import mill.eval.{PathRef, Result} import mill.util.Ctx import mill.api.IO -import mill.util.Loose.Agg +import mill.api.Loose.Agg import scala.collection.mutable import scala.collection.JavaConverters._ diff --git a/main/src/mill/modules/Util.scala b/main/src/modules/Util.scala index 2b98a304..029626fe 100644 --- a/main/src/mill/modules/Util.scala +++ b/main/src/modules/Util.scala @@ -3,7 +3,8 @@ package mill.modules import coursier.Repository import mill.api.{PathRef, IO} -import mill.util.{Ctx, Loose} +import mill.util.Ctx +import mill.api.Loose object Util { @@ -55,7 +56,7 @@ object Util { val localPath = sys.props(key) if (localPath != null) { mill.api.Result.Success( - Loose.Agg.from(localPath.split(',').map(p => PathRef(os.Path(p), quick = true))) + mill.api.Loose.Agg.from(localPath.split(',').map(p => PathRef(os.Path(p), quick = true))) ) } else { mill.modules.Jvm.resolveDependencies( diff --git a/main/src/mill/package.scala b/main/src/package.scala index 0ccd094f..6bcb1bdf 100644 --- a/main/src/mill/package.scala +++ b/main/src/package.scala @@ -7,6 +7,6 @@ package object mill extends JsonFormatters{ type PathRef = mill.api.PathRef type Module = define.Module type Cross[T] = define.Cross[T] - type Agg[T] = util.Loose.Agg[T] - val Agg = util.Loose.Agg + type Agg[T] = mill.api.Loose.Agg[T] + val Agg = mill.api.Loose.Agg } diff --git a/main/test/resources/examples/javac/build.sc b/main/test/resources/examples/javac/build.sc index 2ed9f915..17366219 100644 --- a/main/test/resources/examples/javac/build.sc +++ b/main/test/resources/examples/javac/build.sc @@ -2,7 +2,7 @@ import mill.T import mill.eval.JavaCompileJarTests.compileAll import mill.api.PathRef import mill.modules.Jvm -import mill.util.Loose +import mill.api.Loose def sourceRootPath = millSourcePath / 'src def resourceRootPath = millSourcePath / 'resources diff --git a/main/test/src/mill/TestMain.scala b/main/test/src/TestMain.scala index 80e7e627..80e7e627 100644 --- a/main/test/src/mill/TestMain.scala +++ b/main/test/src/TestMain.scala diff --git a/main/test/src/mill/UTestFramework.scala b/main/test/src/UTestFramework.scala index c234151b..c234151b 100644 --- a/main/test/src/mill/UTestFramework.scala +++ b/main/test/src/UTestFramework.scala diff --git a/main/test/src/mill/define/ApplicativeTests.scala b/main/test/src/define/ApplicativeTests.scala index 9dd2132f..9dd2132f 100644 --- a/main/test/src/mill/define/ApplicativeTests.scala +++ b/main/test/src/define/ApplicativeTests.scala diff --git a/main/test/src/mill/define/BasePathTests.scala b/main/test/src/define/BasePathTests.scala index b8a653c8..b8a653c8 100644 --- a/main/test/src/mill/define/BasePathTests.scala +++ b/main/test/src/define/BasePathTests.scala diff --git a/main/test/src/mill/define/CacherTests.scala b/main/test/src/define/CacherTests.scala index 59ebf3f6..1524e5c1 100644 --- a/main/test/src/mill/define/CacherTests.scala +++ b/main/test/src/define/CacherTests.scala @@ -1,7 +1,7 @@ package mill.define import mill.util.{DummyLogger, TestEvaluator, TestUtil} -import mill.util.Strict.Agg +import mill.api.Strict.Agg import mill.T import mill.api.Result.Success import utest._ diff --git a/main/test/src/mill/define/DiscoverTests.scala b/main/test/src/define/DiscoverTests.scala index 248d6afe..248d6afe 100644 --- a/main/test/src/mill/define/DiscoverTests.scala +++ b/main/test/src/define/DiscoverTests.scala diff --git a/main/test/src/mill/define/GraphTests.scala b/main/test/src/define/GraphTests.scala index 224ce59f..b36dbf95 100644 --- a/main/test/src/mill/define/GraphTests.scala +++ b/main/test/src/define/GraphTests.scala @@ -4,7 +4,7 @@ package mill.define import mill.eval.Evaluator import mill.util.{TestGraphs, TestUtil} import utest._ -import mill.util.Strict.Agg +import mill.api.Strict.Agg object GraphTests extends TestSuite{ val tests = Tests{ diff --git a/main/test/src/mill/define/MacroErrorTests.scala b/main/test/src/define/MacroErrorTests.scala index c8b140fa..c8b140fa 100644 --- a/main/test/src/mill/define/MacroErrorTests.scala +++ b/main/test/src/define/MacroErrorTests.scala diff --git a/main/test/src/mill/eval/CrossTests.scala b/main/test/src/eval/CrossTests.scala index f194924e..f194924e 100644 --- a/main/test/src/mill/eval/CrossTests.scala +++ b/main/test/src/eval/CrossTests.scala diff --git a/main/test/src/mill/eval/EvaluationTests.scala b/main/test/src/eval/EvaluationTests.scala index 74f9088c..7f924db2 100644 --- a/main/test/src/mill/eval/EvaluationTests.scala +++ b/main/test/src/eval/EvaluationTests.scala @@ -5,7 +5,7 @@ import mill.util.TestUtil.{Test, test} import mill.define.{Discover, Graph, Target, Task} import mill.{Module, T} import mill.util.{DummyLogger, TestEvaluator, TestGraphs, TestUtil} -import mill.util.Strict.Agg +import mill.api.Strict.Agg import utest._ import utest.framework.TestPath diff --git a/main/test/src/mill/eval/FailureTests.scala b/main/test/src/eval/FailureTests.scala index dcfbcb60..dcfbcb60 100644 --- a/main/test/src/mill/eval/FailureTests.scala +++ b/main/test/src/eval/FailureTests.scala diff --git a/main/test/src/mill/eval/JavaCompileJarTests.scala b/main/test/src/eval/JavaCompileJarTests.scala index 426c6ea6..0f9002df 100644 --- a/main/test/src/mill/eval/JavaCompileJarTests.scala +++ b/main/test/src/eval/JavaCompileJarTests.scala @@ -4,12 +4,13 @@ import mill.define.{Discover, Input, Target, Task} import mill.modules.Jvm import mill.api.Ctx.Dest import mill.{Module, T} -import mill.util.{DummyLogger, Loose, TestEvaluator, TestUtil} -import mill.util.Strict.Agg +import mill.util.{DummyLogger, TestEvaluator, TestUtil} +import mill.api.Strict.Agg +import mill.api.Loose import utest._ import mill._ object JavaCompileJarTests extends TestSuite{ - def compileAll(sources: mill.util.Loose.Agg[PathRef])(implicit ctx: Dest) = { + def compileAll(sources: mill.api.Loose.Agg[PathRef])(implicit ctx: Dest) = { os.makeDir.all(ctx.dest) os.proc("javac", sources.map(_.path.toString()).toSeq, "-d", ctx.dest).call(ctx.dest) diff --git a/main/test/src/mill/eval/ModuleTests.scala b/main/test/src/eval/ModuleTests.scala index f28fc9b6..f28fc9b6 100644 --- a/main/test/src/mill/eval/ModuleTests.scala +++ b/main/test/src/eval/ModuleTests.scala diff --git a/main/test/src/mill/eval/TarjanTests.scala b/main/test/src/eval/TarjanTests.scala index 2f9d0a4d..2f9d0a4d 100644 --- a/main/test/src/mill/eval/TarjanTests.scala +++ b/main/test/src/eval/TarjanTests.scala diff --git a/main/test/src/mill/eval/TaskTests.scala b/main/test/src/eval/TaskTests.scala index 0bfd8efc..0bfd8efc 100644 --- a/main/test/src/mill/eval/TaskTests.scala +++ b/main/test/src/eval/TaskTests.scala diff --git a/main/test/src/mill/main/ClientServerTests.scala b/main/test/src/main/ClientServerTests.scala index 05238a5f..05238a5f 100644 --- a/main/test/src/mill/main/ClientServerTests.scala +++ b/main/test/src/main/ClientServerTests.scala diff --git a/main/test/src/mill/main/ForeignBuildsTest.scala b/main/test/src/main/ForeignBuildsTest.scala index cfc8d00c..cfc8d00c 100644 --- a/main/test/src/mill/main/ForeignBuildsTest.scala +++ b/main/test/src/main/ForeignBuildsTest.scala diff --git a/main/test/src/mill/main/ForeignConflictTest.scala b/main/test/src/main/ForeignConflictTest.scala index a4352bb6..a4352bb6 100644 --- a/main/test/src/mill/main/ForeignConflictTest.scala +++ b/main/test/src/main/ForeignConflictTest.scala diff --git a/main/test/src/mill/main/JavaCompileJarTests.scala b/main/test/src/main/JavaCompileJarTests.scala index 37c64b05..37c64b05 100644 --- a/main/test/src/mill/main/JavaCompileJarTests.scala +++ b/main/test/src/main/JavaCompileJarTests.scala diff --git a/main/test/src/mill/main/MainTests.scala b/main/test/src/main/MainTests.scala index e836099c..e836099c 100644 --- a/main/test/src/mill/main/MainTests.scala +++ b/main/test/src/main/MainTests.scala diff --git a/main/test/src/mill/util/ParseArgsTest.scala b/main/test/src/util/ParseArgsTest.scala index e31baf4f..e31baf4f 100644 --- a/main/test/src/mill/util/ParseArgsTest.scala +++ b/main/test/src/util/ParseArgsTest.scala diff --git a/main/test/src/mill/util/ScriptTestSuite.scala b/main/test/src/util/ScriptTestSuite.scala index f448aaaf..f448aaaf 100644 --- a/main/test/src/mill/util/ScriptTestSuite.scala +++ b/main/test/src/util/ScriptTestSuite.scala diff --git a/main/test/src/mill/util/TestEvaluator.scala b/main/test/src/util/TestEvaluator.scala index 9a235679..81c8fe12 100644 --- a/main/test/src/mill/util/TestEvaluator.scala +++ b/main/test/src/util/TestEvaluator.scala @@ -3,7 +3,7 @@ package mill.util import mill.define.{Input, Target, Task} import mill.api.Result.OuterStack import mill.eval.{Evaluator, Result} -import mill.util.Strict.Agg +import mill.api.Strict.Agg import utest.assert import utest.framework.TestPath diff --git a/main/test/src/mill/util/TestGraphs.scala b/main/test/src/util/TestGraphs.scala index d3b35ddc..d3b35ddc 100644 --- a/main/test/src/mill/util/TestGraphs.scala +++ b/main/test/src/util/TestGraphs.scala diff --git a/main/test/src/mill/util/TestUtil.scala b/main/test/src/util/TestUtil.scala index baab2992..462b7f5c 100644 --- a/main/test/src/mill/util/TestUtil.scala +++ b/main/test/src/util/TestUtil.scala @@ -5,7 +5,7 @@ import mill.define._ import mill.api.Result import mill.api.Result.OuterStack import utest.assert -import mill.util.Strict.Agg +import mill.api.Strict.Agg import utest.framework.TestPath import scala.collection.mutable |