diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-01-13 15:07:04 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-01-13 15:07:04 -0800 |
commit | 38ca4a5005dbaee94e674c41bb7262d603eec73c (patch) | |
tree | 9e087e24ffe21d26518c3daa956f3d063f85eea7 | |
parent | 57501fca3b6c2c64d32744e6d534b9de3a6674f6 (diff) | |
download | mill-38ca4a5005dbaee94e674c41bb7262d603eec73c.tar.gz mill-38ca4a5005dbaee94e674c41bb7262d603eec73c.tar.bz2 mill-38ca4a5005dbaee94e674c41bb7262d603eec73c.zip |
rename OSet -> Agg
33 files changed, 278 insertions, 278 deletions
@@ -10,7 +10,7 @@ import mill.modules.Jvm.createAssembly object moduledefs extends SbtModule{ def scalaVersion = "2.12.4" - def ivyDeps = OSet( + def ivyDeps = Agg( Dep.Java("org.scala-lang", "scala-compiler", scalaVersion()), Dep("com.lihaoyi", "sourcecode", "0.1.4") ) @@ -19,9 +19,9 @@ object moduledefs extends SbtModule{ trait MillModule extends SbtModule{ outer => def scalaVersion = "2.12.4" - def compileIvyDeps = OSet(Dep("com.lihaoyi", "acyclic", "0.1.7")) + def compileIvyDeps = Agg(Dep("com.lihaoyi", "acyclic", "0.1.7")) def scalacOptions = Seq("-P:acyclic:force") - def scalacPluginIvyDeps = OSet(Dep("com.lihaoyi", "acyclic", "0.1.7")) + def scalacPluginIvyDeps = Agg(Dep("com.lihaoyi", "acyclic", "0.1.7")) def repositories = super.repositories ++ Seq( MavenRepository("https://oss.sonatype.org/content/repositories/releases") @@ -36,7 +36,7 @@ trait MillModule extends SbtModule{ outer => def projectDeps = if (this == core.test) Seq(core) else Seq(outer, core.test) - def ivyDeps = OSet(Dep("com.lihaoyi", "utest", "0.6.0")) + def ivyDeps = Agg(Dep("com.lihaoyi", "utest", "0.6.0")) def testFramework = "mill.UTestFramework" def scalacPluginClasspath = super.scalacPluginClasspath() ++ Seq(moduledefs.jar()) } @@ -45,11 +45,11 @@ trait MillModule extends SbtModule{ outer => object core extends MillModule { def projectDeps = Seq(moduledefs) - def compileIvyDeps = OSet( + def compileIvyDeps = Agg( Dep.Java("org.scala-lang", "scala-reflect", scalaVersion()) ) - def ivyDeps = OSet( + def ivyDeps = Agg( Dep("com.lihaoyi", "sourcecode", "0.1.4"), Dep("com.lihaoyi", "pprint", "0.5.3"), Dep.Point("com.lihaoyi", "ammonite", "1.0.3-21-05b5d32"), @@ -61,7 +61,7 @@ object core extends MillModule { def generatedSources = T { mkdir(T.ctx().dest) shared.generateCoreSources(T.ctx().dest) - OSet(PathRef(T.ctx().dest)) + Agg(PathRef(T.ctx().dest)) } val test = new Tests(implicitly) @@ -69,7 +69,7 @@ object core extends MillModule { def generatedSources = T { mkdir(T.ctx().dest) shared.generateCoreTestSources(T.ctx().dest) - OSet(PathRef(T.ctx().dest)) + Agg(PathRef(T.ctx().dest)) } } } @@ -83,9 +83,9 @@ class BridgeModule(crossVersion: String) extends PublishModule { def scalaVersion = crossVersion def allSources = T{ - OSet(PathRef(shared.downloadBridgeSource(T.ctx().dest, crossVersion))) + Agg(PathRef(shared.downloadBridgeSource(T.ctx().dest, crossVersion))) } - def ivyDeps = OSet( + def ivyDeps = Agg( Dep.Java("org.scala-lang", "scala-compiler", crossVersion), Dep.Java("org.scala-sbt", "compiler-interface", "1.0.5") ) @@ -125,7 +125,7 @@ class JsBridgeModule(scalajsBinary: String) extends MillModule{ case "0.6" => "0.6.21" case "1.0" => "1.0.0-M2" } - def ivyDeps = OSet( + def ivyDeps = Agg( Dep("org.scala-js", "scalajs-tools", scalajsVersion) ) } @@ -134,8 +134,8 @@ object scalajslib extends MillModule { def projectDeps = Seq(scalalib) - def bridgeClasspath(runDepClasspath: OSet[PathRef], classes: PathRef) = - (runDepClasspath ++ OSet(classes)).map(_.path).mkString(File.pathSeparator) + def bridgeClasspath(runDepClasspath: Agg[PathRef], classes: PathRef) = + (runDepClasspath ++ Agg(classes)).map(_.path).mkString(File.pathSeparator) def testArgs = T{ val mapping = Map( "MILL_SCALAJS_BRIDGE_0_6" -> bridgeClasspath(jsbridges("0.6").runDepClasspath(), jsbridges("0.6").compile().classes), @@ -171,7 +171,7 @@ def publishBridges(credentials: String, gpgPassphrase: String) = T.command { mill.define.Task.traverse(bridges.items)(_._2.publish(credentials, gpgPassphrase)) } -def assemblyBase(classpath: OSet[Path], extraArgs: String) +def assemblyBase(classpath: Agg[Path], extraArgs: String) (implicit ctx: mill.util.Ctx.DestCtx) = { createAssembly( classpath, @@ -182,11 +182,11 @@ def assemblyBase(classpath: OSet[Path], extraArgs: String) } def devAssembly = T{ - assemblyBase(OSet.from(assemblyClasspath().flatten.map(_.path)), (scalalib.testArgs() ++ scalajslib.testArgs()).mkString(" ")) + assemblyBase(Agg.from(assemblyClasspath().flatten.map(_.path)), (scalalib.testArgs() ++ scalajslib.testArgs()).mkString(" ")) } def releaseAssembly = T{ - assemblyBase(OSet.from(assemblyClasspath().flatten.map(_.path)), "") + assemblyBase(Agg.from(assemblyClasspath().flatten.map(_.path)), "") } def idea() = T.command{ mill.scalalib.GenIdea() }
\ No newline at end of file diff --git a/core/src/main/scala/mill/define/Graph.scala b/core/src/main/scala/mill/define/Graph.scala index 68fb65ed..f06dca11 100644 --- a/core/src/main/scala/mill/define/Graph.scala +++ b/core/src/main/scala/mill/define/Graph.scala @@ -2,17 +2,17 @@ package mill.define import mill.eval.Tarjans import mill.util.MultiBiMap -import mill.util.Strict.OSet +import mill.util.Strict.Agg object Graph { - class TopoSorted private[Graph](val values: OSet[Task[_]]) + class TopoSorted private[Graph](val values: Agg[Task[_]]) def groupAroundImportantTargets[T](topoSortedTargets: TopoSorted) (important: PartialFunction[Task[_], T]): MultiBiMap[T, Task[_]] = { val output = new MultiBiMap.Mutable[T, Task[_]]() for ((target, t) <- topoSortedTargets.values.flatMap(t => important.lift(t).map((t, _)))) { - val transitiveTargets = new OSet.Mutable[Task[_]] + val transitiveTargets = new Agg.Mutable[Task[_]] def rec(t: Task[_]): Unit = { if (transitiveTargets.contains(t)) () // do nothing else if (important.isDefinedAt(t) && t != target) () // do nothing @@ -27,8 +27,8 @@ object Graph { output } - def transitiveTargets(sourceTargets: OSet[Task[_]]): OSet[Task[_]] = { - val transitiveTargets = new OSet.Mutable[Task[_]] + def transitiveTargets(sourceTargets: Agg[Task[_]]): Agg[Task[_]] = { + val transitiveTargets = new Agg.Mutable[Task[_]] def rec(t: Task[_]): Unit = { if (transitiveTargets.contains(t)) () // do nothing else { @@ -44,7 +44,7 @@ object Graph { * Takes the given targets, finds all the targets they transitively depend * on, and sort them topologically. Fails if there are dependency cycles */ - def topoSorted(transitiveTargets: OSet[Task[_]]): TopoSorted = { + def topoSorted(transitiveTargets: Agg[Task[_]]): TopoSorted = { val indexed = transitiveTargets.indexed val targetIndices = indexed.zipWithIndex.toMap @@ -56,6 +56,6 @@ object Graph { val sortedClusters = Tarjans(numberedEdges) val nonTrivialClusters = sortedClusters.filter(_.length > 1) assert(nonTrivialClusters.isEmpty, nonTrivialClusters) - new TopoSorted(OSet.from(sortedClusters.flatten.map(indexed))) + new TopoSorted(Agg.from(sortedClusters.flatten.map(indexed))) } } diff --git a/core/src/main/scala/mill/discover/Discovered.scala b/core/src/main/scala/mill/discover/Discovered.scala index b7ec2140..98d4ebb9 100644 --- a/core/src/main/scala/mill/discover/Discovered.scala +++ b/core/src/main/scala/mill/discover/Discovered.scala @@ -5,7 +5,7 @@ import ammonite.main.Router import ammonite.main.Router.EntryPoint import mill.discover.Mirror.TargetPoint import mill.util.Ctx.Loader -import mill.util.Strict.OSet +import mill.util.Strict.Agg import scala.language.experimental.macros import scala.reflect.macros.blackbox.Context @@ -28,7 +28,7 @@ object Discovered { (mirror, segments, resolvedNode) => Seq(resolvedNode -> mirror) }.toMap - val targets = OSet.from( + val targets = Agg.from( Mirror.traverseNode(base, mirror){ (mirror, segmentsRev, resolvedNode) => for(target <- mirror.targets) yield target.asInstanceOf[TargetPoint[Any, Any]].run(resolvedNode) @@ -44,7 +44,7 @@ object Discovered { val targetsToSegments = segmentsToTargets.map(_.swap) } - def consistencyCheck[T](mapping: Discovered.Mapping[T]): OSet[Segments] = { + def consistencyCheck[T](mapping: Discovered.Mapping[T]): Agg[Segments] = { val mapping2 = Discovered.Mapping(mapping.mirror, mapping.base) for{ (t1, t2) <- mapping2.targets.zip(mapping.targets) diff --git a/core/src/main/scala/mill/eval/Evaluator.scala b/core/src/main/scala/mill/eval/Evaluator.scala index 2afaec6e..28d90fcf 100644 --- a/core/src/main/scala/mill/eval/Evaluator.scala +++ b/core/src/main/scala/mill/eval/Evaluator.scala @@ -9,7 +9,7 @@ import mill.discover.{Discovered, Mirror} import mill.define.Segment import mill.util import mill.util._ -import mill.util.Strict.OSet +import mill.util.Strict.Agg import scala.collection.mutable import scala.util.control.NonFatal @@ -35,7 +35,7 @@ class Evaluator[T](val workspacePath: Path, val workerCache = mutable.Map.empty[Ctx.Loader[_], Any] workerCache(Discovered.Mapping) = mapping - def evaluate(goals: OSet[Task[_]]): Evaluator.Results = { + def evaluate(goals: Agg[Task[_]]): Evaluator.Results = { mkdir(workspacePath) val transitive = Graph.transitiveTargets(goals) @@ -55,7 +55,7 @@ class Evaluator[T](val workspacePath: Path, case t if goals.contains(t) => Left(t) } - val evaluated = new OSet.Mutable[Task[_]] + val evaluated = new Agg.Mutable[Task[_]] val results = mutable.LinkedHashMap.empty[Task[_], Result[Any]] for (((terminal, group), i) <- sortedGroups.items().zipWithIndex){ @@ -84,7 +84,7 @@ class Evaluator[T](val workspacePath: Path, def evaluateGroupCached(terminal: Either[Task[_], Labelled[_]], - group: OSet[Task[_]], + group: Agg[Task[_]], results: collection.Map[Task[_], Result[Any]], counterMsg: String): (collection.Map[Task[_], Result[Any]], Seq[Task[_]]) = { @@ -168,7 +168,7 @@ class Evaluator[T](val workspacePath: Path, } - def evaluateGroup(group: OSet[Task[_]], + def evaluateGroup(group: Agg[Task[_]], results: collection.Map[Task[_], Result[Any]], groupBasePath: Option[Path], paths: Option[Evaluator.Paths], @@ -275,8 +275,8 @@ object Evaluator{ } case class Results(rawValues: Seq[Result[Any]], - evaluated: OSet[Task[_]], - transitive: OSet[Task[_]], + evaluated: Agg[Task[_]], + transitive: Agg[Task[_]], failing: MultiBiMap[Either[Task[_], Labelled[_]], Result.Failing], results: collection.Map[Task[_], Result[Any]]){ def values = rawValues.collect{case Result.Success(v) => v} diff --git a/core/src/main/scala/mill/main/ReplApplyHandler.scala b/core/src/main/scala/mill/main/ReplApplyHandler.scala index b83453ee..c239745a 100644 --- a/core/src/main/scala/mill/main/ReplApplyHandler.scala +++ b/core/src/main/scala/mill/main/ReplApplyHandler.scala @@ -5,7 +5,7 @@ import mill.define.Applicative.ApplyHandler import mill.define._ import mill.discover.{Discovered, Mirror} import mill.eval.{Evaluator, Result} -import mill.util.Strict.OSet +import mill.util.Strict.Agg import scala.collection.mutable object ReplApplyHandler{ @@ -34,7 +34,7 @@ class ReplApplyHandler(pprinter0: pprint.PPrinter, evaluator: Evaluator[_]) exte // as the user enters more REPL commands and changes the classpath val classLoaderSig = Evaluator.classLoaderSig override def apply[V](t: Task[V]) = { - val res = evaluator.evaluate(OSet(t)) + val res = evaluator.evaluate(Agg(t)) res.values match{ case Seq(head: V) => head case Nil => diff --git a/core/src/main/scala/mill/main/RunScript.scala b/core/src/main/scala/mill/main/RunScript.scala index 9f73fbc8..785db80e 100644 --- a/core/src/main/scala/mill/main/RunScript.scala +++ b/core/src/main/scala/mill/main/RunScript.scala @@ -12,7 +12,7 @@ import mill.define.Segment import mill.discover.Discovered import mill.eval.{Evaluator, Result} import mill.util.{EitherOps, Logger} -import mill.util.Strict.OSet +import mill.util.Strict.Agg import upickle.Js /** @@ -138,7 +138,7 @@ object RunScript{ def evaluate(evaluator: Evaluator[_], targets: Seq[Task[Any]]): (Seq[PathRef], Either[String, Seq[(Any, Option[upickle.Js.Value])]]) = { - val evaluated = evaluator.evaluate(OSet.from(targets)) + val evaluated = evaluator.evaluate(Agg.from(targets)) val watched = evaluated.results .iterator .collect { diff --git a/core/src/main/scala/mill/modules/Jvm.scala b/core/src/main/scala/mill/modules/Jvm.scala index 6e3fe45f..48f100b2 100644 --- a/core/src/main/scala/mill/modules/Jvm.scala +++ b/core/src/main/scala/mill/modules/Jvm.scala @@ -9,15 +9,15 @@ import ammonite.ops._ import mill.define.Task import mill.eval.PathRef import mill.util.Ctx -import mill.util.Loose.OSet +import mill.util.Loose.Agg import scala.annotation.tailrec import scala.collection.mutable object Jvm { - def gatherClassloaderJars(): OSet[Path] = { - val allJars = new OSet.Mutable[Path]() + def gatherClassloaderJars(): Agg[Path] = { + val allJars = new Agg.Mutable[Path]() var currentClassloader = Thread.currentThread().getContextClassLoader while(currentClassloader != null){ currentClassloader match{ @@ -30,14 +30,14 @@ object Jvm { } def interactiveSubprocess(mainClass: String, - classPath: OSet[Path], + classPath: Agg[Path], options: Seq[String] = Seq.empty): Unit = { import ammonite.ops.ImplicitWd._ %("java", "-cp", classPath.mkString(":"), mainClass, options) } def subprocess(mainClass: String, - classPath: OSet[Path], + classPath: Agg[Path], jvmOptions: Seq[String] = Seq.empty, options: Seq[String] = Seq.empty, workingDir: Path = null) @@ -101,7 +101,7 @@ object Jvm { m } - def createJar(inputPaths: OSet[Path], mainClass: Option[String] = None) + def createJar(inputPaths: Agg[Path], mainClass: Option[String] = None) (implicit ctx: Ctx.DestCtx): PathRef = { val outputPath = ctx.dest rm(outputPath) @@ -135,7 +135,7 @@ object Jvm { PathRef(outputPath) } - def createAssembly(inputPaths: OSet[Path], + def createAssembly(inputPaths: Agg[Path], mainClass: Option[String] = None, prependShellScript: String = "") (implicit ctx: Ctx.DestCtx): PathRef = { diff --git a/core/src/main/scala/mill/package.scala b/core/src/main/scala/mill/package.scala index 0b4f4873..78233cad 100644 --- a/core/src/main/scala/mill/package.scala +++ b/core/src/main/scala/mill/package.scala @@ -8,6 +8,6 @@ package object mill extends JsonFormatters{ type Module = define.Module val Module = define.Module type Cross[T] = define.Cross[T] - type OSet[T] = util.Loose.OSet[T] - val OSet = util.Loose.OSet + type Agg[T] = util.Loose.Agg[T] + val Agg = util.Loose.Agg } diff --git a/core/src/main/scala/mill/util/MultiBiMap.scala b/core/src/main/scala/mill/util/MultiBiMap.scala index abbaa752..2cb81944 100644 --- a/core/src/main/scala/mill/util/MultiBiMap.scala +++ b/core/src/main/scala/mill/util/MultiBiMap.scala @@ -1,7 +1,7 @@ package mill.util import scala.collection.mutable -import Strict.OSet +import Strict.Agg /** * A map from keys to collections of values: you can assign multiple values * to any particular key. Also allows lookups in both directions: what values @@ -9,22 +9,22 @@ import Strict.OSet */ trait MultiBiMap[K, V]{ def containsValue(v: V): Boolean - def lookupKey(k: K): OSet[V] + def lookupKey(k: K): Agg[V] def lookupValue(v: V): K def lookupValueOpt(v: V): Option[K] def add(k: K, v: V): Unit - def removeAll(k: K): OSet[V] + def removeAll(k: K): Agg[V] def addAll(k: K, vs: TraversableOnce[V]): Unit def keys(): Iterator[K] - def items(): Iterator[(K, OSet[V])] - def values(): Iterator[OSet[V]] + def items(): Iterator[(K, Agg[V])] + def values(): Iterator[Agg[V]] def keyCount: Int } object MultiBiMap{ class Mutable[K, V]() extends MultiBiMap[K, V]{ private[this] val valueToKey = mutable.LinkedHashMap.empty[V, K] - private[this] val keyToValues = mutable.LinkedHashMap.empty[K, OSet.Mutable[V]] + private[this] val keyToValues = mutable.LinkedHashMap.empty[K, Agg.Mutable[V]] def containsValue(v: V) = valueToKey.contains(v) def lookupKey(k: K) = keyToValues(k) def lookupKeyOpt(k: K) = keyToValues.get(k) @@ -32,10 +32,10 @@ object MultiBiMap{ def lookupValueOpt(v: V) = valueToKey.get(v) def add(k: K, v: V): Unit = { valueToKey(v) = k - keyToValues.getOrElseUpdate(k, new OSet.Mutable[V]()).append(v) + keyToValues.getOrElseUpdate(k, new Agg.Mutable[V]()).append(v) } - def removeAll(k: K): OSet[V] = keyToValues.get(k) match { - case None => OSet() + def removeAll(k: K): Agg[V] = keyToValues.get(k) match { + case None => Agg() case Some(vs) => vs.foreach(valueToKey.remove) diff --git a/core/src/main/scala/mill/util/OSet.scala b/core/src/main/scala/mill/util/OSet.scala index a4fcc406..d0f41777 100644 --- a/core/src/main/scala/mill/util/OSet.scala +++ b/core/src/main/scala/mill/util/OSet.scala @@ -3,46 +3,46 @@ package mill.util import scala.collection.mutable -object Strict extends OSetWrapper(true) -object Loose extends OSetWrapper(false) -sealed class OSetWrapper(strictUniqueness: Boolean){ +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 OSet[V] extends TraversableOnce[V]{ + 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]): OSet[T] - def map[T](f: V => T): OSet[T] - def filter(f: V => Boolean): OSet[V] - def withFilter(f: V => Boolean): OSet[V] - def collect[T](f: PartialFunction[V, T]): OSet[T] - def zipWithIndex: OSet[(V, Int)] - def reverse: OSet[V] - def zip[T](other: OSet[T]): OSet[(V, T)] - def ++[T >: V](other: TraversableOnce[T]): OSet[T] + 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] } - object OSet{ - def empty[V]: OSet[V] = new OSet.Mutable[V] - implicit def jsonFormat[T: upickle.default.ReadWriter]: upickle.default.ReadWriter[OSet[T]] = - upickle.default.ReadWriter[OSet[T]] ( + 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[Agg[T]] ( oset => upickle.default.writeJs(oset.toList), - {case json => OSet.from(upickle.default.readJs[Seq[T]](json))} + {case json => Agg.from(upickle.default.readJs[Seq[T]](json))} ) def apply[V](items: V*) = from(items) - def from[V](items: TraversableOnce[V]): OSet[V] = { - val set = new OSet.Mutable[V]() + def from[V](items: TraversableOnce[V]): Agg[V] = { + val set = new Agg.Mutable[V]() items.foreach(set.append) set } - class Mutable[V]() extends OSet[V]{ + class Mutable[V]() extends Agg[V]{ private[this] val set0 = mutable.LinkedHashSet.empty[V] def contains(v: V) = set0.contains(v) @@ -57,22 +57,22 @@ sealed class OSetWrapper(strictUniqueness: Boolean){ def indexed: IndexedSeq[V] = items.toIndexedSeq def set: collection.Set[V] = set0 - def map[T](f: V => T): OSet[T] = { - val output = new OSet.Mutable[T] + 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]): OSet[T] = { - val output = new OSet.Mutable[T] + 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): OSet[V] = { - val output = new OSet.Mutable[V] + 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): OSet[V] = filter(f) + def withFilter(f: V => Boolean): Agg[V] = filter(f) def collect[T](f: PartialFunction[V, T]) = this.filter(f.isDefinedAt).map(x => f(x)) @@ -84,10 +84,10 @@ sealed class OSetWrapper(strictUniqueness: Boolean){ } } - def reverse = OSet.from(indexed.reverseIterator) + def reverse = Agg.from(indexed.reverseIterator) - def zip[T](other: OSet[T]) = OSet.from(items.zip(other.items)) - def ++[T >: V](other: TraversableOnce[T]) = OSet.from(items ++ other) + def zip[T](other: Agg[T]) = Agg.from(items.zip(other.items)) + def ++[T >: V](other: TraversableOnce[T]) = Agg.from(items ++ other) // Members declared in scala.collection.GenTraversableOnce def isTraversableAgain: Boolean = items.isTraversableAgain @@ -107,10 +107,10 @@ sealed class OSetWrapper(strictUniqueness: Boolean){ override def hashCode() = items.map(_.hashCode()).sum override def equals(other: Any) = other match{ - case s: OSet[_] => items.sameElements(s.items) + case s: Agg[_] => items.sameElements(s.items) case _ => super.equals(other) } - override def toString = items.mkString("OSet(", ", ", ")") + override def toString = items.mkString("Agg(", ", ", ")") } } } diff --git a/core/src/test/scala/mill/define/CacherTests.scala b/core/src/test/scala/mill/define/CacherTests.scala index 4127a75b..5fca1ff0 100644 --- a/core/src/test/scala/mill/define/CacherTests.scala +++ b/core/src/test/scala/mill/define/CacherTests.scala @@ -3,7 +3,7 @@ package mill.define import mill.discover.Discovered import mill.eval.Evaluator import mill.util.{DummyLogger, TestUtil} -import mill.util.Strict.OSet +import mill.util.Strict.Agg import mill.T import mill.eval.Result.Success import utest._ @@ -31,7 +31,7 @@ object CacherTests extends TestSuite{ def eval[V](mapping: Discovered.Mapping[_], v: Task[V])(implicit tp: TestPath) = { val workspace = ammonite.ops.pwd / 'target / 'workspace / tp.value val evaluator = new Evaluator(workspace, ammonite.ops.pwd, mapping, DummyLogger) - evaluator.evaluate(OSet(v)).values(0) + evaluator.evaluate(Agg(v)).values(0) } 'simpleDefIsCached - assert( diff --git a/core/src/test/scala/mill/define/GraphTests.scala b/core/src/test/scala/mill/define/GraphTests.scala index 7241087a..3988328b 100644 --- a/core/src/test/scala/mill/define/GraphTests.scala +++ b/core/src/test/scala/mill/define/GraphTests.scala @@ -6,7 +6,7 @@ import Discovered.mapping import mill.eval.Evaluator import mill.util.{TestGraphs, TestUtil} import utest._ -import mill.util.Strict.OSet +import mill.util.Strict.Agg object GraphTests extends TestSuite{ val tests = Tests{ @@ -17,31 +17,31 @@ object GraphTests extends TestSuite{ import TestGraphs._ 'topoSortedTransitiveTargets - { - def check(targets: OSet[Task[_]], expected: OSet[Task[_]]) = { + def check(targets: Agg[Task[_]], expected: Agg[Task[_]]) = { val result = Graph.topoSorted(Graph.transitiveTargets(targets)).values TestUtil.checkTopological(result) assert(result == expected) } 'singleton - check( - targets = OSet(singleton.single), - expected = OSet(singleton.single) + targets = Agg(singleton.single), + expected = Agg(singleton.single) ) 'pair - check( - targets = OSet(pair.down), - expected = OSet(pair.up, pair.down) + targets = Agg(pair.down), + expected = Agg(pair.up, pair.down) ) 'anonTriple - check( - targets = OSet(anonTriple.down), - expected = OSet(anonTriple.up, anonTriple.down.inputs(0), anonTriple.down) + targets = Agg(anonTriple.down), + expected = Agg(anonTriple.up, anonTriple.down.inputs(0), anonTriple.down) ) 'diamond - check( - targets = OSet(diamond.down), - expected = OSet(diamond.up, diamond.left, diamond.right, diamond.down) + targets = Agg(diamond.down), + expected = Agg(diamond.up, diamond.left, diamond.right, diamond.down) ) 'anonDiamond - check( - targets = OSet(diamond.down), - expected = OSet( + targets = Agg(diamond.down), + expected = Agg( diamond.up, diamond.down.inputs(0), diamond.down.inputs(1), @@ -49,8 +49,8 @@ object GraphTests extends TestSuite{ ) ) 'defCachedDiamond - check( - targets = OSet(defCachedDiamond.down), - expected = OSet( + targets = Agg(defCachedDiamond.down), + expected = Agg( defCachedDiamond.up.inputs(0), defCachedDiamond.up, defCachedDiamond.down.inputs(0).inputs(0).inputs(0), @@ -62,7 +62,7 @@ object GraphTests extends TestSuite{ ) ) 'bigSingleTerminal - { - val result = Graph.topoSorted(Graph.transitiveTargets(OSet(bigSingleTerminal.j))).values + val result = Graph.topoSorted(Graph.transitiveTargets(Agg(bigSingleTerminal.j))).values TestUtil.checkTopological(result) assert(result.size == 28) } @@ -71,46 +71,46 @@ object GraphTests extends TestSuite{ 'groupAroundNamedTargets - { def check[T, R <: Target[Int]](base: T) (target: T => R, - important0: OSet[T => Target[_]], - expected: OSet[(R, Int)]) = { + important0: Agg[T => Target[_]], + expected: Agg[(R, Int)]) = { - val topoSorted = Graph.topoSorted(Graph.transitiveTargets(OSet(target(base)))) + val topoSorted = Graph.topoSorted(Graph.transitiveTargets(Agg(target(base)))) val important = important0.map(_ (base)) val grouped = Graph.groupAroundImportantTargets(topoSorted) { case t: Target[_] if important.contains(t) => t } - val flattened = OSet.from(grouped.values().flatMap(_.items)) + val flattened = Agg.from(grouped.values().flatMap(_.items)) TestUtil.checkTopological(flattened) for ((terminal, expectedSize) <- expected) { val grouping = grouped.lookupKey(terminal) assert( grouping.size == expectedSize, - grouping.flatMap(_.asTarget: Option[Target[_]]).filter(important.contains) == OSet(terminal) + grouping.flatMap(_.asTarget: Option[Target[_]]).filter(important.contains) == Agg(terminal) ) } } 'singleton - check(singleton)( _.single, - OSet(_.single), - OSet(singleton.single -> 1) + Agg(_.single), + Agg(singleton.single -> 1) ) 'pair - check(pair)( _.down, - OSet(_.up, _.down), - OSet(pair.up -> 1, pair.down -> 1) + Agg(_.up, _.down), + Agg(pair.up -> 1, pair.down -> 1) ) 'anonTriple - check(anonTriple)( _.down, - OSet(_.up, _.down), - OSet(anonTriple.up -> 1, anonTriple.down -> 2) + Agg(_.up, _.down), + Agg(anonTriple.up -> 1, anonTriple.down -> 2) ) 'diamond - check(diamond)( _.down, - OSet(_.up, _.left, _.right, _.down), - OSet( + Agg(_.up, _.left, _.right, _.down), + Agg( diamond.up -> 1, diamond.left -> 1, diamond.right -> 1, @@ -120,8 +120,8 @@ object GraphTests extends TestSuite{ 'defCachedDiamond - check(defCachedDiamond)( _.down, - OSet(_.up, _.left, _.right, _.down), - OSet( + Agg(_.up, _.left, _.right, _.down), + Agg( defCachedDiamond.up -> 2, defCachedDiamond.left -> 2, defCachedDiamond.right -> 2, @@ -131,16 +131,16 @@ object GraphTests extends TestSuite{ 'anonDiamond - check(anonDiamond)( _.down, - OSet(_.down, _.up), - OSet( + Agg(_.down, _.up), + Agg( anonDiamond.up -> 1, anonDiamond.down -> 3 ) ) 'bigSingleTerminal - check(bigSingleTerminal)( _.j, - OSet(_.a, _.b, _.e, _.f, _.i, _.j), - OSet( + Agg(_.a, _.b, _.e, _.f, _.i, _.j), + Agg( bigSingleTerminal.a -> 3, bigSingleTerminal.b -> 2, bigSingleTerminal.e -> 9, @@ -154,7 +154,7 @@ object GraphTests extends TestSuite{ def countGroups(mapping: Discovered.Mapping[_], goals: Task[_]*) = { val topoSorted = Graph.topoSorted( - Graph.transitiveTargets(OSet.from(goals)) + Graph.transitiveTargets(Agg.from(goals)) ) val grouped = Graph.groupAroundImportantTargets(topoSorted) { case t: NamedTask[Any] => t diff --git a/core/src/test/scala/mill/discover/ConsistencyTests.scala b/core/src/test/scala/mill/discover/ConsistencyTests.scala index 4a9ae843..f29273df 100644 --- a/core/src/test/scala/mill/discover/ConsistencyTests.scala +++ b/core/src/test/scala/mill/discover/ConsistencyTests.scala @@ -4,7 +4,7 @@ package mill.discover import mill.define.Segment.Label import mill.define.Segments import mill.util.{TestGraphs} -import mill.util.Strict.OSet +import mill.util.Strict.Agg import utest._ object ConsistencyTests extends TestSuite{ @@ -18,7 +18,7 @@ object ConsistencyTests extends TestSuite{ // // Maybe later we can convert them into compile errors somehow - val expected = OSet( + val expected = Agg( Segments(Label("down")), Segments(Label("right")), Segments(Label("left")), @@ -30,7 +30,7 @@ object ConsistencyTests extends TestSuite{ Discovered.mapping(diamond) ) - assert(inconsistent == OSet()) + assert(inconsistent == Agg()) } 'anonDiamond - { @@ -38,7 +38,7 @@ object ConsistencyTests extends TestSuite{ Discovered.mapping(anonDiamond) ) - assert(inconsistent == OSet()) + assert(inconsistent == Agg()) } 'borkedCachedDiamond2 - { diff --git a/core/src/test/scala/mill/eval/EvaluationTests.scala b/core/src/test/scala/mill/eval/EvaluationTests.scala index 2b9dd102..31ae5ab9 100644 --- a/core/src/test/scala/mill/eval/EvaluationTests.scala +++ b/core/src/test/scala/mill/eval/EvaluationTests.scala @@ -7,7 +7,7 @@ import mill.{Module, T} import mill.discover.Discovered import mill.discover.Discovered.mapping import mill.util.{DummyLogger, TestGraphs, TestUtil} -import mill.util.Strict.OSet +import mill.util.Strict.Agg import utest._ import utest.framework.TestPath @@ -19,7 +19,7 @@ object EvaluationTests extends TestSuite{ def evaluator = new Evaluator(workspace, ammonite.ops.pwd, mapping, DummyLogger) def apply(target: Task[_], expValue: Any, - expEvaled: OSet[Task[_]], + expEvaled: Agg[Task[_]], // How many "other" tasks were evaluated other than those listed above. // Pass in -1 to skip the check entirely extraEvaled: Int = 0, @@ -28,7 +28,7 @@ object EvaluationTests extends TestSuite{ // are directly evaluating tasks which need to re-evaluate every time secondRunNoOp: Boolean = true) = { - val evaled = evaluator.evaluate(OSet(target)) + val evaled = evaluator.evaluate(Agg(target)) val (matchingReturnedEvaled, extra) = evaled.evaluated.indexed.partition(expEvaled.contains) @@ -40,8 +40,8 @@ object EvaluationTests extends TestSuite{ // Second time the value is already cached, so no evaluation needed if (secondRunNoOp){ - val evaled2 = evaluator.evaluate(OSet(target)) - val expecteSecondRunEvaluated = OSet() + val evaled2 = evaluator.evaluate(Agg(target)) + val expecteSecondRunEvaluated = Agg() assert( evaled2.values == evaled.values, evaled2.evaluated == expecteSecondRunEvaluated @@ -61,94 +61,94 @@ object EvaluationTests extends TestSuite{ import singleton._ val check = new Checker(mapping(singleton)) // First time the target is evaluated - check(single, expValue = 0, expEvaled = OSet(single)) + check(single, expValue = 0, expEvaled = Agg(single)) single.counter += 1 // After incrementing the counter, it forces re-evaluation - check(single, expValue = 1, expEvaled = OSet(single)) + check(single, expValue = 1, expEvaled = Agg(single)) } 'pair - { import pair._ val check = new Checker(mapping(pair)) - check(down, expValue = 0, expEvaled = OSet(up, down)) + check(down, expValue = 0, expEvaled = Agg(up, down)) down.counter += 1 - check(down, expValue = 1, expEvaled = OSet(down)) + check(down, expValue = 1, expEvaled = Agg(down)) up.counter += 1 - check(down, expValue = 2, expEvaled = OSet(up, down)) + check(down, expValue = 2, expEvaled = Agg(up, down)) } 'anonTriple - { import anonTriple._ val check = new Checker(mapping(anonTriple)) val middle = down.inputs(0) - check(down, expValue = 0, expEvaled = OSet(up, middle, down)) + check(down, expValue = 0, expEvaled = Agg(up, middle, down)) down.counter += 1 - check(down, expValue = 1, expEvaled = OSet(middle, down)) + check(down, expValue = 1, expEvaled = Agg(middle, down)) up.counter += 1 - check(down, expValue = 2, expEvaled = OSet(up, middle, down)) + check(down, expValue = 2, expEvaled = Agg(up, middle, down)) middle.asInstanceOf[TestUtil.Test].counter += 1 - check(down, expValue = 3, expEvaled = OSet(middle, down)) + check(down, expValue = 3, expEvaled = Agg(middle, down)) } 'diamond - { import diamond._ val check = new Checker(mapping(diamond)) - check(down, expValue = 0, expEvaled = OSet(up, left, right, down)) + check(down, expValue = 0, expEvaled = Agg(up, left, right, down)) down.counter += 1 - check(down, expValue = 1, expEvaled = OSet(down)) + check(down, expValue = 1, expEvaled = Agg(down)) up.counter += 1 // Increment by 2 because up is referenced twice: once by left once by right - check(down, expValue = 3, expEvaled = OSet(up, left, right, down)) + check(down, expValue = 3, expEvaled = Agg(up, left, right, down)) left.counter += 1 - check(down, expValue = 4, expEvaled = OSet(left, down)) + check(down, expValue = 4, expEvaled = Agg(left, down)) right.counter += 1 - check(down, expValue = 5, expEvaled = OSet(right, down)) + check(down, expValue = 5, expEvaled = Agg(right, down)) } 'anonDiamond - { import anonDiamond._ val check = new Checker(mapping(anonDiamond)) val left = down.inputs(0).asInstanceOf[TestUtil.Test] val right = down.inputs(1).asInstanceOf[TestUtil.Test] - check(down, expValue = 0, expEvaled = OSet(up, left, right, down)) + check(down, expValue = 0, expEvaled = Agg(up, left, right, down)) down.counter += 1 - check(down, expValue = 1, expEvaled = OSet(left, right, down)) + check(down, expValue = 1, expEvaled = Agg(left, right, down)) up.counter += 1 // Increment by 2 because up is referenced twice: once by left once by right - check(down, expValue = 3, expEvaled = OSet(up, left, right, down)) + check(down, expValue = 3, expEvaled = Agg(up, left, right, down)) left.counter += 1 - check(down, expValue = 4, expEvaled = OSet(left, right, down)) + check(down, expValue = 4, expEvaled = Agg(left, right, down)) right.counter += 1 - check(down, expValue = 5, expEvaled = OSet(left, right, down)) + check(down, expValue = 5, expEvaled = Agg(left, right, down)) } 'bigSingleTerminal - { import bigSingleTerminal._ val check = new Checker(mapping(bigSingleTerminal)) - check(j, expValue = 0, expEvaled = OSet(a, b, e, f, i, j), extraEvaled = 22) + check(j, expValue = 0, expEvaled = Agg(a, b, e, f, i, j), extraEvaled = 22) j.counter += 1 - check(j, expValue = 1, expEvaled = OSet(j), extraEvaled = 3) + check(j, expValue = 1, expEvaled = Agg(j), extraEvaled = 3) i.counter += 1 // increment value by 2 because `i` is used twice on the way to `j` - check(j, expValue = 3, expEvaled = OSet(j, i), extraEvaled = 8) + check(j, expValue = 3, expEvaled = Agg(j, i), extraEvaled = 8) b.counter += 1 // increment value by 4 because `b` is used four times on the way to `j` - check(j, expValue = 7, expEvaled = OSet(b, e, f, i, j), extraEvaled = 20) + check(j, expValue = 7, expEvaled = Agg(b, e, f, i, j), extraEvaled = 20) } } @@ -159,16 +159,16 @@ object EvaluationTests extends TestSuite{ import separateGroups._ val checker = new Checker(mapping(separateGroups)) - val evaled1 = checker.evaluator.evaluate(OSet(right, left)) + val evaled1 = checker.evaluator.evaluate(Agg(right, left)) val filtered1 = evaled1.evaluated.filter(_.isInstanceOf[Target[_]]) - assert(filtered1 == OSet(change, left, right)) - val evaled2 = checker.evaluator.evaluate(OSet(right, left)) + assert(filtered1 == Agg(change, left, right)) + val evaled2 = checker.evaluator.evaluate(Agg(right, left)) val filtered2 = evaled2.evaluated.filter(_.isInstanceOf[Target[_]]) - assert(filtered2 == OSet()) + assert(filtered2 == Agg()) change.counter += 1 - val evaled3 = checker.evaluator.evaluate(OSet(right, left)) + val evaled3 = checker.evaluator.evaluate(Agg(right, left)) val filtered3 = evaled3.evaluated.filter(_.isInstanceOf[Target[_]]) - assert(filtered3 == OSet(change, right)) + assert(filtered3 == Agg(change, right)) } @@ -176,16 +176,16 @@ object EvaluationTests extends TestSuite{ import triangleTask._ val checker = new Checker(mapping(triangleTask)) - checker(right, 3, OSet(left, right), extraEvaled = -1) - checker(left, 1, OSet(), extraEvaled = -1) + checker(right, 3, Agg(left, right), extraEvaled = -1) + checker(left, 1, Agg(), extraEvaled = -1) } 'multiTerminalGroup - { import multiTerminalGroup._ val checker = new Checker(mapping(multiTerminalGroup)) - checker(right, 1, OSet(right), extraEvaled = -1) - checker(left, 1, OSet(left), extraEvaled = -1) + checker(right, 1, Agg(right), extraEvaled = -1) + checker(left, 1, Agg(left), extraEvaled = -1) } 'multiTerminalBoundary - { @@ -193,15 +193,15 @@ object EvaluationTests extends TestSuite{ import multiTerminalBoundary._ val checker = new Checker(mapping(multiTerminalBoundary)) - checker(task2, 4, OSet(right, left), extraEvaled = -1, secondRunNoOp = false) - checker(task2, 4, OSet(), extraEvaled = -1, secondRunNoOp = false) + checker(task2, 4, Agg(right, left), extraEvaled = -1, secondRunNoOp = false) + checker(task2, 4, Agg(), extraEvaled = -1, secondRunNoOp = false) } 'overrideSuperTask - { import canOverrideSuper._ val checker = new Checker(mapping(canOverrideSuper)) - checker(foo, Seq("base", "object"), OSet(foo), extraEvaled = -1) + checker(foo, Seq("base", "object"), Agg(foo), extraEvaled = -1) } 'tasksAreUncached - { @@ -239,12 +239,12 @@ object EvaluationTests extends TestSuite{ // cached target val check = new Checker(mapping(build)) assert(leftCount == 0, rightCount == 0) - check(down, expValue = 10101, expEvaled = OSet(up, right, down), extraEvaled = 8) + check(down, expValue = 10101, expEvaled = Agg(up, right, down), extraEvaled = 8) assert(leftCount == 1, middleCount == 1, rightCount == 1) // If the upstream `up` doesn't change, the entire block of tasks // doesn't need to recompute - check(down, expValue = 10101, expEvaled = OSet()) + check(down, expValue = 10101, expEvaled = Agg()) assert(leftCount == 1, middleCount == 1, rightCount == 1) // But if `up` changes, the entire block of downstream tasks needs to @@ -252,19 +252,19 @@ object EvaluationTests extends TestSuite{ // because tasks have no cached value that can be used. `right`, which // is a cached Target, does not recompute up.inputs(0).asInstanceOf[Test].counter += 1 - check(down, expValue = 10102, expEvaled = OSet(up, down), extraEvaled = 6) + check(down, expValue = 10102, expEvaled = Agg(up, down), extraEvaled = 6) assert(leftCount == 2, middleCount == 2, rightCount == 1) // Running the tasks themselves results in them being recomputed every // single time, even if nothing changes - check(left, expValue = 2, expEvaled = OSet(), extraEvaled = 1, secondRunNoOp = false) + check(left, expValue = 2, expEvaled = Agg(), extraEvaled = 1, secondRunNoOp = false) assert(leftCount == 3, middleCount == 2, rightCount == 1) - check(left, expValue = 2, expEvaled = OSet(), extraEvaled = 1, secondRunNoOp = false) + check(left, expValue = 2, expEvaled = Agg(), extraEvaled = 1, secondRunNoOp = false) assert(leftCount == 4, middleCount == 2, rightCount == 1) - check(middle, expValue = 100, expEvaled = OSet(), extraEvaled = 2, secondRunNoOp = false) + check(middle, expValue = 100, expEvaled = Agg(), extraEvaled = 2, secondRunNoOp = false) assert(leftCount == 4, middleCount == 3, rightCount == 1) - check(middle, expValue = 100, expEvaled = OSet(), extraEvaled = 2, secondRunNoOp = false) + check(middle, expValue = 100, expEvaled = Agg(), extraEvaled = 2, secondRunNoOp = false) assert(leftCount == 4, middleCount == 4, rightCount == 1) } } diff --git a/core/src/test/scala/mill/eval/FailureTests.scala b/core/src/test/scala/mill/eval/FailureTests.scala index ef206740..c1ca1533 100644 --- a/core/src/test/scala/mill/eval/FailureTests.scala +++ b/core/src/test/scala/mill/eval/FailureTests.scala @@ -4,7 +4,7 @@ import mill.define.Target import mill.discover.Discovered import mill.discover.Discovered.mapping import mill.util.DummyLogger -import mill.util.Strict.OSet +import mill.util.Strict.Agg import utest._ import utest.framework.TestPath @@ -19,7 +19,7 @@ object FailureTests extends TestSuite{ def apply(target: Target[_], expectedFailCount: Int, expectedRawValues: Seq[Result[_]]) = { - val res = evaluator.evaluate(OSet(target)) + val res = evaluator.evaluate(Agg(target)) val cleaned = res.rawValues.map{ case Result.Exception(ex, _) => Result.Exception(ex, Nil) diff --git a/core/src/test/scala/mill/eval/JavaCompileJarTests.scala b/core/src/test/scala/mill/eval/JavaCompileJarTests.scala index 8105f2fa..f40fb798 100644 --- a/core/src/test/scala/mill/eval/JavaCompileJarTests.scala +++ b/core/src/test/scala/mill/eval/JavaCompileJarTests.scala @@ -8,7 +8,7 @@ import mill.modules.Jvm import mill.util.Ctx.DestCtx import mill.{Module, T} import mill.util.{DummyLogger, Loose, TestUtil} -import mill.util.Strict.OSet +import mill.util.Strict.Agg import utest._ import mill._ @@ -41,7 +41,7 @@ object JavaCompileJarTests extends TestSuite{ def resourceRoot = T.source{ resourceRootPath } def allSources = T{ ls.rec(sourceRoot().path).map(PathRef(_)) } def classFiles = T{ compileAll(allSources()) } - def jar = T{ Jvm.createJar(Loose.OSet(resourceRoot().path, classFiles().path)) } + def jar = T{ Jvm.createJar(Loose.Agg(resourceRoot().path, classFiles().path)) } def run(mainClsName: String) = T.command{ %%('java, "-cp", classFiles().path, mainClsName) @@ -53,7 +53,7 @@ object JavaCompileJarTests extends TestSuite{ def eval[T](t: Task[T]) = { val evaluator = new Evaluator(workspacePath, pwd, mapping, DummyLogger) - val evaluated = evaluator.evaluate(OSet(t)) + val evaluated = evaluator.evaluate(Agg(t)) if (evaluated.failing.keyCount == 0){ Right(Tuple2( @@ -68,7 +68,7 @@ object JavaCompileJarTests extends TestSuite{ } } - def check(targets: OSet[Task[_]], expected: OSet[Task[_]]) = { + def check(targets: Agg[Task[_]], expected: Agg[Task[_]]) = { val evaluator = new Evaluator(workspacePath, pwd, mapping, DummyLogger) val evaluated = evaluator.evaluate(targets) @@ -83,47 +83,47 @@ object JavaCompileJarTests extends TestSuite{ check( - targets = OSet(jar), - expected = OSet(allSources, classFiles, jar) + targets = Agg(jar), + expected = Agg(allSources, classFiles, jar) ) // Re-running with no changes results in nothing being evaluated - check(targets = OSet(jar), expected = OSet()) + check(targets = Agg(jar), expected = Agg()) // Appending an empty string gets ignored due to file-content hashing append(sourceRootPath / "Foo.java", "") - check(targets = OSet(jar), expected = OSet()) + check(targets = Agg(jar), expected = Agg()) // Appending whitespace forces a recompile, but the classfilesend up // exactly the same so no re-jarring. append(sourceRootPath / "Foo.java", " ") // Note that `sourceRoot` and `resourceRoot` never turn up in the `expected` // list, because they are `Source`s not `Target`s - check(targets = OSet(jar), expected = OSet(/*sourceRoot, */allSources, classFiles)) + check(targets = Agg(jar), expected = Agg(/*sourceRoot, */allSources, classFiles)) // Appending a new class changes the classfiles, which forces us to // re-create the final jar append(sourceRootPath / "Foo.java", "\nclass FooTwo{}") - check(targets = OSet(jar), expected = OSet(allSources, classFiles, jar)) + check(targets = Agg(jar), expected = Agg(allSources, classFiles, jar)) // Tweaking the resources forces rebuild of the final jar, without // recompiling classfiles append(resourceRootPath / "hello.txt", " ") - check(targets = OSet(jar), expected = OSet(jar)) + check(targets = Agg(jar), expected = Agg(jar)) // Asking for an intermediate target forces things to be build up to that // target only; these are re-used for any downstream targets requested append(sourceRootPath / "Bar.java", "\nclass BarTwo{}") append(resourceRootPath / "hello.txt", " ") - check(targets = OSet(classFiles), expected = OSet(allSources, classFiles)) - check(targets = OSet(jar), expected = OSet(jar)) - check(targets = OSet(allSources), expected = OSet()) + check(targets = Agg(classFiles), expected = Agg(allSources, classFiles)) + check(targets = Agg(jar), expected = Agg(jar)) + check(targets = Agg(allSources), expected = Agg()) append(sourceRootPath / "Bar.java", "\nclass BarThree{}") append(resourceRootPath / "hello.txt", " ") - check(targets = OSet(resourceRoot), expected = OSet()) - check(targets = OSet(allSources), expected = OSet(allSources)) - check(targets = OSet(jar), expected = OSet(classFiles, jar)) + check(targets = Agg(resourceRoot), expected = Agg()) + check(targets = Agg(allSources), expected = Agg(allSources)) + check(targets = Agg(jar), expected = Agg(classFiles, jar)) val jarContents = %%('jar, "-tf", workspacePath/'jar/'dest)(workspacePath).out.string val expectedJarContents = diff --git a/core/src/test/scala/mill/util/TestEvaluator.scala b/core/src/test/scala/mill/util/TestEvaluator.scala index 3f6086ba..be486d4d 100644 --- a/core/src/test/scala/mill/util/TestEvaluator.scala +++ b/core/src/test/scala/mill/util/TestEvaluator.scala @@ -4,14 +4,14 @@ import ammonite.ops.Path import mill.define.{Input, Target, Task} import mill.discover.{Discovered, Mirror} import mill.eval.{Evaluator, Result} -import mill.util.Strict.OSet +import mill.util.Strict.Agg class TestEvaluator(mapping: Discovered.Mapping[_], workspacePath: Path, basePath: Path){ val evaluator = new Evaluator(workspacePath, basePath, mapping, DummyLogger) def apply[T](t: Task[T]): Either[Result.Failing, (T, Int)] = { - val evaluated = evaluator.evaluate(OSet(t)) + val evaluated = evaluator.evaluate(Agg(t)) if (evaluated.failing.keyCount == 0) { Right( diff --git a/core/src/test/scala/mill/util/TestUtil.scala b/core/src/test/scala/mill/util/TestUtil.scala index 3cc945db..ca6097a1 100644 --- a/core/src/test/scala/mill/util/TestUtil.scala +++ b/core/src/test/scala/mill/util/TestUtil.scala @@ -4,7 +4,7 @@ import ammonite.main.Router.Overrides import mill.define._ import mill.eval.Result import utest.assert -import mill.util.Strict.OSet +import mill.util.Strict.Agg import scala.collection.mutable object TestUtil { @@ -56,7 +56,7 @@ object TestUtil { } - def checkTopological(targets: OSet[Task[_]]) = { + def checkTopological(targets: Agg[Task[_]]) = { val seen = mutable.Set.empty[Task[_]] for(t <- targets.indexed.reverseIterator){ seen.add(t) diff --git a/integration/src/test/resources/acyclic/build.sc b/integration/src/test/resources/acyclic/build.sc index 094893f5..140e5dc6 100644 --- a/integration/src/test/resources/acyclic/build.sc +++ b/integration/src/test/resources/acyclic/build.sc @@ -24,12 +24,12 @@ class AcyclicModule(val crossScalaVersion: String) extends CrossSbtModule with P ) ) - def ivyDeps = OSet( + def ivyDeps = Agg( Dep.Java("org.scala-lang", "scala-compiler", scalaVersion()) ) object test extends Tests{ def forkWorkingDir = ammonite.ops.pwd / 'target / 'workspace / 'acyclic - def ivyDeps = OSet( + def ivyDeps = Agg( Dep("com.lihaoyi", "utest", "0.6.0") ) def testFramework = "utest.runner.Framework" diff --git a/integration/src/test/resources/better-files/build.sc b/integration/src/test/resources/better-files/build.sc index fe11f1b8..de0f6495 100644 --- a/integration/src/test/resources/better-files/build.sc +++ b/integration/src/test/resources/better-files/build.sc @@ -54,7 +54,7 @@ trait BetterFilesModule extends SbtModule{ def projectDeps = if (this == core.test) super.projectDeps else super.projectDeps ++ Seq(core.test) - def ivyDeps = OSet(Dep("org.scalatest", "scalatest", "3.0.4")) + def ivyDeps = Agg(Dep("org.scalatest", "scalatest", "3.0.4")) def testFramework = "org.scalatest.tools.Framework" } } @@ -63,17 +63,17 @@ object core extends BetterFilesModule object akka extends BetterFilesModule{ def projectDeps = Seq(core) - def ivyDeps = OSet(Dep("com.typesafe.akka", "akka-actor", "2.5.6")) + def ivyDeps = Agg(Dep("com.typesafe.akka", "akka-actor", "2.5.6")) } object shapeless extends BetterFilesModule{ def projectDeps = Seq(core) - def ivyDeps = OSet(Dep("com.chuusai", "shapeless", "2.3.2")) + def ivyDeps = Agg(Dep("com.chuusai", "shapeless", "2.3.2")) } object benchmarks extends BetterFilesModule{ def projectDeps = Seq(core) - def ivyDeps = OSet( + def ivyDeps = Agg( Dep.Java("commons-io", "commons-io", "2.5") // "fastjavaio" % "fastjavaio" % "1.0" from "https://github.com/williamfiset/FastJavaIO/releases/download/v1.0/fastjavaio.jar" ) diff --git a/integration/src/test/resources/jawn/build.sc b/integration/src/test/resources/jawn/build.sc index a90d93b5..e76437b7 100644 --- a/integration/src/test/resources/jawn/build.sc +++ b/integration/src/test/resources/jawn/build.sc @@ -16,7 +16,7 @@ class JawnModule(crossVersion: String) extends mill.Module{ def testProjectDeps: Seq[TestModule] = Nil object test extends Tests{ def projectDeps = super.projectDeps ++ testProjectDeps - def ivyDeps = OSet( + def ivyDeps = Agg( Dep("org.scalatest", "scalatest", "3.0.3"), Dep("org.scalacheck", "scalacheck", "1.13.5") ) @@ -35,7 +35,7 @@ class JawnModule(crossVersion: String) extends mill.Module{ } class Support(ivyDeps0: Dep*)(implicit ctx: mill.Module.Ctx) extends JawnModule{ def projectDeps = Seq[Module](parser) - def ivyDeps = OSet.from(ivyDeps0) + def ivyDeps = Agg.from(ivyDeps0) } object support extends mill.Module{ object argonaut extends Support(Dep("io.argonaut", "argonaut", "6.2")) @@ -44,9 +44,9 @@ class JawnModule(crossVersion: String) extends mill.Module{ object play extends Support(){ def ivyDeps = mill.T{ scalaBinaryVersion() match{ - case "2.10" => OSet(Dep("com.typesafe.play", "play-json", "2.4.11")) - case "2.11" => OSet(Dep("com.typesafe.play", "play-json", "2.5.15")) - case _ => OSet(Dep("com.typesafe.play", "play-json", "2.6.0")) + case "2.10" => Agg(Dep("com.typesafe.play", "play-json", "2.4.11")) + case "2.11" => Agg(Dep("com.typesafe.play", "play-json", "2.5.15")) + case _ => Agg(Dep("com.typesafe.play", "play-json", "2.6.0")) } } } diff --git a/scalajslib/src/main/scala/mill/scalajslib/Lib.scala b/scalajslib/src/main/scala/mill/scalajslib/Lib.scala index 744bb262..6a85cf0c 100644 --- a/scalajslib/src/main/scala/mill/scalajslib/Lib.scala +++ b/scalajslib/src/main/scala/mill/scalajslib/Lib.scala @@ -21,7 +21,7 @@ object Lib { def scalaJSLinkerIvyDep(scalaJSVersion: String): Dep = Dep("com.lihaoyi", s"mill-jsbridge_${scalaJSVersion.replace('.', '_')}", "0.1-SNAPSHOT") - def scalaJSLinkerBridge(classPath: Loose.OSet[Path]): ScalaJSLinkerBridge = { + def scalaJSLinkerBridge(classPath: Loose.Agg[Path]): ScalaJSLinkerBridge = { val classloaderSig = classPath.map(p => p.toString().hashCode + p.mtime.toMillis).sum LinkerBridge.scalaInstanceCache match { case Some((`classloaderSig`, linker)) => linker @@ -44,7 +44,7 @@ object Lib { def link(main: Option[String], inputPaths: Seq[Path], - libraries: Loose.OSet[Path], + libraries: Loose.Agg[Path], linker: ScalaJSLinkerBridge, mode: OptimizeMode) (implicit ctx: Ctx.DestCtx): PathRef = { diff --git a/scalajslib/src/main/scala/mill/scalajslib/ScalaJSModule.scala b/scalajslib/src/main/scala/mill/scalajslib/ScalaJSModule.scala index 03c4e216..d26c6a70 100644 --- a/scalajslib/src/main/scala/mill/scalajslib/ScalaJSModule.scala +++ b/scalajslib/src/main/scala/mill/scalajslib/ScalaJSModule.scala @@ -27,12 +27,12 @@ trait ScalaJSModule extends scalalib.Module { outer => def scalaJSBridgeVersion = T{ scalaJSVersion().split('.').dropRight(1).mkString(".") } - def scalaJSLinkerClasspath: T[Loose.OSet[PathRef]] = T{ + def scalaJSLinkerClasspath: T[Loose.Agg[PathRef]] = T{ val jsBridgeKey = "MILL_SCALAJS_BRIDGE_" + scalaJSBridgeVersion().replace('.', '_') val jsBridgePath = sys.props(jsBridgeKey) if (jsBridgePath != null) { Success( - Loose.OSet.from( + Loose.Agg.from( jsBridgePath.split(File.pathSeparator).map(f => PathRef(Path(f), quick = true)) ) ) @@ -58,9 +58,9 @@ trait ScalaJSModule extends scalalib.Module { outer => link(mainClass(), Seq(compile().classes.path), compileDepClasspath().map(_.path), linker, FullOpt) } - override def scalacPluginIvyDeps = T{ Loose.OSet(Dep.Point("org.scala-js", "scalajs-compiler", scalaJSVersion())) } + override def scalacPluginIvyDeps = T{ Loose.Agg(Dep.Point("org.scala-js", "scalajs-compiler", scalaJSVersion())) } - override def ivyDeps = T{ Loose.OSet(Dep("org.scala-js", "scalajs-library", scalaJSVersion())) } + override def ivyDeps = T{ Loose.Agg(Dep("org.scala-js", "scalajs-library", scalaJSVersion())) } // publish artifact with name "mill_sjs0.6.4_2.12" instead of "mill_sjs0.6_2.12" def crossFullScalaJSVersion: T[Boolean] = false diff --git a/scalalib/src/main/scala/mill/scalalib/GenIdea.scala b/scalalib/src/main/scala/mill/scalalib/GenIdea.scala index cd664495..45067751 100644 --- a/scalalib/src/main/scala/mill/scalalib/GenIdea.scala +++ b/scalalib/src/main/scala/mill/scalalib/GenIdea.scala @@ -6,7 +6,7 @@ import mill.discover.{Discovered, Mirror} import mill.eval.{Evaluator, PathRef} import mill.util.Ctx.{LoaderCtx, LogCtx} import mill.util.{PrintLogger} -import mill.util.Strict.OSet +import mill.util.Strict.Agg object GenIdea { @@ -36,7 +36,7 @@ object GenIdea { val resolved = for((path, mod) <- modules) yield { val Seq(resolvedCp: Seq[PathRef], resolvedSrcs: Seq[PathRef]) = - evaluator.evaluate(OSet(mod.externalCompileDepClasspath, mod.externalCompileDepSources)) + evaluator.evaluate(Agg(mod.externalCompileDepClasspath, mod.externalCompileDepSources)) .values (path, resolvedCp.map(_.path).filter(_.ext == "jar") ++ resolvedSrcs.map(_.path), mod) @@ -74,7 +74,7 @@ object GenIdea { val moduleFiles = resolved.map{ case (path, resolvedDeps, mod) => val Seq(sourcesPathRef: PathRef, generatedSourcePathRefs: Seq[PathRef], allSourcesPathRefs: Seq[PathRef]) = - evaluator.evaluate(OSet(mod.sources, mod.generatedSources, mod.allSources)).values + evaluator.evaluate(Agg(mod.sources, mod.generatedSources, mod.allSources)).values val generatedSourcePaths = generatedSourcePathRefs.map(_.path) val normalSourcePaths = (allSourcesPathRefs.map(_.path).toSet -- generatedSourcePaths.toSet).toSeq diff --git a/scalalib/src/main/scala/mill/scalalib/Lib.scala b/scalalib/src/main/scala/mill/scalalib/Lib.scala index 54b1a817..8a98d724 100644 --- a/scalalib/src/main/scala/mill/scalalib/Lib.scala +++ b/scalalib/src/main/scala/mill/scalalib/Lib.scala @@ -10,7 +10,7 @@ import coursier.{Cache, Fetch, MavenRepository, Repository, Resolution, Module = import mill.define.Worker import mill.eval.{PathRef, Result} import mill.util.{Ctx} -import mill.util.Loose.OSet +import mill.util.Loose.Agg import sbt.internal.inc._ import sbt.internal.util.{ConsoleOut, MainAppender} import sbt.util.LogExchange @@ -39,7 +39,7 @@ object Lib{ Locate.definesClass(classpathEntry) } - def grepJar(classPath: OSet[Path], s: String) = { + def grepJar(classPath: Agg[Path], s: String) = { classPath .find(_.toString.endsWith(s)) .getOrElse(throw new Exception("Cannot find " + s)) @@ -48,13 +48,13 @@ object Lib{ def compileScala(zincWorker: ZincWorker, scalaVersion: String, - sources: OSet[Path], - compileClasspath: OSet[Path], - compilerClasspath: OSet[Path], - pluginClasspath: OSet[Path], + sources: Agg[Path], + compileClasspath: Agg[Path], + compilerClasspath: Agg[Path], + pluginClasspath: Agg[Path], compilerBridge: Path, scalacOptions: Seq[String], - scalacPluginClasspath: OSet[Path], + scalacPluginClasspath: Agg[Path], javacOptions: Seq[String], upstreamCompileOutput: Seq[CompilationResult]) (implicit ctx: Ctx): CompilationResult = { @@ -173,7 +173,7 @@ object Lib{ scalaVersion: String, scalaBinaryVersion: String, deps: TraversableOnce[Dep], - sources: Boolean = false): Result[OSet[PathRef]] = { + sources: Boolean = false): Result[Agg[PathRef]] = { val flattened = deps.map{ case Dep.Java(dep) => dep case Dep.Scala(dep) => @@ -207,16 +207,16 @@ object Lib{ .unsafePerformSync .flatMap(_.toOption) - OSet.from( + Agg.from( localArtifacts.map(p => PathRef(Path(p), quick = true)).filter(_.path.ext == "jar") ) } } - def scalaCompilerIvyDeps(scalaVersion: String) = OSet[Dep]( + def scalaCompilerIvyDeps(scalaVersion: String) = Agg[Dep]( Dep.Java("org.scala-lang", "scala-compiler", scalaVersion), Dep.Java("org.scala-lang", "scala-reflect", scalaVersion) ) - def scalaRuntimeIvyDeps(scalaVersion: String) = OSet[Dep]( + def scalaRuntimeIvyDeps(scalaVersion: String) = Agg[Dep]( Dep.Java("org.scala-lang", "scala-library", scalaVersion) ) def compilerBridgeIvyDep(scalaVersion: String) = diff --git a/scalalib/src/main/scala/mill/scalalib/MiscModule.scala b/scalalib/src/main/scala/mill/scalalib/MiscModule.scala index 26609bcd..5e28c34b 100644 --- a/scalalib/src/main/scala/mill/scalalib/MiscModule.scala +++ b/scalalib/src/main/scala/mill/scalalib/MiscModule.scala @@ -4,16 +4,16 @@ package scalalib import mill.define.Cross.Resolver import mill.define.{Cross, Task} import mill.eval.{PathRef, Result} -import mill.util.Loose.OSet +import mill.util.Loose.Agg trait SbtModule extends Module { outer => - override def sources = T.input{ OSet(PathRef(basePath / 'src / 'main / 'scala)) } - override def resources = T.input{ OSet(PathRef(basePath / 'src / 'main / 'resources)) } + override def sources = T.input{ Agg(PathRef(basePath / 'src / 'main / 'scala)) } + override def resources = T.input{ Agg(PathRef(basePath / 'src / 'main / 'resources)) } trait Tests extends super.Tests { override def basePath = outer.basePath - override def sources = T.input{ OSet(PathRef(basePath / 'src / 'test / 'scala)) } - override def resources = T.input{ OSet(PathRef(basePath / 'src / 'test / 'resources)) } + override def sources = T.input{ Agg(PathRef(basePath / 'src / 'test / 'scala)) } + override def resources = T.input{ Agg(PathRef(basePath / 'src / 'test / 'resources)) } } } @@ -46,7 +46,7 @@ trait CrossSbtModule extends SbtModule { outer => } } - override def resources = T.input{ OSet(PathRef(basePath / 'src / 'main / 'resources)) } + override def resources = T.input{ Agg(PathRef(basePath / 'src / 'main / 'resources)) } trait Tests extends super.Tests { override def basePath = outer.basePath override def sources = T.input{ @@ -55,7 +55,7 @@ trait CrossSbtModule extends SbtModule { outer => s => PathRef{ basePath / 'src / 'test / s"scala-$s" } } } - override def resources = T.input{ OSet(PathRef(basePath / 'src / 'test / 'resources)) } + override def resources = T.input{ Agg(PathRef(basePath / 'src / 'test / 'resources)) } } } diff --git a/scalalib/src/main/scala/mill/scalalib/Module.scala b/scalalib/src/main/scala/mill/scalalib/Module.scala index 2a7d6edb..3b63b280 100644 --- a/scalalib/src/main/scala/mill/scalalib/Module.scala +++ b/scalalib/src/main/scala/mill/scalalib/Module.scala @@ -10,7 +10,7 @@ import mill.modules.Jvm import mill.modules.Jvm.{createAssembly, createJar, interactiveSubprocess, subprocess} import Lib._ import mill.define.Cross.Resolver -import mill.util.Loose.OSet +import mill.util.Loose.Agg import sbt.testing.Status /** @@ -26,10 +26,10 @@ trait Module extends mill.Module with TaskModule { outer => def mainClass: T[Option[String]] = None def scalaBinaryVersion = T{ scalaVersion().split('.').dropRight(1).mkString(".") } - def ivyDeps = T{ OSet.empty[Dep] } - def compileIvyDeps = T{ OSet.empty[Dep] } - def scalacPluginIvyDeps = T{ OSet.empty[Dep] } - def runIvyDeps = T{ OSet.empty[Dep] } + def ivyDeps = T{ Agg.empty[Dep] } + def compileIvyDeps = T{ Agg.empty[Dep] } + def scalacPluginIvyDeps = T{ Agg.empty[Dep] } + def runIvyDeps = T{ Agg.empty[Dep] } def scalacOptions = T{ Seq.empty[String] } def javacOptions = T{ Seq.empty[String] } @@ -40,7 +40,7 @@ trait Module extends mill.Module with TaskModule { outer => ) def projectDeps = Seq.empty[Module] - def depClasspath = T{ OSet.empty[PathRef] } + def depClasspath = T{ Agg.empty[PathRef] } def upstreamRunClasspath = T{ @@ -58,7 +58,7 @@ trait Module extends mill.Module with TaskModule { outer => Task.traverse(projectDeps)(_.compileDepClasspath)().flatten } - def resolveDeps(deps: Task[OSet[Dep]], sources: Boolean = false) = T.task{ + def resolveDeps(deps: Task[Agg[Dep]], sources: Boolean = false) = T.task{ resolveDependencies( repositories, scalaVersion(), @@ -68,15 +68,15 @@ trait Module extends mill.Module with TaskModule { outer => ) } - def externalCompileDepClasspath: T[OSet[PathRef]] = T{ - OSet.from(Task.traverse(projectDeps)(_.externalCompileDepClasspath)().flatten) ++ + def externalCompileDepClasspath: T[Agg[PathRef]] = T{ + Agg.from(Task.traverse(projectDeps)(_.externalCompileDepClasspath)().flatten) ++ resolveDeps( T.task{ivyDeps() ++ compileIvyDeps() ++ scalaCompilerIvyDeps(scalaVersion())} )() } - def externalCompileDepSources: T[OSet[PathRef]] = T{ - OSet.from(Task.traverse(projectDeps)(_.externalCompileDepSources)().flatten) ++ + def externalCompileDepSources: T[Agg[PathRef]] = T{ + Agg.from(Task.traverse(projectDeps)(_.externalCompileDepSources)().flatten) ++ resolveDeps( T.task{ivyDeps() ++ compileIvyDeps() ++ scalaCompilerIvyDeps(scalaVersion())}, sources = true @@ -87,7 +87,7 @@ trait Module extends mill.Module with TaskModule { outer => * Things that need to be on the classpath in order for this code to compile; * might be less than the runtime classpath */ - def compileDepClasspath: T[OSet[PathRef]] = T{ + def compileDepClasspath: T[Agg[PathRef]] = T{ upstreamCompileClasspath() ++ depClasspath() } @@ -119,7 +119,7 @@ trait Module extends mill.Module with TaskModule { outer => } } - def scalacPluginClasspath: T[OSet[PathRef]] = + def scalacPluginClasspath: T[Agg[PathRef]] = resolveDeps( T.task{scalacPluginIvyDeps()} )() @@ -127,7 +127,7 @@ trait Module extends mill.Module with TaskModule { outer => /** * Classpath of the Scala Compiler & any compiler plugins */ - def scalaCompilerClasspath: T[OSet[PathRef]] = T{ + def scalaCompilerClasspath: T[Agg[PathRef]] = T{ resolveDeps( T.task{scalaCompilerIvyDeps(scalaVersion()) ++ scalaRuntimeIvyDeps(scalaVersion())} )() @@ -136,8 +136,8 @@ trait Module extends mill.Module with TaskModule { outer => /** * Things that need to be on the classpath in order for this code to run */ - def runDepClasspath: T[OSet[PathRef]] = T{ - OSet.from(upstreamRunClasspath().flatten) ++ + def runDepClasspath: T[Agg[PathRef]] = T{ + Agg.from(upstreamRunClasspath().flatten) ++ depClasspath() ++ resolveDeps( T.task{ivyDeps() ++ runIvyDeps() ++ scalaRuntimeIvyDeps(scalaVersion())} @@ -146,9 +146,9 @@ trait Module extends mill.Module with TaskModule { outer => def prependShellScript: T[String] = T{ "" } - def sources = T.input{ OSet(PathRef(basePath / 'src)) } - def resources = T.input{ OSet(PathRef(basePath / 'resources)) } - def generatedSources = T { OSet.empty[PathRef] } + def sources = T.input{ Agg(PathRef(basePath / 'src)) } + def resources = T.input{ Agg(PathRef(basePath / 'resources)) } + def generatedSources = T { Agg.empty[PathRef] } def allSources = T{ sources() ++ generatedSources() } def compile: T[CompilationResult] = T.persistent{ compileScala( @@ -208,7 +208,7 @@ trait Module extends mill.Module with TaskModule { outer => options = options.toSeq ) - createJar(OSet(javadocDir))(outDir / "javadoc.jar") + createJar(Agg(javadocDir))(outDir / "javadoc.jar") } def sourcesJar = T { @@ -302,7 +302,7 @@ trait TestModule extends Module with TaskModule { val (doneMsg, results) = TestRunner( testFramework(), runClasspath().map(_.path), - OSet(compile().classes.path), + Agg(compile().classes.path), args ) TestModule.handleResults(doneMsg, results) diff --git a/scalalib/src/main/scala/mill/scalalib/PublishModule.scala b/scalalib/src/main/scala/mill/scalalib/PublishModule.scala index 211c94d2..4fd8e94f 100644 --- a/scalalib/src/main/scala/mill/scalalib/PublishModule.scala +++ b/scalalib/src/main/scala/mill/scalalib/PublishModule.scala @@ -3,7 +3,7 @@ package scalalib import ammonite.ops._ import mill.eval.{PathRef, Result} -import mill.util.Loose.OSet +import mill.util.Loose.Agg /** * Configuration necessary for publishing a Scala module to Maven Central or similar */ diff --git a/scalalib/src/main/scala/mill/scalalib/TestRunner.scala b/scalalib/src/main/scala/mill/scalalib/TestRunner.scala index d129e0d4..11d9c79f 100644 --- a/scalalib/src/main/scala/mill/scalalib/TestRunner.scala +++ b/scalalib/src/main/scala/mill/scalalib/TestRunner.scala @@ -9,7 +9,7 @@ import ammonite.ops.{Path, ls, pwd} import ammonite.util.Colors import mill.util.Ctx.LogCtx import mill.util.{PrintLogger} -import mill.util.Loose.OSet +import mill.util.Loose.Agg import sbt.testing._ import upickle.Js import mill.util.JsonFormatters._ @@ -24,7 +24,7 @@ object TestRunner { Iterator.continually(zip.getNextEntry).takeWhile(_ != null).map(_.getName).filter(_.endsWith(".class")) } } - def runTests(cl: ClassLoader, framework: Framework, classpath: OSet[Path]) = { + def runTests(cl: ClassLoader, framework: Framework, classpath: Agg[Path]) = { val fingerprints = framework.fingerprints() @@ -49,8 +49,8 @@ object TestRunner { def main(args: Array[String]): Unit = { val result = apply( frameworkName = args(0), - entireClasspath = OSet.from(args(1).split(" ").map(Path(_))), - testClassfilePath = OSet.from(args(2).split(" ").map(Path(_))), + entireClasspath = Agg.from(args(1).split(" ").map(Path(_))), + testClassfilePath = Agg.from(args(2).split(" ").map(Path(_))), args = args(3) match{ case "" => Nil case x => x.split(" ").toList } )(new PrintLogger( args(5) == "true", @@ -70,8 +70,8 @@ object TestRunner { System.exit(0) } def apply(frameworkName: String, - entireClasspath: OSet[Path], - testClassfilePath: OSet[Path], + entireClasspath: Agg[Path], + testClassfilePath: Agg[Path], args: Seq[String]) (implicit ctx: LogCtx): (String, Seq[Result]) = { val outerClassLoader = getClass.getClassLoader diff --git a/scalalib/src/main/scala/mill/scalalib/publish/Ivy.scala b/scalalib/src/main/scala/mill/scalalib/publish/Ivy.scala index 288b63d0..b0b6443e 100644 --- a/scalalib/src/main/scala/mill/scalalib/publish/Ivy.scala +++ b/scalalib/src/main/scala/mill/scalalib/publish/Ivy.scala @@ -1,6 +1,6 @@ package mill.scalalib.publish -import mill.util.Loose.OSet +import mill.util.Loose.Agg import scala.xml.PrettyPrinter @@ -10,7 +10,7 @@ object Ivy { def apply( artifact: Artifact, - dependencies: OSet[Dependency] + dependencies: Agg[Dependency] ): String = { val xml = <ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra"> diff --git a/scalalib/src/main/scala/mill/scalalib/publish/Pom.scala b/scalalib/src/main/scala/mill/scalalib/publish/Pom.scala index c1ce3e2a..74dc6e8f 100644 --- a/scalalib/src/main/scala/mill/scalalib/publish/Pom.scala +++ b/scalalib/src/main/scala/mill/scalalib/publish/Pom.scala @@ -1,6 +1,6 @@ package mill.scalalib.publish -import mill.util.Loose.OSet +import mill.util.Loose.Agg import scala.xml.{Elem, NodeSeq, PrettyPrinter} @@ -10,7 +10,7 @@ object Pom { //TODO - not only jar packaging support? def apply(artifact: Artifact, - dependencies: OSet[Dependency], + dependencies: Agg[Dependency], name: String, pomSettings: PomSettings): String = { val xml = diff --git a/scalalib/src/test/scala/mill/scalalib/ResolveDepsTests.scala b/scalalib/src/test/scala/mill/scalalib/ResolveDepsTests.scala index c4404fe6..f28df152 100644 --- a/scalalib/src/test/scala/mill/scalalib/ResolveDepsTests.scala +++ b/scalalib/src/test/scala/mill/scalalib/ResolveDepsTests.scala @@ -4,35 +4,35 @@ import coursier.Cache import coursier.maven.MavenRepository import mill.eval.Result.{Failure, Success} import mill.eval.{PathRef, Result} -import mill.util.Loose.OSet +import mill.util.Loose.Agg import utest._ object ResolveDepsTests extends TestSuite { val repos = Seq(Cache.ivy2Local, MavenRepository("https://repo1.maven.org/maven2")) - def evalDeps(deps: OSet[Dep]): Result[OSet[PathRef]] = Lib.resolveDependencies(repos, "2.12.4", "2.12", deps) + def evalDeps(deps: Agg[Dep]): Result[Agg[PathRef]] = Lib.resolveDependencies(repos, "2.12.4", "2.12", deps) val tests = Tests { 'resolveValidDeps - { - val deps = OSet(Dep("com.lihaoyi", "pprint", "0.5.3")) + val deps = Agg(Dep("com.lihaoyi", "pprint", "0.5.3")) val Success(paths) = evalDeps(deps) assert(paths.nonEmpty) } 'errOnInvalidOrgDeps - { - val deps = OSet(Dep("xxx.yyy.invalid", "pprint", "0.5.3")) + val deps = Agg(Dep("xxx.yyy.invalid", "pprint", "0.5.3")) val Failure(errMsg) = evalDeps(deps) assert(errMsg.contains("xxx.yyy.invalid")) } 'errOnInvalidVersionDeps - { - val deps = OSet(Dep("com.lihaoyi", "pprint", "invalid.version.num")) + val deps = Agg(Dep("com.lihaoyi", "pprint", "invalid.version.num")) val Failure(errMsg) = evalDeps(deps) assert(errMsg.contains("invalid.version.num")) } 'errOnPartialSuccess - { - val deps = OSet(Dep("com.lihaoyi", "pprint", "0.5.3"), Dep("fake", "fake", "fake")) + val deps = Agg(Dep("com.lihaoyi", "pprint", "0.5.3"), Dep("fake", "fake", "fake")) val Failure(errMsg) = evalDeps(deps) assert(errMsg.contains("fake")) } @@ -63,7 +63,7 @@ def generateEval(dir: Path) = { val extract = uppercases.zipWithIndex.map { case (t, i) => s"result($i).asInstanceOf[$t]" }.mkString(", ") s"""def eval[$typeArgs]($parameters):($typeArgs) = { - | val result = evaluator.evaluate(OSet($zipArgs)).values + | val result = evaluator.evaluate(Agg($zipArgs)).values | (${extract}) |} """.stripMargin @@ -74,7 +74,7 @@ def generateEval(dir: Path) = { s"""package mill.main |import mill.eval.Evaluator |import mill.define.Task - |import mill.util.Strict.OSet + |import mill.util.Strict.Agg |class EvalGenerated(evaluator: Evaluator[_]) { | type TT[+X] = Task[X] | ${(1 to 22).map(generate).mkString("\n")} |