diff options
Diffstat (limited to 'scalalib/src')
9 files changed, 59 insertions, 59 deletions
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")) } |