diff --git a/build.mill.scala b/build.mill.scala index 5fab48f9b9..742dd18fad 100644 --- a/build.mill.scala +++ b/build.mill.scala @@ -41,7 +41,6 @@ import mill.api.Loose import scalalib.{publish => _, _} import mill.contrib.bloop.Bloop import mill.testrunner.TestResult -import os.{CommandResult, Path} import _root_.scala.util.{Properties, Using} @@ -57,35 +56,35 @@ trait CrossScalaDefault { _: mill.define.Cross[_] => } trait CrossScalaDefaultToInternal extends CrossScalaDefault { _: mill.define.Cross[_] => - def crossScalaDefaultVersion: String = Scala.defaultInternal + override def crossScalaDefaultVersion: String = Scala.defaultInternal } trait CrossScalaDefaultToRunner extends CrossScalaDefault { _: mill.define.Cross[_] => - def crossScalaDefaultVersion: String = Scala.runnerScala3 + override def crossScalaDefaultVersion: String = Scala.runnerScala3 } // Publish a bootstrapped, executable jar for a restricted environments object cliBootstrapped extends ScalaCliPublishModule { - override def unmanagedClasspath: Target[Agg[PathRef]] = + override def unmanagedClasspath: T[Agg[PathRef]] = Task(cli(Scala.defaultInternal).nativeImageClassPath()) - override def jar: Target[PathRef] = assembly() + override def jar: T[PathRef] = assembly() import mill.scalalib.Assembly override def prependShellScript: T[String] = Task("") - override def mainClass: Target[Option[String]] = Some("scala.cli.ScalaCli") + override def mainClass: T[Option[String]] = Some("scala.cli.ScalaCli") override def assemblyRules: Seq[Assembly.Rule] = Seq( Assembly.Rule.ExcludePattern(".*\\.tasty"), Assembly.Rule.ExcludePattern(".*\\.semanticdb") ) ++ super.assemblyRules - override def resources: Target[Seq[PathRef]] = Task.Sources { + override def resources: T[Seq[PathRef]] = Task.Sources { super.resources() ++ Seq(propertiesFilesResources()) } - def propertiesFilesResources: Target[PathRef] = Task(persistent = true) { + def propertiesFilesResources: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "resources" val dest = dir / "java-properties" / "scala-cli-properties" @@ -121,29 +120,29 @@ object `scala3-graal-processor` extends Cross[Scala3GraalProcessor](Scala.scala3 with CrossScalaDefaultToInternal object `scala-cli-bsp` extends JavaModule with ScalaCliPublishModule { - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Seq( + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Seq( Deps.bsp4j ) - def javacOptions: Target[Seq[String]] = Task { + override def javacOptions: T[Seq[String]] = Task { super.javacOptions() ++ Seq("-target", "8", "-source", "8") } } object integration extends CliIntegration { object test extends IntegrationScalaTests { - def ivyDeps: Target[Loose.Agg[Dep]] = super.ivyDeps() ++ Seq( + override def ivyDeps: T[Loose.Agg[Dep]] = super.ivyDeps() ++ Seq( Deps.jgit, Deps.jsoup ) } object docker extends CliIntegrationDocker { object test extends ScalaCliTests { - def sources: Target[Seq[PathRef]] = Task.Sources { + override def sources: T[Seq[PathRef]] = Task.Sources { super.sources() ++ integration.sources() } - def tmpDirBase: Target[PathRef] = Task(persistent = true) { + def tmpDirBase: T[PathRef] = Task(persistent = true) { PathRef(Task.dest / "working-dir") } - def forkEnv: Target[Map[String, String]] = super.forkEnv() ++ Seq( + override def forkEnv: T[Map[String, String]] = super.forkEnv() ++ Seq( "SCALA_CLI_TMP" -> tmpDirBase().path.toString, "SCALA_CLI_IMAGE" -> "scala-cli", "SCALA_CLI_PRINT_STACK_TRACES" -> "1" @@ -153,13 +152,13 @@ object integration extends CliIntegration { object `docker-slim` extends CliIntegrationDocker { object test extends ScalaCliTests { - def sources: Target[Seq[PathRef]] = Task.Sources { + override def sources: T[Seq[PathRef]] = Task.Sources { integration.docker.test.sources() } - def tmpDirBase: Target[PathRef] = Task(persistent = true) { + def tmpDirBase: T[PathRef] = Task(persistent = true) { PathRef(Task.dest / "working-dir") } - def forkEnv: Target[Map[String, String]] = super.forkEnv() ++ Seq( + override def forkEnv: T[Map[String, String]] = super.forkEnv() ++ Seq( "SCALA_CLI_TMP" -> tmpDirBase().path.toString, "SCALA_CLI_IMAGE" -> "scala-cli-slim", "SCALA_CLI_PRINT_STACK_TRACES" -> "1" @@ -172,23 +171,23 @@ object `docs-tests` extends Cross[DocsTests](Scala.scala3MainVersions) with CrossScalaDefaultToInternal trait DocsTests extends CrossSbtModule with ScalaCliScalafixModule with HasTests { main => - def ivyDeps: Target[Agg[Dep]] = Agg( + override def ivyDeps: T[Agg[Dep]] = Agg( Deps.fansi, Deps.osLib, Deps.pprint ) - def tmpDirBase: Target[PathRef] = Task(persistent = true) { + def tmpDirBase: T[PathRef] = Task(persistent = true) { PathRef(Task.dest / "working-dir") } - def extraEnv: Target[Seq[(String, String)]] = Task { + def extraEnv: T[Seq[(String, String)]] = Task { Seq( "SCLICHECK_SCALA_CLI" -> cli(crossScalaVersion).standaloneLauncher().path.toString, "SCALA_CLI_CONFIG" -> (tmpDirBase().path / "config" / "config.json").toString ) } - def forkEnv: Target[Map[String, String]] = super.forkEnv() ++ extraEnv() + override def forkEnv: T[Map[String, String]] = super.forkEnv() ++ extraEnv() - def constantsFile: Target[PathRef] = Task(persistent = true) { + def constantsFile: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "constants" val dest = dir / "Constants.scala" val code = @@ -207,17 +206,17 @@ trait DocsTests extends CrossSbtModule with ScalaCliScalafixModule with HasTests os.write.over(dest, code, createFolders = true) PathRef(dir) } - def generatedSources: Target[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile()) + override def generatedSources: T[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile()) object test extends ScalaCliTests with ScalaCliScalafixModule { - def forkEnv: Target[Map[String, String]] = super.forkEnv() ++ extraEnv() ++ Seq( + override def forkEnv: T[Map[String, String]] = super.forkEnv() ++ extraEnv() ++ Seq( "SCALA_CLI_EXAMPLES" -> (Task.workspace / "examples").toString, "SCALA_CLI_GIF_SCENARIOS" -> (Task.workspace / "gifs" / "scenarios").toString, "SCALA_CLI_WEBSITE_IMG" -> (Task.workspace / "website" / "static" / "img").toString, "SCALA_CLI_GIF_RENDERER_DOCKER_DIR" -> (Task.workspace / "gifs").toString, "SCALA_CLI_SVG_RENDERER_DOCKER_DIR" -> (Task.workspace / "gifs" / "svg_render").toString ) - def resources: Target[Seq[PathRef]] = Task.Sources { + override def resources: T[Seq[PathRef]] = Task.Sources { // Adding markdown directories here, so that they're watched for changes in watch mode Seq( PathRef(Task.workspace / "website" / "docs" / "commands"), @@ -228,31 +227,31 @@ trait DocsTests extends CrossSbtModule with ScalaCliScalafixModule with HasTests } object packager extends ScalaModule with Bloop.Module { - def skipBloop = true - def scalaVersion: Target[String] = Scala.scala213 - def ivyDeps: Target[Agg[Dep]] = Agg( + override def skipBloop = true + override def scalaVersion: T[String] = Scala.scala213 + override def ivyDeps: T[Agg[Dep]] = Agg( Deps.scalaPackagerCli ) - def mainClass: Target[Option[String]] = Some("packager.cli.PackagerCli") + override def mainClass: T[Option[String]] = Some("packager.cli.PackagerCli") } object `generate-reference-doc` extends Cross[GenerateReferenceDoc](Scala.scala3MainVersions) with CrossScalaDefaultToInternal trait GenerateReferenceDoc extends CrossSbtModule with ScalaCliScalafixModule { - def moduleDeps: Seq[JavaModule] = Seq( + override def moduleDeps: Seq[JavaModule] = Seq( cli(crossScalaVersion) ) - def repositoriesTask: Task[Seq[Repository]] = + override def repositoriesTask: Task[Seq[Repository]] = Task.Anon(super.repositoriesTask() ++ customRepositories) - def ivyDeps: Target[Agg[Dep]] = Agg( + override def ivyDeps: T[Agg[Dep]] = Agg( Deps.argonautShapeless, Deps.caseApp, Deps.munit ) - def mainClass: Target[Option[String]] = Some("scala.cli.doc.GenerateReferenceDoc") + override def mainClass: T[Option[String]] = Some("scala.cli.doc.GenerateReferenceDoc") - def forkEnv: Target[Map[String, String]] = super.forkEnv() ++ Seq( + override def forkEnv: T[Map[String, String]] = super.forkEnv() ++ Seq( "SCALA_CLI_POWER" -> "true" ) } @@ -263,9 +262,9 @@ object dummy extends Module { // for all Scala versions we support. object amm extends Cross[Amm](Scala.listMaxAmmoniteScalaVersion) trait Amm extends Cross.Module[String] with CrossScalaModule with Bloop.Module { - def crossScalaVersion: String = crossValue - def skipBloop = true - def ivyDeps: Target[Agg[Dep]] = { + override def crossScalaVersion: String = crossValue + override def skipBloop = true + override def ivyDeps: T[Agg[Dep]] = { val ammoniteDep = if (crossValue == Scala.scala3Lts) Deps.ammoniteForScala3Lts else Deps.ammonite @@ -273,29 +272,29 @@ object dummy extends Module { } } object scalafmt extends ScalaModule with Bloop.Module { - def skipBloop = true - def scalaVersion: Target[String] = Scala.defaultInternal - def ivyDeps: Target[Agg[Dep]] = Agg( + override def skipBloop = true + override def scalaVersion: T[String] = Scala.defaultInternal + override def ivyDeps: T[Agg[Dep]] = Agg( Deps.scalafmtCli ) } object pythonInterface extends JavaModule with Bloop.Module { - def skipBloop = true - def ivyDeps: Target[Agg[Dep]] = Agg( + override def skipBloop = true + override def ivyDeps: T[Agg[Dep]] = Agg( Deps.pythonInterface ) } object scalaPy extends ScalaModule with Bloop.Module { - def skipBloop = true - def scalaVersion: Target[String] = Scala.defaultInternal - def ivyDeps: Target[Agg[Dep]] = Agg( + override def skipBloop = true + override def scalaVersion: T[String] = Scala.defaultInternal + override def ivyDeps: T[Agg[Dep]] = Agg( Deps.scalaPy ) } object scalafix extends ScalaModule with Bloop.Module { - def skipBloop = true - def scalaVersion: Target[String] = Scala.defaultInternal - def ivyDeps: Target[Agg[Dep]] = Agg( + override def skipBloop = true + override def scalaVersion: T[String] = Scala.defaultInternal + override def ivyDeps: T[Agg[Dep]] = Agg( Deps.scalafixInterfaces ) } @@ -305,14 +304,14 @@ trait BuildMacros extends ScalaCliCrossSbtModule with ScalaCliPublishModule with ScalaCliScalafixModule with HasTests { - def crossScalaVersion: String = crossValue - def compileIvyDeps: Target[Agg[Dep]] = Task { + override def crossScalaVersion: String = crossValue + override def compileIvyDeps: T[Agg[Dep]] = Task { if (crossScalaVersion.startsWith("3")) super.compileIvyDeps() else super.compileIvyDeps() ++ Agg(Deps.scalaReflect(crossScalaVersion)) } object test extends ScalaCliTests { - def scalacOptions: Target[Seq[String]] = Task { + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ asyncScalacOptions(scalaVersion()) } @@ -332,8 +331,8 @@ trait BuildMacros extends ScalaCliCrossSbtModule else System.err.println(s"Found source file $cpsSource") assert(cpsSourceExists) - val sv = scalaVersion() - def compile(extraSources: os.Path*): CommandResult = + val sv = scalaVersion() + def compile(extraSources: os.Path*): os.CommandResult = os.proc("scala-cli", "compile", "-S", sv, cpsSource, extraSources).call( check = false, mergeErrIntoOut = true, @@ -387,22 +386,22 @@ trait Core extends ScalaCliCrossSbtModule with ScalaCliPublishModule with HasTests with ScalaCliScalafixModule { - def crossScalaVersion: String = crossValue + override def crossScalaVersion: String = crossValue - def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq( + override def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq( config(crossScalaVersion) ) - def compileModuleDeps: Seq[JavaModule] = Seq( + override def compileModuleDeps: Seq[JavaModule] = Seq( `build-macros`(crossScalaVersion) ) - def scalacOptions: Target[Seq[String]] = Task { + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ asyncScalacOptions(crossScalaVersion) } - def repositoriesTask: Task[Seq[Repository]] = + override def repositoriesTask: Task[Seq[Repository]] = Task.Anon(super.repositoriesTask() ++ deps.customRepositories) - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.bloopRifle.exclude(("org.scala-lang.modules", "scala-collection-compat_2.13")), Deps.collectionCompat, Deps.coursierJvm @@ -423,18 +422,18 @@ trait Core extends ScalaCliCrossSbtModule Deps.scalaJsLogging, Deps.swoval ) - def compileIvyDeps: Target[Agg[Dep]] = super.compileIvyDeps() ++ Seq( + override def compileIvyDeps: T[Agg[Dep]] = super.compileIvyDeps() ++ Seq( Deps.jsoniterMacros ) - private def vcsState: Target[String] = Task(persistent = true) { + private def vcsState: T[String] = Task(persistent = true) { val isCI = System.getenv("CI") != null val state = VcsVersion.vcsState().format() if (isCI) state else state + "-maybe-stale" } - def constantsFile: Target[PathRef] = Task(persistent = true) { + def constantsFile: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "constants" val dest = dir / "Constants.scala" val testRunnerMainClass = `test-runner`(Scala.runnerScala3) @@ -573,29 +572,29 @@ trait Core extends ScalaCliCrossSbtModule os.write.over(dest, code, createFolders = true) PathRef(dir) } - def generatedSources: Target[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile()) + override def generatedSources: T[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile()) } trait Directives extends ScalaCliCrossSbtModule with ScalaCliPublishModule with HasTests with ScalaCliScalafixModule { - def crossScalaVersion: String = crossValue - def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq( + override def crossScalaVersion: String = crossValue + override def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq( options(crossScalaVersion), core(crossScalaVersion), `build-macros`(crossScalaVersion), `specification-level`(crossScalaVersion) ) - def scalacOptions: Target[Seq[String]] = Task { + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ asyncScalacOptions(crossScalaVersion) } - def compileIvyDeps: Target[Agg[Dep]] = super.compileIvyDeps() ++ Agg( + override def compileIvyDeps: T[Agg[Dep]] = super.compileIvyDeps() ++ Agg( Deps.jsoniterMacros, Deps.svm ) - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( // Deps.asm, Deps.bloopConfig, Deps.jsoniterCore, @@ -603,20 +602,21 @@ trait Directives extends ScalaCliCrossSbtModule Deps.usingDirectives ) - def repositoriesTask: Task[Seq[Repository]] = + override def repositoriesTask: Task[Seq[Repository]] = Task.Anon(super.repositoriesTask() ++ deps.customRepositories) object test extends ScalaCliTests { - def ivyDeps: Target[Loose.Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Loose.Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.pprint ) - def runClasspath: Target[Seq[PathRef]] = Task { + override def runClasspath: T[Seq[PathRef]] = Task { super.runClasspath() ++ Seq(`local-repo`.localRepoJar()) } - def generatedSources: Target[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile()) + override def generatedSources: T[Seq[PathRef]] = + super.generatedSources() ++ Seq(constantsFile()) - def constantsFile: Target[PathRef] = Task(persistent = true) { + def constantsFile: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "constants" val dest = dir / "Constants2.scala" val code = @@ -642,9 +642,10 @@ trait Directives extends ScalaCliCrossSbtModule trait Config extends ScalaCliCrossSbtModule with ScalaCliPublishModule with ScalaCliScalafixModule { - def crossScalaVersion: String = crossValue - def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq(`specification-level`(crossScalaVersion)) - def ivyDeps: Target[Agg[Dep]] = { + override def crossScalaVersion: String = crossValue + override def moduleDeps: Seq[SonatypeCentralPublishModule] = + Seq(`specification-level`(crossScalaVersion)) + override def ivyDeps: T[Agg[Dep]] = { val maybeCollectionCompat = if (crossScalaVersion.startsWith("2.12.")) Seq(Deps.collectionCompat) else Nil @@ -652,43 +653,43 @@ trait Config extends ScalaCliCrossSbtModule Deps.jsoniterCoreJava8 ) } - def compileIvyDeps: Target[Agg[Dep]] = super.compileIvyDeps() ++ Agg( + override def compileIvyDeps: T[Agg[Dep]] = super.compileIvyDeps() ++ Agg( Deps.jsoniterMacrosJava8 ) - def scalacOptions: Target[Seq[String]] = Task { + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ Seq("-release", "8") } // Disabling Scalafix in 2.13 and 3, so that it doesn't remove // some compatibility-related imports, that are actually only used // in Scala 2.12. - def fix(args: String*): Command[Unit] = + override def fix(args: String*): Command[Unit] = if (crossScalaVersion.startsWith("2.12.")) super.fix(args: _*) else Task.Command(()) } trait Options extends ScalaCliCrossSbtModule with ScalaCliPublishModule with HasTests with ScalaCliScalafixModule { - def crossScalaVersion: String = crossValue - def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq( + override def crossScalaVersion: String = crossValue + override def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq( core(crossScalaVersion) ) - def compileModuleDeps: Seq[JavaModule] = Seq( + override def compileModuleDeps: Seq[JavaModule] = Seq( `build-macros`(crossScalaVersion) ) - def scalacOptions: Target[Seq[String]] = Task { + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ asyncScalacOptions(crossScalaVersion) } - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.bloopConfig, Deps.signingCliShared ) - def compileIvyDeps: Target[Agg[Dep]] = super.compileIvyDeps() ++ Seq( + override def compileIvyDeps: T[Agg[Dep]] = super.compileIvyDeps() ++ Seq( Deps.jsoniterMacros ) - def repositoriesTask: Task[Seq[Repository]] = + override def repositoriesTask: Task[Seq[Repository]] = Task.Anon(super.repositoriesTask() ++ deps.customRepositories) object test extends ScalaCliTests { @@ -700,19 +701,19 @@ trait Options extends ScalaCliCrossSbtModule with ScalaCliPublishModule with Has } trait Scala3Runtime extends CrossSbtModule with ScalaCliPublishModule { - def crossScalaVersion: String = crossValue - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() + override def crossScalaVersion: String = crossValue + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() } trait Scala3Graal extends ScalaCliCrossSbtModule with ScalaCliPublishModule with ScalaCliScalafixModule { - def crossScalaVersion: String = crossValue - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def crossScalaVersion: String = crossValue + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.asm, Deps.osLib ) - def resources: Target[Seq[PathRef]] = Task.Sources { + override def resources: T[Seq[PathRef]] = Task.Sources { val extraResourceDir = Task.dest / "extra" // scala3RuntimeFixes.jar is also used within // resource-config.json and BytecodeProcessor.scala @@ -726,32 +727,33 @@ trait Scala3Graal extends ScalaCliCrossSbtModule } trait Scala3GraalProcessor extends CrossScalaModule with ScalaCliPublishModule { - def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq(`scala3-graal`(crossScalaVersion)) - def finalMainClass: Target[String] = "scala.cli.graal.CoursierCacheProcessor" + override def moduleDeps: Seq[SonatypeCentralPublishModule] = + Seq(`scala3-graal`(crossScalaVersion)) + override def finalMainClass: T[String] = "scala.cli.graal.CoursierCacheProcessor" } trait Build extends ScalaCliCrossSbtModule with ScalaCliPublishModule with HasTests with ScalaCliScalafixModule { - def crossScalaVersion: String = crossValue - def millSourcePath: os.Path = super.millSourcePath / os.up / "build" - def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq( + override def crossScalaVersion: String = crossValue + override def millSourcePath: os.Path = super.millSourcePath / os.up / "build" + override def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq( options(crossScalaVersion), directives(crossScalaVersion), `scala-cli-bsp`, `test-runner`(crossScalaVersion), `tasty-lib`(crossScalaVersion) ) - def scalacOptions: Target[Seq[String]] = Task { + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ asyncScalacOptions(crossScalaVersion) } - def compileIvyDeps: Target[Agg[Dep]] = super.compileIvyDeps() ++ Agg( + override def compileIvyDeps: T[Agg[Dep]] = super.compileIvyDeps() ++ Agg( Deps.jsoniterMacros, Deps.svm ) - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.asm, Deps.collectionCompat, Deps.javaClassName, @@ -766,21 +768,22 @@ trait Build extends ScalaCliCrossSbtModule Deps.zipInputStream ) - def repositoriesTask: Task[Seq[Repository]] = + override def repositoriesTask: Task[Seq[Repository]] = Task.Anon(super.repositoriesTask() ++ deps.customRepositories) object test extends ScalaCliTests { - def ivyDeps: Target[Loose.Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Loose.Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.pprint, Deps.slf4jNop ) - def runClasspath: Target[Seq[PathRef]] = Task { + override def runClasspath: T[Seq[PathRef]] = Task { super.runClasspath() ++ Seq(`local-repo`.localRepoJar()) } - def generatedSources: Target[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile()) + override def generatedSources: T[Seq[PathRef]] = + super.generatedSources() ++ Seq(constantsFile()) - def constantsFile: Target[PathRef] = Task(persistent = true) { + def constantsFile: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "constants" val dest = dir / "Constants2.scala" val code = @@ -816,8 +819,8 @@ trait Build extends ScalaCliCrossSbtModule trait SpecificationLevel extends ScalaCliCrossSbtModule with ScalaCliPublishModule { - def crossScalaVersion: String = crossValue - def scalacOptions: Target[Seq[String]] = Task { + override def crossScalaVersion: String = crossValue + override def scalacOptions: T[Seq[String]] = Task { val isScala213 = crossScalaVersion.startsWith("2.13.") val extraOptions = if (isScala213) Seq("-Xsource:3") @@ -846,7 +849,7 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers } } - def constantsFile: Target[PathRef] = Task(persistent = true) { + def constantsFile: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "constants" val dest = dir / "Constants.scala" val code = @@ -867,7 +870,7 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers os.write.over(dest, code, createFolders = true) PathRef(dir) } - def optionsConstantsFile: Target[PathRef] = Task(persistent = true) { + def optionsConstantsFile: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "constants" val dest = dir / "Constants.scala" val code = @@ -894,10 +897,10 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers os.write.over(dest, code, createFolders = true) PathRef(dir) } - def generatedSources: Target[Seq[PathRef]] = + override def generatedSources: T[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile(), optionsConstantsFile()) - def defaultFilesResources: Target[PathRef] = Task(persistent = true) { + def defaultFilesResources: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "resources" def transformWorkflow(content: Array[Byte]): Array[Byte] = new String(content, "UTF-8") @@ -924,14 +927,14 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers } PathRef(dir) } - override def resources: Target[Seq[PathRef]] = Task.Sources { + override def resources: T[Seq[PathRef]] = Task.Sources { super.resources() ++ Seq(defaultFilesResources()) } - def scalacOptions: Target[Seq[String]] = Task { + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ asyncScalacOptions(crossScalaVersion) } - def javacOptions: Target[Seq[String]] = Task { + override def javacOptions: T[Seq[String]] = Task { super.javacOptions() ++ Seq("--release", "16") } def moduleDeps: Seq[SonatypeCentralPublishModule] = Seq( @@ -941,10 +944,10 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers `specification-level`(crossScalaVersion) ) - def repositoriesTask: Task[Seq[Repository]] = + override def repositoriesTask: Task[Seq[Repository]] = Task.Anon(super.repositoriesTask() ++ customRepositories) - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.caseApp, Deps.coursierLauncher, Deps.coursierProxySetup, @@ -961,13 +964,13 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers Deps.sttp, Deps.scalafixInterfaces ) - def compileIvyDeps: Target[Agg[Dep]] = super.compileIvyDeps() ++ Agg( + override def compileIvyDeps: T[Agg[Dep]] = super.compileIvyDeps() ++ Agg( Deps.jsoniterMacros, Deps.svm ) - def mainClass: Target[Option[String]] = Some("scala.cli.ScalaCli") + override def mainClass: T[Option[String]] = Some("scala.cli.ScalaCli") - override def nativeImageClassPath: Target[Seq[PathRef]] = Task { + override def nativeImageClassPath: T[Seq[PathRef]] = Task { val classpath = super.nativeImageClassPath().map(_.path).mkString(File.pathSeparator) val cache = Task.dest / "native-cp" // `scala3-graal-processor`.run() do not give me output and I cannot pass dynamically computed values like classpath @@ -980,17 +983,17 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers cp.split(File.pathSeparator).toSeq.map(p => PathRef(os.Path(p))) } - def localRepoJar: Target[PathRef] = `local-repo`.localRepoJar() + override def localRepoJar: T[PathRef] = `local-repo`.localRepoJar() object test extends ScalaCliTests with ScalaCliScalafixModule { - def moduleDeps: Seq[JavaModule] = super.moduleDeps ++ Seq( + override def moduleDeps: Seq[JavaModule] = super.moduleDeps ++ Seq( `build-module`(crossScalaVersion).test ) - def runClasspath: Target[Seq[PathRef]] = Task { + override def runClasspath: T[Seq[PathRef]] = Task { super.runClasspath() ++ Seq(localRepoJar()) } - def compileIvyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def compileIvyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.jsoniterMacros ) @@ -1003,23 +1006,23 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests with ScalaCliScalafixModule { - def scalaVersion: Target[String] = sv + override def scalaVersion: T[String] = sv def sv: String = Scala.scala213 - def tmpDirBase: Target[PathRef] = Task(persistent = true) { + def tmpDirBase: T[PathRef] = Task(persistent = true) { PathRef(Task.dest / "working-dir") } - def scalacOptions: Target[Seq[String]] = Task { + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ Seq("-Xasync", "-deprecation") } - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.osLib ) trait IntegrationScalaTests extends super.ScalaCliTests with ScalaCliScalafixModule { - def ivyDeps: Target[Loose.Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Loose.Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.bsp4j, Deps.coursier .exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-macros")), @@ -1031,16 +1034,16 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests Deps.slf4jNop, Deps.usingDirectives ) - def compileIvyDeps: Target[Agg[Dep]] = super.compileIvyDeps() ++ Seq( + override def compileIvyDeps: T[Agg[Dep]] = super.compileIvyDeps() ++ Seq( Deps.jsoniterMacros ) - def forkEnv: Target[Map[String, String]] = super.forkEnv() ++ Seq( + override def forkEnv: T[Map[String, String]] = super.forkEnv() ++ Seq( "SCALA_CLI_TMP" -> tmpDirBase().path.toString, "SCALA_CLI_PRINT_STACK_TRACES" -> "1", "SCALA_CLI_CONFIG" -> (tmpDirBase().path / "config" / "config.json").toString ) - def constantsFile: Target[PathRef] = Task(persistent = true) { + def constantsFile: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "constants" val dest = dir / "Constants.scala" val mostlyStaticDockerfile = @@ -1126,11 +1129,12 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests os.write.over(dest, code, createFolders = true) PathRef(dir) } - def generatedSources: Target[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile()) + override def generatedSources: T[Seq[PathRef]] = + super.generatedSources() ++ Seq(constantsFile()) override def test(args: String*): Command[(String, Seq[TestResult])] = jvm(args: _*) - def forcedLauncher: Target[PathRef] = Task(persistent = true) { + def forcedLauncher: T[PathRef] = Task(persistent = true) { val ext = if (Properties.isWin) ".exe" else "" val launcher = Task.dest / s"scala-cli$ext" if (!os.exists(launcher)) { @@ -1148,7 +1152,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests PathRef(launcher) } - def forcedStaticLauncher: Target[PathRef] = Task(persistent = true) { + def forcedStaticLauncher: T[PathRef] = Task(persistent = true) { val launcher = Task.dest / "scala-cli" if (!os.exists(launcher)) { val dir = Option(System.getenv("SCALA_CLI_IT_FORCED_STATIC_LAUNCHER_DIRECTORY")).getOrElse { @@ -1160,7 +1164,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests PathRef(launcher) } - def forcedMostlyStaticLauncher: Target[PathRef] = Task(persistent = true) { + def forcedMostlyStaticLauncher: T[PathRef] = Task(persistent = true) { val launcher = Task.dest / "scala-cli" if (!os.exists(launcher)) { val dir = @@ -1174,23 +1178,23 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests } private object Launchers { - def jvm: Target[PathRef] = cli(Scala.defaultInternal).standaloneLauncher + def jvm: T[PathRef] = cli(Scala.defaultInternal).standaloneLauncher - def jvmBootstrapped: Target[PathRef] = cliBootstrapped.jar + def jvmBootstrapped: T[PathRef] = cliBootstrapped.jar - def native: Target[PathRef] = + def native: T[PathRef] = Option(System.getenv("SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY")) match { case Some(_) => forcedLauncher case None => cli(Scala.defaultInternal).nativeImage } - def nativeStatic: Target[PathRef] = + def nativeStatic: T[PathRef] = Option(System.getenv("SCALA_CLI_IT_FORCED_STATIC_LAUNCHER_DIRECTORY")) match { case Some(_) => forcedStaticLauncher case None => cli(Scala.defaultInternal).nativeImageStatic } - def nativeMostlyStatic: Target[PathRef] = + def nativeMostlyStatic: T[PathRef] = Option(System.getenv("SCALA_CLI_IT_FORCED_MOSTLY_STATIC_LAUNCHER_DIRECTORY")) match { case Some(_) => forcedMostlyStaticLauncher case None => cli(Scala.defaultInternal).nativeImageMostlyStatic @@ -1260,8 +1264,8 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests } trait CliIntegrationDocker extends SbtModule with ScalaCliPublishModule with HasTests { - def scalaVersion: T[String] = Scala.scala213 - def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def scalaVersion: T[String] = Scala.scala213 + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.osLib ) } @@ -1269,12 +1273,12 @@ trait CliIntegrationDocker extends SbtModule with ScalaCliPublishModule with Has trait Runner extends ScalaCliCrossSbtModule with ScalaCliPublishModule with ScalaCliScalafixLegacyModule { - def crossScalaVersion: String = crossValue - def scalacOptions: Target[Seq[String]] = Task { + override def crossScalaVersion: String = crossValue + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ Seq("-release", "8") } - def mainClass: Target[Option[String]] = Some("scala.cli.runner.Runner") - def sources: Target[Seq[PathRef]] = Task.Sources { + override def mainClass: T[Option[String]] = Some("scala.cli.runner.Runner") + override def sources: T[Seq[PathRef]] = Task.Sources { val scala3DirNames = if (crossScalaVersion.startsWith("3.")) { val name = @@ -1292,23 +1296,23 @@ trait Runner extends ScalaCliCrossSbtModule trait TestRunner extends ScalaCliCrossSbtModule with ScalaCliPublishModule with ScalaCliScalafixLegacyModule { - def crossScalaVersion: String = crossValue - def scalacOptions: Target[Seq[String]] = Task { + override def crossScalaVersion: String = crossValue + override def scalacOptions: T[Seq[String]] = Task { super.scalacOptions() ++ Seq("-release", "8") } - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.asm, Deps.collectionCompat, Deps.testInterface ) - def mainClass: Target[Option[String]] = Some("scala.build.testrunner.DynamicTestRunner") + override def mainClass: T[Option[String]] = Some("scala.build.testrunner.DynamicTestRunner") } trait TastyLib extends ScalaCliCrossSbtModule with ScalaCliPublishModule with ScalaCliScalafixLegacyModule { - def crossScalaVersion: String = crossValue - def constantsFile: Target[PathRef] = Task(persistent = true) { + override def crossScalaVersion: String = crossValue + def constantsFile: T[PathRef] = Task(persistent = true) { val dir = Task.dest / "constants" val dest = dir / "Constants.scala" val code = @@ -1324,7 +1328,7 @@ trait TastyLib extends ScalaCliCrossSbtModule PathRef(dir) } - def generatedSources: Target[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile()) + override def generatedSources: T[Seq[PathRef]] = super.generatedSources() ++ Seq(constantsFile()) } object `local-repo` extends LocalRepo { @@ -1336,12 +1340,12 @@ object `local-repo` extends LocalRepo { */ def developingOnStubModules = false - def stubsModules: Seq[PublishLocalNoFluff] = + override def stubsModules: Seq[PublishLocalNoFluff] = for { sv <- Scala.runnerScalaVersions proj <- Seq(runner, `test-runner`) } yield proj(sv) - def version: Target[String] = runner(Scala.runnerScala3).publishVersion() + override def version: T[String] = runner(Scala.runnerScala3).publishVersion() } // Helper CI commands @@ -1356,7 +1360,7 @@ def publishSonatype(tasks: mill.main.Tasks[PublishModule.PublishData]) = Task.Co val bundleName = s"$organization-$ghName-$pv" System.err.println(s"Publishing bundle: $bundleName") publish.publishSonatype( - data = define.Target.sequence(tasks.value)(), + data = define.Task.sequence(tasks.value)(), log = Task.ctx().log, workspace = Task.workspace, env = Task.env, @@ -1417,7 +1421,7 @@ def importedLauncher(directory: String = "artifacts", workspace: os.Path): Array } } -def copyLauncher(directory: String = "artifacts"): Command[Path] = Task.Command { +def copyLauncher(directory: String = "artifacts"): Command[os.Path] = Task.Command { val nativeLauncher = cli(Scala.defaultInternal).nativeImage().path Upload.copyLauncher0( nativeLauncher = nativeLauncher, @@ -1489,12 +1493,12 @@ def nativeIntegrationTests(): Command[(String, Seq[TestResult])] = integration.test.native()() } -def copyDefaultLauncher(directory: String = "artifacts"): Command[Path] = +def copyDefaultLauncher(directory: String = "artifacts"): Command[os.Path] = Task.Command { copyLauncher(directory)() } -def copyMostlyStaticLauncher(directory: String = "artifacts"): Command[Path] = Task.Command { +def copyMostlyStaticLauncher(directory: String = "artifacts"): Command[os.Path] = Task.Command { val nativeLauncher = cli(Scala.defaultInternal).nativeImageMostlyStatic().path Upload.copyLauncher0( nativeLauncher = nativeLauncher, @@ -1506,7 +1510,7 @@ def copyMostlyStaticLauncher(directory: String = "artifacts"): Command[Path] = T ) } -def copyStaticLauncher(directory: String = "artifacts"): Command[Path] = Task.Command { +def copyStaticLauncher(directory: String = "artifacts"): Command[os.Path] = Task.Command { val nativeLauncher = cli(Scala.defaultInternal).nativeImageStatic().path Upload.copyLauncher0( nativeLauncher = nativeLauncher, @@ -1520,9 +1524,9 @@ def copyStaticLauncher(directory: String = "artifacts"): Command[Path] = Task.Co private def ghToken(): String = Option(System.getenv("UPLOAD_GH_TOKEN")).getOrElse { sys.error("UPLOAD_GH_TOKEN not set") } -private def gitClone(repo: String, branch: String, workDir: os.Path): CommandResult = +private def gitClone(repo: String, branch: String, workDir: os.Path): os.CommandResult = os.proc("git", "clone", repo, "-q", "-b", branch).call(cwd = workDir) -private def setupGithubRepo(repoDir: os.Path): CommandResult = { +private def setupGithubRepo(repoDir: os.Path): os.CommandResult = { val gitUserName = "gh-actions" val gitEmail = "actions@github.com" @@ -1582,7 +1586,7 @@ object ci extends Module { os.proc("git", "switch", "-c", targetBranch).call(cwd = mainDir) commitChanges(s"Update scala-cli version to $version", targetBranch, mainDir, force = true) } - def updateStandaloneLauncher(): Command[CommandResult] = Task.Command { + def updateStandaloneLauncher(): Command[os.CommandResult] = Task.Command { val version = cli(Scala.defaultInternal).publishVersion() val targetDir = Task.workspace / "target" @@ -1832,7 +1836,7 @@ object ci extends Module { commitChanges(s"Update Debian packages for $version", branch, packagesDir) } - def updateChocolateyPackage(): Command[CommandResult] = Task.Command { + def updateChocolateyPackage(): Command[os.CommandResult] = Task.Command { val version = cli(Scala.defaultInternal).publishVersion() val packagesDir = Task.workspace / "target" / "scala-cli-packages" @@ -2019,24 +2023,25 @@ object ci extends Module { def shouldPublish(): Command[Unit] = Task.Command { println(publish.shouldPublish()) } - def copyJvm(jvm: String = deps.graalVmJvmId, dest: String = "jvm"): Command[Path] = Task.Command { - import sys.process._ - val command = Seq( - settings.cs(), - "java-home", - "--jvm", - jvm, - "--update", - "--ttl", - "0" - ) - val baseJavaHome = os.Path(command.!!.trim, Task.workspace) - System.err.println(s"Initial Java home $baseJavaHome") - val destJavaHome = os.Path(dest, Task.workspace) - os.copy(baseJavaHome, destJavaHome, createFolders = true) - System.err.println(s"New Java home $destJavaHome") - destJavaHome - } + def copyJvm(jvm: String = deps.graalVmJvmId, dest: String = "jvm"): Command[os.Path] = + Task.Command { + import sys.process._ + val command = Seq( + settings.cs(), + "java-home", + "--jvm", + jvm, + "--update", + "--ttl", + "0" + ) + val baseJavaHome = os.Path(command.!!.trim, Task.workspace) + System.err.println(s"Initial Java home $baseJavaHome") + val destJavaHome = os.Path(dest, Task.workspace) + os.copy(baseJavaHome, destJavaHome, createFolders = true) + System.err.println(s"New Java home $destJavaHome") + destJavaHome + } def checkScalaVersions(): Command[Unit] = Task.Command { website.checkMainScalaVersions( diff --git a/mill.bat b/mill.bat index 0d7e1e19fd..cfa33a236d 100755 --- a/mill.bat +++ b/mill.bat @@ -1,299 +1,299 @@ -@echo off - -rem This is a wrapper script, that automatically selects or downloads Mill from Maven Central or GitHub release pages. -rem -rem This script determines the Mill version to use by trying these sources -rem - env-variable `MILL_VERSION` -rem - local file `.mill-version` -rem - local file `.config/mill-version` -rem - `mill-version` from YAML fronmatter of current buildfile -rem - if accessible, find the latest stable version available on Maven Central (https://repo1.maven.org/maven2) -rem - env-variable `DEFAULT_MILL_VERSION` -rem -rem If a version has the suffix '-native' a native binary will be used. -rem If a version has the suffix '-jvm' an executable jar file will be used, requiring an already installed Java runtime. -rem If no such suffix is found, the script will pick a default based on version and platform. -rem -rem Once a version was determined, it tries to use either -rem - a system-installed mill, if found and it's version matches -rem - an already downloaded version under %USERPROFILE%\.mill\download -rem -rem If no working mill version was found on the system, -rem this script downloads a binary file from Maven Central or Github Pages (this is version dependent) -rem into a cache location (%USERPROFILE%\.mill\download). -rem -rem Mill Project URL: https://github.com/com-lihaoyi/mill -rem Script Version: 1.0.0-M1-21-7b6fae-DIRTY892b63e8 -rem -rem If you want to improve this script, please also contribute your changes back! -rem This script was generated from: dist/scripts/src/mill.bat -rem -rem Licensed under the Apache License, Version 2.0 - -rem setlocal seems to be unavailable on Windows 95/98/ME -rem but I don't think we need to support them in 2019 -setlocal enabledelayedexpansion - -if [!DEFAULT_MILL_VERSION!]==[] ( set "DEFAULT_MILL_VERSION=0.12.14" ) - -if [!MILL_GITHUB_RELEASE_CDN!]==[] ( set "MILL_GITHUB_RELEASE_CDN=" ) - -if [!MILL_MAIN_CLI!]==[] ( set "MILL_MAIN_CLI=%~f0" ) - -set "MILL_REPO_URL=https://github.com/com-lihaoyi/mill" - -SET MILL_BUILD_SCRIPT= - -if exist "build.mill" ( - set MILL_BUILD_SCRIPT=build.mill -) else ( - if exist "build.mill.scala" ( - set MILL_BUILD_SCRIPT=build.mill.scala - ) else ( - if exist "build.sc" ( - set MILL_BUILD_SCRIPT=build.sc - ) else ( - rem no-op - ) - ) -) - -if [!MILL_VERSION!]==[] ( - if exist .mill-version ( - set /p MILL_VERSION=<.mill-version - ) else ( - if exist .config\mill-version ( - set /p MILL_VERSION=<.config\mill-version - ) else ( - if not "%MILL_BUILD_SCRIPT%"=="" ( - for /f "tokens=1-2*" %%a in ('findstr /C:"//| mill-version:" %MILL_BUILD_SCRIPT%') do ( - set "MILL_VERSION=%%c" - ) - ) else ( - rem no-op - ) - ) - ) -) - -if [!MILL_VERSION!]==[] set MILL_VERSION=%DEFAULT_MILL_VERSION% - -if [!MILL_DOWNLOAD_PATH!]==[] set MILL_DOWNLOAD_PATH=%USERPROFILE%\.mill\download - -rem without bat file extension, cmd doesn't seem to be able to run it - -set "MILL_NATIVE_SUFFIX=-native" -set "MILL_JVM_SUFFIX=-jvm" -set "FULL_MILL_VERSION=%MILL_VERSION%" -set "MILL_EXT=.bat" -set "ARTIFACT_SUFFIX=" -REM Check if MILL_VERSION contains MILL_NATIVE_SUFFIX -echo !MILL_VERSION! | findstr /C:"%MILL_NATIVE_SUFFIX%" >nul -if !errorlevel! equ 0 ( - set "MILL_VERSION=%MILL_VERSION:-native=%" - REM -native images compiled with graal do not support windows-arm - REM https://github.com/oracle/graal/issues/9215 - IF /I NOT "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( - set "ARTIFACT_SUFFIX=-native-windows-amd64" - set "MILL_EXT=.exe" - ) else ( - rem no-op - ) -) else ( - echo !MILL_VERSION! | findstr /C:"%MILL_JVM_SUFFIX%" >nul - if !errorlevel! equ 0 ( - set "MILL_VERSION=%MILL_VERSION:-jvm=%" - ) else ( - set "SKIP_VERSION=false" - set "MILL_PREFIX=%MILL_VERSION:~0,4%" - if "!MILL_PREFIX!"=="0.1." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.2." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.3." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.4." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.5." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.6." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.7." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.8." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.9." set "SKIP_VERSION=true" - set "MILL_PREFIX=%MILL_VERSION:~0,5%" - if "!MILL_PREFIX!"=="0.10." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.11." set "SKIP_VERSION=true" - if "!MILL_PREFIX!"=="0.12." set "SKIP_VERSION=true" - - if "!SKIP_VERSION!"=="false" ( - IF /I NOT "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( - set "ARTIFACT_SUFFIX=-native-windows-amd64" - set "MILL_EXT=.exe" - ) - ) else ( - rem no-op - ) - ) -) - -set MILL=%MILL_DOWNLOAD_PATH%\!FULL_MILL_VERSION!!MILL_EXT! - -set MILL_RESOLVE_DOWNLOAD= - -if not exist "%MILL%" ( - set MILL_RESOLVE_DOWNLOAD=true -) else ( - if defined MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT ( - set MILL_RESOLVE_DOWNLOAD=true - ) else ( - rem no-op - ) -) - - -if [!MILL_RESOLVE_DOWNLOAD!]==[true] ( - set MILL_VERSION_PREFIX=%MILL_VERSION:~0,4% - set MILL_SHORT_VERSION_PREFIX=%MILL_VERSION:~0,2% - rem Since 0.5.0 - set MILL_DOWNLOAD_SUFFIX=-assembly - rem Since 0.11.0 - set MILL_DOWNLOAD_FROM_MAVEN=1 - if [!MILL_VERSION_PREFIX!]==[0.0.] ( - set MILL_DOWNLOAD_SUFFIX= - set MILL_DOWNLOAD_FROM_MAVEN=0 - ) - if [!MILL_VERSION_PREFIX!]==[0.1.] ( - set MILL_DOWNLOAD_SUFFIX= - set MILL_DOWNLOAD_FROM_MAVEN=0 - ) - if [!MILL_VERSION_PREFIX!]==[0.2.] ( - set MILL_DOWNLOAD_SUFFIX= - set MILL_DOWNLOAD_FROM_MAVEN=0 - ) - if [!MILL_VERSION_PREFIX!]==[0.3.] ( - set MILL_DOWNLOAD_SUFFIX= - set MILL_DOWNLOAD_FROM_MAVEN=0 - ) - if [!MILL_VERSION_PREFIX!]==[0.4.] ( - set MILL_DOWNLOAD_SUFFIX= - set MILL_DOWNLOAD_FROM_MAVEN=0 - ) - if [!MILL_VERSION_PREFIX!]==[0.5.] set MILL_DOWNLOAD_FROM_MAVEN=0 - if [!MILL_VERSION_PREFIX!]==[0.6.] set MILL_DOWNLOAD_FROM_MAVEN=0 - if [!MILL_VERSION_PREFIX!]==[0.7.] set MILL_DOWNLOAD_FROM_MAVEN=0 - if [!MILL_VERSION_PREFIX!]==[0.8.] set MILL_DOWNLOAD_FROM_MAVEN=0 - if [!MILL_VERSION_PREFIX!]==[0.9.] set MILL_DOWNLOAD_FROM_MAVEN=0 - - set MILL_VERSION_PREFIX=%MILL_VERSION:~0,5% - if [!MILL_VERSION_PREFIX!]==[0.10.] set MILL_DOWNLOAD_FROM_MAVEN=0 - - set MILL_VERSION_PREFIX=%MILL_VERSION:~0,8% - if [!MILL_VERSION_PREFIX!]==[0.11.0-M] set MILL_DOWNLOAD_FROM_MAVEN=0 - - set MILL_VERSION_PREFIX=%MILL_VERSION:~0,5% - set DOWNLOAD_EXT=exe - if [!MILL_SHORT_VERSION_PREFIX!]==[0.] set DOWNLOAD_EXT=jar - if [!MILL_VERSION_PREFIX!]==[0.12.] set DOWNLOAD_EXT=exe - if [!MILL_VERSION!]==[0.12.0] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.1] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.2] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.3] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.4] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.5] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.6] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.7] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.8] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.9] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.10] set DOWNLOAD_EXT=jar - if [!MILL_VERSION!]==[0.12.11] set DOWNLOAD_EXT=jar - - set MILL_VERSION_PREFIX= - set MILL_SHORT_VERSION_PREFIX= - - for /F "delims=- tokens=1" %%A in ("!MILL_VERSION!") do set MILL_VERSION_BASE=%%A - set MILL_VERSION_MILESTONE= - for /F "delims=- tokens=2" %%A in ("!MILL_VERSION!") do set MILL_VERSION_MILESTONE=%%A - set MILL_VERSION_MILESTONE_START=!MILL_VERSION_MILESTONE:~0,1! - if [!MILL_VERSION_MILESTONE_START!]==[M] ( - set MILL_VERSION_TAG=!MILL_VERSION_BASE!-!MILL_VERSION_MILESTONE! - ) else ( - set MILL_VERSION_TAG=!MILL_VERSION_BASE! - ) - if [!MILL_DOWNLOAD_FROM_MAVEN!]==[1] ( - set MILL_DOWNLOAD_URL=https://repo1.maven.org/maven2/com/lihaoyi/mill-dist!ARTIFACT_SUFFIX!/!MILL_VERSION!/mill-dist!ARTIFACT_SUFFIX!-!MILL_VERSION!.!DOWNLOAD_EXT! - ) else ( - set MILL_DOWNLOAD_URL=!MILL_GITHUB_RELEASE_CDN!%MILL_REPO_URL%/releases/download/!MILL_VERSION_TAG!/!MILL_VERSION!!MILL_DOWNLOAD_SUFFIX! - ) - - if defined MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT ( - echo !MILL_DOWNLOAD_URL! - echo !MILL! - exit /b 0 - ) - - rem there seems to be no way to generate a unique temporary file path (on native Windows) - set MILL_DOWNLOAD_FILE=%MILL%.tmp - - echo Downloading mill !MILL_VERSION! from !MILL_DOWNLOAD_URL! ... 1>&2 - - if not exist "%MILL_DOWNLOAD_PATH%" mkdir "%MILL_DOWNLOAD_PATH%" - rem curl is bundled with recent Windows 10 - rem but I don't think we can expect all the users to have it in 2019 - where /Q curl - if !ERRORLEVEL! EQU 0 ( - curl -f -L "!MILL_DOWNLOAD_URL!" -o "!MILL_DOWNLOAD_FILE!" - ) else ( - rem bitsadmin seems to be available on Windows 7 - rem without /dynamic, github returns 403 - rem bitsadmin is sometimes needlessly slow but it looks better with /priority foreground - bitsadmin /transfer millDownloadJob /dynamic /priority foreground "!MILL_DOWNLOAD_URL!" "!MILL_DOWNLOAD_FILE!" - ) - if not exist "!MILL_DOWNLOAD_FILE!" ( - echo Could not download mill !MILL_VERSION! 1>&2 - exit /b 1 - ) - - move /y "!MILL_DOWNLOAD_FILE!" "%MILL%" - - set MILL_DOWNLOAD_FILE= - set MILL_DOWNLOAD_SUFFIX= -) - -set MILL_DOWNLOAD_PATH= -set MILL_VERSION= -set MILL_REPO_URL= - -rem Need to preserve the first position of those listed options -set MILL_FIRST_ARG= -if [%~1%]==[--bsp] ( - set MILL_FIRST_ARG=%1% -) else ( - if [%~1%]==[-i] ( - set MILL_FIRST_ARG=%1% - ) else ( - if [%~1%]==[--interactive] ( - set MILL_FIRST_ARG=%1% - ) else ( - if [%~1%]==[--no-server] ( - set MILL_FIRST_ARG=%1% - ) else ( - if [%~1%]==[--no-daemon] ( - set MILL_FIRST_ARG=%1% - ) else ( - if [%~1%]==[--repl] ( - set MILL_FIRST_ARG=%1% - ) else ( - if [%~1%]==[--help] ( - set MILL_FIRST_ARG=%1% - ) - ) - ) - ) - ) - ) -) -set "MILL_PARAMS=%*%" - -if not [!MILL_FIRST_ARG!]==[] ( - for /f "tokens=1*" %%a in ("%*") do ( - set "MILL_PARAMS=%%b" - ) -) - -rem -D mill.main.cli is for compatibility with Mill 0.10.9 - 0.13.0-M2 -"%MILL%" %MILL_FIRST_ARG% -D "mill.main.cli=%MILL_MAIN_CLI%" %MILL_PARAMS% \ No newline at end of file +@echo off + +rem This is a wrapper script, that automatically selects or downloads Mill from Maven Central or GitHub release pages. +rem +rem This script determines the Mill version to use by trying these sources +rem - env-variable `MILL_VERSION` +rem - local file `.mill-version` +rem - local file `.config/mill-version` +rem - `mill-version` from YAML fronmatter of current buildfile +rem - if accessible, find the latest stable version available on Maven Central (https://repo1.maven.org/maven2) +rem - env-variable `DEFAULT_MILL_VERSION` +rem +rem If a version has the suffix '-native' a native binary will be used. +rem If a version has the suffix '-jvm' an executable jar file will be used, requiring an already installed Java runtime. +rem If no such suffix is found, the script will pick a default based on version and platform. +rem +rem Once a version was determined, it tries to use either +rem - a system-installed mill, if found and it's version matches +rem - an already downloaded version under %USERPROFILE%\.mill\download +rem +rem If no working mill version was found on the system, +rem this script downloads a binary file from Maven Central or Github Pages (this is version dependent) +rem into a cache location (%USERPROFILE%\.mill\download). +rem +rem Mill Project URL: https://github.com/com-lihaoyi/mill +rem Script Version: 1.0.0-M1-21-7b6fae-DIRTY892b63e8 +rem +rem If you want to improve this script, please also contribute your changes back! +rem This script was generated from: dist/scripts/src/mill.bat +rem +rem Licensed under the Apache License, Version 2.0 + +rem setlocal seems to be unavailable on Windows 95/98/ME +rem but I don't think we need to support them in 2019 +setlocal enabledelayedexpansion + +if [!DEFAULT_MILL_VERSION!]==[] ( set "DEFAULT_MILL_VERSION=0.12.15" ) + +if [!MILL_GITHUB_RELEASE_CDN!]==[] ( set "MILL_GITHUB_RELEASE_CDN=" ) + +if [!MILL_MAIN_CLI!]==[] ( set "MILL_MAIN_CLI=%~f0" ) + +set "MILL_REPO_URL=https://github.com/com-lihaoyi/mill" + +SET MILL_BUILD_SCRIPT= + +if exist "build.mill" ( + set MILL_BUILD_SCRIPT=build.mill +) else ( + if exist "build.mill.scala" ( + set MILL_BUILD_SCRIPT=build.mill.scala + ) else ( + if exist "build.sc" ( + set MILL_BUILD_SCRIPT=build.sc + ) else ( + rem no-op + ) + ) +) + +if [!MILL_VERSION!]==[] ( + if exist .mill-version ( + set /p MILL_VERSION=<.mill-version + ) else ( + if exist .config\mill-version ( + set /p MILL_VERSION=<.config\mill-version + ) else ( + if not "%MILL_BUILD_SCRIPT%"=="" ( + for /f "tokens=1-2*" %%a in ('findstr /C:"//| mill-version:" %MILL_BUILD_SCRIPT%') do ( + set "MILL_VERSION=%%c" + ) + ) else ( + rem no-op + ) + ) + ) +) + +if [!MILL_VERSION!]==[] set MILL_VERSION=%DEFAULT_MILL_VERSION% + +if [!MILL_DOWNLOAD_PATH!]==[] set MILL_DOWNLOAD_PATH=%USERPROFILE%\.mill\download + +rem without bat file extension, cmd doesn't seem to be able to run it + +set "MILL_NATIVE_SUFFIX=-native" +set "MILL_JVM_SUFFIX=-jvm" +set "FULL_MILL_VERSION=%MILL_VERSION%" +set "MILL_EXT=.bat" +set "ARTIFACT_SUFFIX=" +REM Check if MILL_VERSION contains MILL_NATIVE_SUFFIX +echo !MILL_VERSION! | findstr /C:"%MILL_NATIVE_SUFFIX%" >nul +if !errorlevel! equ 0 ( + set "MILL_VERSION=%MILL_VERSION:-native=%" + REM -native images compiled with graal do not support windows-arm + REM https://github.com/oracle/graal/issues/9215 + IF /I NOT "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( + set "ARTIFACT_SUFFIX=-native-windows-amd64" + set "MILL_EXT=.exe" + ) else ( + rem no-op + ) +) else ( + echo !MILL_VERSION! | findstr /C:"%MILL_JVM_SUFFIX%" >nul + if !errorlevel! equ 0 ( + set "MILL_VERSION=%MILL_VERSION:-jvm=%" + ) else ( + set "SKIP_VERSION=false" + set "MILL_PREFIX=%MILL_VERSION:~0,4%" + if "!MILL_PREFIX!"=="0.1." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.2." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.3." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.4." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.5." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.6." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.7." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.8." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.9." set "SKIP_VERSION=true" + set "MILL_PREFIX=%MILL_VERSION:~0,5%" + if "!MILL_PREFIX!"=="0.10." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.11." set "SKIP_VERSION=true" + if "!MILL_PREFIX!"=="0.12." set "SKIP_VERSION=true" + + if "!SKIP_VERSION!"=="false" ( + IF /I NOT "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( + set "ARTIFACT_SUFFIX=-native-windows-amd64" + set "MILL_EXT=.exe" + ) + ) else ( + rem no-op + ) + ) +) + +set MILL=%MILL_DOWNLOAD_PATH%\!FULL_MILL_VERSION!!MILL_EXT! + +set MILL_RESOLVE_DOWNLOAD= + +if not exist "%MILL%" ( + set MILL_RESOLVE_DOWNLOAD=true +) else ( + if defined MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT ( + set MILL_RESOLVE_DOWNLOAD=true + ) else ( + rem no-op + ) +) + + +if [!MILL_RESOLVE_DOWNLOAD!]==[true] ( + set MILL_VERSION_PREFIX=%MILL_VERSION:~0,4% + set MILL_SHORT_VERSION_PREFIX=%MILL_VERSION:~0,2% + rem Since 0.5.0 + set MILL_DOWNLOAD_SUFFIX=-assembly + rem Since 0.11.0 + set MILL_DOWNLOAD_FROM_MAVEN=1 + if [!MILL_VERSION_PREFIX!]==[0.0.] ( + set MILL_DOWNLOAD_SUFFIX= + set MILL_DOWNLOAD_FROM_MAVEN=0 + ) + if [!MILL_VERSION_PREFIX!]==[0.1.] ( + set MILL_DOWNLOAD_SUFFIX= + set MILL_DOWNLOAD_FROM_MAVEN=0 + ) + if [!MILL_VERSION_PREFIX!]==[0.2.] ( + set MILL_DOWNLOAD_SUFFIX= + set MILL_DOWNLOAD_FROM_MAVEN=0 + ) + if [!MILL_VERSION_PREFIX!]==[0.3.] ( + set MILL_DOWNLOAD_SUFFIX= + set MILL_DOWNLOAD_FROM_MAVEN=0 + ) + if [!MILL_VERSION_PREFIX!]==[0.4.] ( + set MILL_DOWNLOAD_SUFFIX= + set MILL_DOWNLOAD_FROM_MAVEN=0 + ) + if [!MILL_VERSION_PREFIX!]==[0.5.] set MILL_DOWNLOAD_FROM_MAVEN=0 + if [!MILL_VERSION_PREFIX!]==[0.6.] set MILL_DOWNLOAD_FROM_MAVEN=0 + if [!MILL_VERSION_PREFIX!]==[0.7.] set MILL_DOWNLOAD_FROM_MAVEN=0 + if [!MILL_VERSION_PREFIX!]==[0.8.] set MILL_DOWNLOAD_FROM_MAVEN=0 + if [!MILL_VERSION_PREFIX!]==[0.9.] set MILL_DOWNLOAD_FROM_MAVEN=0 + + set MILL_VERSION_PREFIX=%MILL_VERSION:~0,5% + if [!MILL_VERSION_PREFIX!]==[0.10.] set MILL_DOWNLOAD_FROM_MAVEN=0 + + set MILL_VERSION_PREFIX=%MILL_VERSION:~0,8% + if [!MILL_VERSION_PREFIX!]==[0.11.0-M] set MILL_DOWNLOAD_FROM_MAVEN=0 + + set MILL_VERSION_PREFIX=%MILL_VERSION:~0,5% + set DOWNLOAD_EXT=exe + if [!MILL_SHORT_VERSION_PREFIX!]==[0.] set DOWNLOAD_EXT=jar + if [!MILL_VERSION_PREFIX!]==[0.12.] set DOWNLOAD_EXT=exe + if [!MILL_VERSION!]==[0.12.0] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.1] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.2] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.3] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.4] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.5] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.6] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.7] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.8] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.9] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.10] set DOWNLOAD_EXT=jar + if [!MILL_VERSION!]==[0.12.11] set DOWNLOAD_EXT=jar + + set MILL_VERSION_PREFIX= + set MILL_SHORT_VERSION_PREFIX= + + for /F "delims=- tokens=1" %%A in ("!MILL_VERSION!") do set MILL_VERSION_BASE=%%A + set MILL_VERSION_MILESTONE= + for /F "delims=- tokens=2" %%A in ("!MILL_VERSION!") do set MILL_VERSION_MILESTONE=%%A + set MILL_VERSION_MILESTONE_START=!MILL_VERSION_MILESTONE:~0,1! + if [!MILL_VERSION_MILESTONE_START!]==[M] ( + set MILL_VERSION_TAG=!MILL_VERSION_BASE!-!MILL_VERSION_MILESTONE! + ) else ( + set MILL_VERSION_TAG=!MILL_VERSION_BASE! + ) + if [!MILL_DOWNLOAD_FROM_MAVEN!]==[1] ( + set MILL_DOWNLOAD_URL=https://repo1.maven.org/maven2/com/lihaoyi/mill-dist!ARTIFACT_SUFFIX!/!MILL_VERSION!/mill-dist!ARTIFACT_SUFFIX!-!MILL_VERSION!.!DOWNLOAD_EXT! + ) else ( + set MILL_DOWNLOAD_URL=!MILL_GITHUB_RELEASE_CDN!%MILL_REPO_URL%/releases/download/!MILL_VERSION_TAG!/!MILL_VERSION!!MILL_DOWNLOAD_SUFFIX! + ) + + if defined MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT ( + echo !MILL_DOWNLOAD_URL! + echo !MILL! + exit /b 0 + ) + + rem there seems to be no way to generate a unique temporary file path (on native Windows) + set MILL_DOWNLOAD_FILE=%MILL%.tmp + + echo Downloading mill !MILL_VERSION! from !MILL_DOWNLOAD_URL! ... 1>&2 + + if not exist "%MILL_DOWNLOAD_PATH%" mkdir "%MILL_DOWNLOAD_PATH%" + rem curl is bundled with recent Windows 10 + rem but I don't think we can expect all the users to have it in 2019 + where /Q curl + if !ERRORLEVEL! EQU 0 ( + curl -f -L "!MILL_DOWNLOAD_URL!" -o "!MILL_DOWNLOAD_FILE!" + ) else ( + rem bitsadmin seems to be available on Windows 7 + rem without /dynamic, github returns 403 + rem bitsadmin is sometimes needlessly slow but it looks better with /priority foreground + bitsadmin /transfer millDownloadJob /dynamic /priority foreground "!MILL_DOWNLOAD_URL!" "!MILL_DOWNLOAD_FILE!" + ) + if not exist "!MILL_DOWNLOAD_FILE!" ( + echo Could not download mill !MILL_VERSION! 1>&2 + exit /b 1 + ) + + move /y "!MILL_DOWNLOAD_FILE!" "%MILL%" + + set MILL_DOWNLOAD_FILE= + set MILL_DOWNLOAD_SUFFIX= +) + +set MILL_DOWNLOAD_PATH= +set MILL_VERSION= +set MILL_REPO_URL= + +rem Need to preserve the first position of those listed options +set MILL_FIRST_ARG= +if [%~1%]==[--bsp] ( + set MILL_FIRST_ARG=%1% +) else ( + if [%~1%]==[-i] ( + set MILL_FIRST_ARG=%1% + ) else ( + if [%~1%]==[--interactive] ( + set MILL_FIRST_ARG=%1% + ) else ( + if [%~1%]==[--no-server] ( + set MILL_FIRST_ARG=%1% + ) else ( + if [%~1%]==[--no-daemon] ( + set MILL_FIRST_ARG=%1% + ) else ( + if [%~1%]==[--repl] ( + set MILL_FIRST_ARG=%1% + ) else ( + if [%~1%]==[--help] ( + set MILL_FIRST_ARG=%1% + ) + ) + ) + ) + ) + ) +) +set "MILL_PARAMS=%*%" + +if not [!MILL_FIRST_ARG!]==[] ( + for /f "tokens=1*" %%a in ("%*") do ( + set "MILL_PARAMS=%%b" + ) +) + +rem -D mill.main.cli is for compatibility with Mill 0.10.9 - 0.13.0-M2 +"%MILL%" %MILL_FIRST_ARG% -D "mill.main.cli=%MILL_MAIN_CLI%" %MILL_PARAMS% diff --git a/millw b/millw index b88b7d0e17..95b9be8f88 100755 --- a/millw +++ b/millw @@ -32,8 +32,14 @@ set -e +if [ "$1" = "--setup-completions" ] ; then + # Need to preserve the first position of those listed options + MILL_FIRST_ARG=$1 + shift +fi + if [ -z "${DEFAULT_MILL_VERSION}" ] ; then - DEFAULT_MILL_VERSION="0.12.14" + DEFAULT_MILL_VERSION=0.12.15 fi @@ -309,7 +315,7 @@ if [ -z "$MILL_MAIN_CLI" ] ; then fi MILL_FIRST_ARG="" -if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--no-daemon" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then +if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--no-daemon" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then # Need to preserve the first position of those listed options MILL_FIRST_ARG=$1 shift @@ -324,4 +330,4 @@ unset MILL_REPO_URL # -D mill.main.cli is for compatibility with Mill 0.10.9 - 0.13.0-M2 # We don't quote MILL_FIRST_ARG on purpose, so we can expand the empty value without quotes # shellcheck disable=SC2086 -exec "${MILL}" $MILL_FIRST_ARG -D "mill.main.cli=${MILL_MAIN_CLI}" "$@" \ No newline at end of file +exec "${MILL}" $MILL_FIRST_ARG -D "mill.main.cli=${MILL_MAIN_CLI}" "$@" diff --git a/project/deps/package.mill.scala b/project/deps/package.mill.scala index e3212c7561..23f0da40dd 100644 --- a/project/deps/package.mill.scala +++ b/project/deps/package.mill.scala @@ -145,93 +145,93 @@ object Deps { // DO NOT hardcode a Scala version in this dependency string // This dependency is used to ensure that Ammonite is available for Scala versions // that Scala CLI supports. - def ammonite = ivy"com.lihaoyi:::ammonite:${Versions.ammonite}" - def ammoniteForScala3Lts = ivy"com.lihaoyi:::ammonite:${Versions.ammoniteForScala3Lts}" + def ammonite = mvn"com.lihaoyi:::ammonite:${Versions.ammonite}" + def ammoniteForScala3Lts = mvn"com.lihaoyi:::ammonite:${Versions.ammoniteForScala3Lts}" def argonautShapeless = - ivy"com.github.alexarchambault:argonaut-shapeless_6.3_2.13:${Versions.argonautShapeless}" - def asm = ivy"org.ow2.asm:asm:9.8" + mvn"com.github.alexarchambault:argonaut-shapeless_6.3_2.13:${Versions.argonautShapeless}" + def asm = mvn"org.ow2.asm:asm:9.8" // Force using of 2.13 - is there a better way? - def bloopConfig = ivy"ch.epfl.scala:bloop-config_2.13:2.3.2" + def bloopConfig = mvn"ch.epfl.scala:bloop-config_2.13:2.3.2" .exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-core_2.13")) - def bloopRifle = ivy"ch.epfl.scala:bloop-rifle_2.13:${Versions.bloop}" - def bsp4j = ivy"ch.epfl.scala:bsp4j:2.1.1" - def caseApp = ivy"com.github.alexarchambault::case-app:2.1.0" - def collectionCompat = ivy"org.scala-lang.modules::scala-collection-compat:2.13.0" + def bloopRifle = mvn"ch.epfl.scala:bloop-rifle_2.13:${Versions.bloop}" + def bsp4j = mvn"ch.epfl.scala:bsp4j:2.1.1" + def caseApp = mvn"com.github.alexarchambault::case-app:2.1.0" + def collectionCompat = mvn"org.scala-lang.modules::scala-collection-compat:2.13.0" // Force using of 2.13 - is there a better way? - def coursier = ivy"io.get-coursier:coursier_2.13:${Versions.coursier}" - def coursierCli = ivy"io.get-coursier:coursier-cli_2.13:${Versions.coursierCli}" - def coursierJvm = ivy"io.get-coursier:coursier-jvm_2.13:${Versions.coursier}" + def coursier = mvn"io.get-coursier:coursier_2.13:${Versions.coursier}" + def coursierCli = mvn"io.get-coursier:coursier-cli_2.13:${Versions.coursierCli}" + def coursierJvm = mvn"io.get-coursier:coursier-jvm_2.13:${Versions.coursier}" .exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-core_2.13")) .exclude("io.get-coursier" -> "dependency_2.13") - def coursierLauncher = ivy"io.get-coursier:coursier-launcher_2.13:${Versions.coursier}" + def coursierLauncher = mvn"io.get-coursier:coursier-launcher_2.13:${Versions.coursier}" .exclude(("ai.kien", "python-native-libs_2.13")) .exclude(("org.scala-lang.modules", "scala-collection-compat_2.13")) - def coursierProxySetup = ivy"io.get-coursier:coursier-proxy-setup:${Versions.coursier}" - def coursierPublish = ivy"io.get-coursier.publish::publish:${Versions.coursierPublish}" + def coursierProxySetup = mvn"io.get-coursier:coursier-proxy-setup:${Versions.coursier}" + def coursierPublish = mvn"io.get-coursier.publish::publish:${Versions.coursierPublish}" .exclude(("org.scala-lang.modules", "scala-collection-compat_2.13")) .exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-core_3")) - def dependency = ivy"io.get-coursier::dependency:0.3.2" - def dockerClient = ivy"com.spotify:docker-client:8.16.0" - def expecty = ivy"com.eed3si9n.expecty::expecty:0.17.0" - def fansi = ivy"com.lihaoyi::fansi:0.5.1" - def giter8 = ivy"org.foundweekends.giter8:giter8:0.16.2" - def guava = ivy"com.google.guava:guava:33.4.8-jre" + def dependency = mvn"io.get-coursier::dependency:0.3.2" + def dockerClient = mvn"com.spotify:docker-client:8.16.0" + def expecty = mvn"com.eed3si9n.expecty::expecty:0.17.0" + def fansi = mvn"com.lihaoyi::fansi:0.5.1" + def giter8 = mvn"org.foundweekends.giter8:giter8:0.16.2" + def guava = mvn"com.google.guava:guava:33.4.8-jre" def javaClassName = - ivy"org.virtuslab.scala-cli.java-class-name:java-class-name_3:${Versions.javaClassName}" + mvn"org.virtuslab.scala-cli.java-class-name:java-class-name_3:${Versions.javaClassName}" .exclude( "org.jline" -> "jline-reader", "org.jline" -> "jline-terminal", "org.jline" -> "jline-terminal-jna" ) - def jgit = ivy"org.eclipse.jgit:org.eclipse.jgit:6.8.0.202311291450-r" - def jimfs = ivy"com.google.jimfs:jimfs:1.3.1" - def jmhGeneratorBytecode = ivy"org.openjdk.jmh:jmh-generator-bytecode:${Versions.jmh}" - def jmhCore = ivy"org.openjdk.jmh:jmh-core:${Versions.jmh}" - def jniUtils = ivy"io.get-coursier.jniutils:windows-jni-utils:0.3.3" + def jgit = mvn"org.eclipse.jgit:org.eclipse.jgit:6.8.0.202311291450-r" + def jimfs = mvn"com.google.jimfs:jimfs:1.3.1" + def jmhGeneratorBytecode = mvn"org.openjdk.jmh:jmh-generator-bytecode:${Versions.jmh}" + def jmhCore = mvn"org.openjdk.jmh:jmh-core:${Versions.jmh}" + def jniUtils = mvn"io.get-coursier.jniutils:windows-jni-utils:0.3.3" def jsoniterCore = - ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-core:${Versions.jsoniterScalaJava8}" + mvn"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-core:${Versions.jsoniterScalaJava8}" def jsoniterCoreJava8 = - ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-core:${Versions.jsoniterScalaJava8}" + mvn"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-core:${Versions.jsoniterScalaJava8}" def jsoniterMacros = - ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-macros:${Versions.jsoniterScalaJava8}" + mvn"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-macros:${Versions.jsoniterScalaJava8}" def jsoniterMacrosJava8 = - ivy"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-macros:${Versions.jsoniterScalaJava8}" - def jsoup = ivy"org.jsoup:jsoup:${Versions.jsoup}" - def libsodiumjni = ivy"org.virtuslab.scala-cli:libsodiumjni:0.0.4" + mvn"com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-macros:${Versions.jsoniterScalaJava8}" + def jsoup = mvn"org.jsoup:jsoup:${Versions.jsoup}" + def libsodiumjni = mvn"org.virtuslab.scala-cli:libsodiumjni:0.0.4" def metaconfigTypesafe = - ivy"org.scalameta::metaconfig-typesafe-config:0.16.0" + mvn"org.scalameta::metaconfig-typesafe-config:0.16.0" .exclude(("org.scala-lang", "scala-compiler")) - def munit = ivy"org.scalameta::munit:1.1.1" - def nativeTestRunner = ivy"org.scala-native::test-runner:${Versions.scalaNative}" - def nativeTools = ivy"org.scala-native::tools:${Versions.scalaNative}" - def osLib = ivy"com.lihaoyi::os-lib:0.11.5" - def pprint = ivy"com.lihaoyi::pprint:0.9.3" - def pythonInterface = ivy"io.github.alexarchambault.python:interface:0.1.0" - def pythonNativeLibs = ivy"ai.kien::python-native-libs:0.2.4" - def scalaAsync = ivy"org.scala-lang.modules::scala-async:1.0.1".exclude("*" -> "*") - def scalac(sv: String) = ivy"org.scala-lang:scala-compiler:$sv" - def scalafmtCli = ivy"org.scalameta:scalafmt-cli_2.13:${Versions.scalafmt}" + def munit = mvn"org.scalameta::munit:1.1.1" + def nativeTestRunner = mvn"org.scala-native::test-runner:${Versions.scalaNative}" + def nativeTools = mvn"org.scala-native::tools:${Versions.scalaNative}" + def osLib = mvn"com.lihaoyi::os-lib:0.11.5" + def pprint = mvn"com.lihaoyi::pprint:0.9.3" + def pythonInterface = mvn"io.github.alexarchambault.python:interface:0.1.0" + def pythonNativeLibs = mvn"ai.kien::python-native-libs:0.2.4" + def scalaAsync = mvn"org.scala-lang.modules::scala-async:1.0.1".exclude("*" -> "*") + def scalac(sv: String) = mvn"org.scala-lang:scala-compiler:$sv" + def scalafmtCli = mvn"org.scalameta:scalafmt-cli_2.13:${Versions.scalafmt}" // Force using of 2.13 - is there a better way? def scalaJsEnvJsdomNodejs = - ivy"org.scala-js:scalajs-env-jsdom-nodejs_2.13:1.1.0" + mvn"org.scala-js:scalajs-env-jsdom-nodejs_2.13:1.1.0" // Force using of 2.13 - is there a better way? - def scalaJsEnvNodeJs = ivy"org.scala-js:scalajs-env-nodejs_2.13:1.4.0" - def scalaJsLogging = ivy"org.scala-js:scalajs-logging_2.13:1.1.1" + def scalaJsEnvNodeJs = mvn"org.scala-js:scalajs-env-nodejs_2.13:1.4.0" + def scalaJsLogging = mvn"org.scala-js:scalajs-logging_2.13:1.1.1" // Force using of 2.13 - is there a better way? - def scalaJsTestAdapter = ivy"org.scala-js:scalajs-sbt-test-adapter_2.13:${Scala.scalaJs}" - def scalaPackager = ivy"org.virtuslab:scala-packager_2.13:${Versions.scalaPackager}" - def scalaPackagerCli = ivy"org.virtuslab:scala-packager-cli_2.13:${Versions.scalaPackager}" - def scalaPy = ivy"dev.scalapy::scalapy-core::0.5.3" - def scalaReflect(sv: String) = ivy"org.scala-lang:scala-reflect:$sv" - def semanticDbJavac = ivy"com.sourcegraph:semanticdb-javac:${Versions.javaSemanticdb}" - def semanticDbScalac = ivy"org.scalameta:::semanticdb-scalac:${Versions.scalaMeta}" + def scalaJsTestAdapter = mvn"org.scala-js:scalajs-sbt-test-adapter_2.13:${Scala.scalaJs}" + def scalaPackager = mvn"org.virtuslab:scala-packager_2.13:${Versions.scalaPackager}" + def scalaPackagerCli = mvn"org.virtuslab:scala-packager-cli_2.13:${Versions.scalaPackager}" + def scalaPy = mvn"dev.scalapy::scalapy-core::0.5.3" + def scalaReflect(sv: String) = mvn"org.scala-lang:scala-reflect:$sv" + def semanticDbJavac = mvn"com.sourcegraph:semanticdb-javac:${Versions.javaSemanticdb}" + def semanticDbScalac = mvn"org.scalameta:::semanticdb-scalac:${Versions.scalaMeta}" def scalametaSemanticDbShared = - ivy"org.scalameta:semanticdb-shared_2.13:${Versions.scalaMeta}" + mvn"org.scalameta:semanticdb-shared_2.13:${Versions.scalaMeta}" .exclude("org.jline" -> "jline") // to prevent incompatibilities with GraalVM <23 .exclude("com.lihaoyi" -> "sourcecode_2.13") .exclude("org.scala-lang.modules" -> "scala-collection-compat_2.13") def signingCliShared = - ivy"org.virtuslab.scala-cli-signing::shared:${Versions.signingCli}" + mvn"org.virtuslab.scala-cli-signing::shared:${Versions.signingCli}" // to prevent collisions with scala-cli's case-app version .exclude(("com.github.alexarchambault", "case-app_3")) .exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-core_3")) @@ -239,7 +239,7 @@ object Deps { .exclude(("com.lihaoyi", "os-lib_3")) .exclude(("com.lihaoyi", "os-lib_2.13")) def signingCli = - ivy"org.virtuslab.scala-cli-signing::cli:${Versions.signingCli}" + mvn"org.virtuslab.scala-cli-signing::cli:${Versions.signingCli}" // to prevent collisions with scala-cli's case-app version .exclude(("com.github.alexarchambault", "case-app_3")) .exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-core_3")) @@ -249,25 +249,25 @@ object Deps { .exclude(("org.scala-lang.modules", "scala-collection-compat_2.13")) .exclude(("com.lihaoyi", "os-lib_3")) .exclude(("com.lihaoyi", "os-lib_2.13")) - def slf4jNop = ivy"org.slf4j:slf4j-nop:2.0.17" - def sttp = ivy"com.softwaremill.sttp.client3::core:3.11.0" - def svm = ivy"org.graalvm.nativeimage:svm:$graalVmVersion" - def swoval = ivy"com.swoval:file-tree-views:2.1.12" - def testInterface = ivy"org.scala-sbt:test-interface:1.0" + def slf4jNop = mvn"org.slf4j:slf4j-nop:2.0.17" + def sttp = mvn"com.softwaremill.sttp.client3::core:3.11.0" + def svm = mvn"org.graalvm.nativeimage:svm:$graalVmVersion" + def swoval = mvn"com.swoval:file-tree-views:2.1.12" + def testInterface = mvn"org.scala-sbt:test-interface:1.0" val toolkitVersion = "0.7.0" val toolkitVersionForNative04 = "0.3.0" val toolkitVersionForNative05 = toolkitVersion - def toolkit = ivy"org.scala-lang:toolkit:$toolkitVersion" - def toolkitTest = ivy"org.scala-lang:toolkit-test:$toolkitVersion" + def toolkit = mvn"org.scala-lang:toolkit:$toolkitVersion" + def toolkitTest = mvn"org.scala-lang:toolkit-test:$toolkitVersion" val typelevelToolkitVersion = "0.1.29" - def typelevelToolkit = ivy"org.typelevel:toolkit:$typelevelToolkitVersion" - def usingDirectives = ivy"org.virtuslab:using_directives:1.1.4" + def typelevelToolkit = mvn"org.typelevel:toolkit:$typelevelToolkitVersion" + def usingDirectives = mvn"org.virtuslab:using_directives:1.1.4" // Lives at https://github.com/VirtusLab/no-crc32-zip-input-stream, see #865 // This provides a ZipInputStream that doesn't verify CRC32 checksums, that users // can enable by setting SCALA_CLI_VENDORED_ZIS=true in the environment, to workaround // some bad GraalVM / zlib issues (see #828 and linked issues for more details). - def zipInputStream = ivy"org.virtuslab.scala-cli.zip-input-stream:zip-input-stream:0.1.3" - def scalafixInterfaces = ivy"ch.epfl.scala:scalafix-interfaces:${Versions.scalafix}" + def zipInputStream = mvn"org.virtuslab.scala-cli.zip-input-stream:zip-input-stream:0.1.3" + def scalafixInterfaces = mvn"ch.epfl.scala:scalafix-interfaces:${Versions.scalafix}" } def graalVmVersion = "22.3.1" diff --git a/project/publish/package.mill.scala b/project/publish/package.mill.scala index 04d0e5abd2..ef79037d2c 100644 --- a/project/publish/package.mill.scala +++ b/project/publish/package.mill.scala @@ -107,7 +107,7 @@ private def computePublishVersion(state: VcsState, simple: Boolean): String = .getOrElse(state.format()) .stripPrefix("v") -def finalPublishVersion: Target[String] = { +def finalPublishVersion: T[String] = { val isCI = System.getenv("CI") != null if (isCI) Task(persistent = true) { @@ -125,7 +125,7 @@ def organization = "org.virtuslab.scala-cli" trait ScalaCliPublishModule extends SonatypeCentralPublishModule with PublishLocalNoFluff { import mill.scalalib.publish._ - def pomSettings: Target[PomSettings] = PomSettings( + override def pomSettings: T[PomSettings] = PomSettings( description = artifactName(), organization = organization, url = s"https://github.com/$ghOrg/$ghName", @@ -139,8 +139,8 @@ trait ScalaCliPublishModule extends SonatypeCentralPublishModule with PublishLoc Developer("MaciejG604", "Maciej Gajek", "https://github.com/MaciejG604") ) ) - def publishVersion: Target[String] = finalPublishVersion() - override def sourceJar: Target[PathRef] = Task { + override def publishVersion: T[String] = finalPublishVersion() + override def sourceJar: T[PathRef] = Task { import mill.util.Jvm.createJar val allSources0 = allSources().map(_.path).filter(os.exists).toSet createJar( diff --git a/project/settings/package.mill.scala b/project/settings/package.mill.scala index 6c2ec816ff..1bb925db1f 100644 --- a/project/settings/package.mill.scala +++ b/project/settings/package.mill.scala @@ -20,7 +20,6 @@ import io.github.alexarchambault.millnativeimage.NativeImage import mill._ import mill.api.Loose import mill.scalalib._ -import os.{CommandResult, Path} import upickle.default._ import java.io.File @@ -61,7 +60,7 @@ def fromPath(name: String): String = else name -def cs: Target[String] = Task(persistent = true) { +def cs: T[String] = Task(persistent = true) { val arch = sys.props.getOrElse("os.arch", "").toLowerCase(Locale.ROOT) val ext = if (Properties.isWin) ".exe" else "" val csVersion = if (arch == "aarch64" && Properties.isMac) buildCsM1Version else buildCsVersion @@ -156,10 +155,10 @@ trait CliLaunchers extends SbtModule { self => Task.Command(super.writeNativeImageScript(scriptDest, "")()) def launcherKind: String - def nativeImageCsCommand: Target[Seq[String]] = Seq(cs()) - def nativeImagePersist: Boolean = System.getenv("CI") != null - def nativeImageGraalVmJvmId: Target[String] = deps.graalVmJvmId - def nativeImageOptions: Target[Seq[String]] = Task { + override def nativeImageCsCommand: T[Seq[String]] = Seq(cs()) + override def nativeImagePersist: Boolean = System.getenv("CI") != null + override def nativeImageGraalVmJvmId: T[String] = deps.graalVmJvmId + override def nativeImageOptions: T[Seq[String]] = Task { val usesDocker = nativeImageDockerParams().nonEmpty val cLibPath = if (usesDocker) s"/data/$staticLibDirName" @@ -175,8 +174,8 @@ trait CliLaunchers extends SbtModule { self => Seq("-Djdk.lang.Process.launchMechanism=vfork", "-H:PageSize=65536") else Nil) } - def nativeImageName: Target[String] = "scala-cli" - def nativeImageClassPath: Target[Seq[PathRef]] = Task { + override def nativeImageName: T[String] = "scala-cli" + override def nativeImageClassPath: T[Seq[PathRef]] = Task { val launcherKindResourceDir = Task.dest / "resources" os.write( launcherKindResourceDir / launcherTypeResourcePath, @@ -185,7 +184,7 @@ trait CliLaunchers extends SbtModule { self => ) PathRef(launcherKindResourceDir) +: self.nativeImageClassPath() } - def nativeImageMainClass: Target[String] = self.nativeImageMainClass() + override def nativeImageMainClass: T[String] = self.nativeImageMainClass() private def staticLibDirName = "native-libs" @@ -275,7 +274,7 @@ trait CliLaunchers extends SbtModule { self => System.err.println(s"Calling ${proc.command.flatMap(_.value).mkString(" ")}") proc.call(stdin = os.Inherit, stdout = os.Inherit) } - def staticLibDir: Target[PathRef] = Task { + def staticLibDir: T[PathRef] = Task { val dir = nativeImageDockerWorkingDir() / staticLibDirName os.makeDir.all(dir) @@ -295,7 +294,7 @@ trait CliLaunchers extends SbtModule { self => } object `base-image` extends CliNativeImage { - def launcherKind = "default" + override def launcherKind = "default" } private def maybePassNativeImageJpmsOption = @@ -305,8 +304,8 @@ trait CliLaunchers extends SbtModule { self => } object `linux-docker-image` extends CliNativeImage { - def launcherKind: String = `base-image`.launcherKind - def nativeImageDockerParams: Target[Option[NativeImage.DockerParams]] = Some( + override def launcherKind: String = `base-image`.launcherKind + override def nativeImageDockerParams: T[Option[NativeImage.DockerParams]] = Some( NativeImage.DockerParams( imageName = s"ubuntu:$ubuntuVersion", prepareCommand = @@ -339,13 +338,13 @@ trait CliLaunchers extends SbtModule { self => ) object `static-image` extends CliNativeImage { - def launcherKind = "static" - def nativeImageOptions: Target[Seq[String]] = Task { + override def launcherKind = "static" + override def nativeImageOptions: T[Seq[String]] = Task { super.nativeImageOptions() ++ Seq( "-J-Dscala-cli.static-launcher=true" ) } - def nativeImageDockerParams: Target[Option[NativeImage.DockerParams]] = Task { + override def nativeImageDockerParams: T[Option[NativeImage.DockerParams]] = Task { val baseDockerParams = NativeImage.linuxStaticParams( Docker.muslBuilder, s"https://github.com/coursier/coursier/releases/download/v${deps.csDockerVersion}/cs-x86_64-pc-linux.gz" @@ -354,7 +353,7 @@ trait CliLaunchers extends SbtModule { self => buildHelperImage() Some(dockerParams) } - def buildHelperImage: Target[Unit] = Task { + def buildHelperImage: T[Unit] = Task { os.proc("docker", "build", "-t", Docker.customMuslBuilderImageName, ".") .call(cwd = Task.workspace / "project" / "musl-image", stdout = os.Inherit) () @@ -367,8 +366,8 @@ trait CliLaunchers extends SbtModule { self => } object `mostly-static-image` extends CliNativeImage { - def launcherKind = "mostly-static" - def nativeImageDockerParams: Target[Option[NativeImage.DockerParams]] = Task { + override def launcherKind = "mostly-static" + override def nativeImageDockerParams: T[Option[NativeImage.DockerParams]] = Task { val baseDockerParams = NativeImage.linuxMostlyStaticParams( s"ubuntu:$ubuntuVersion", s"https://github.com/coursier/coursier/releases/download/v${deps.csDockerVersion}/cs-x86_64-pc-linux.gz" @@ -380,7 +379,7 @@ trait CliLaunchers extends SbtModule { self => def localRepoJar: T[PathRef] - def nativeImageMainClass: Target[String] = Task { + def nativeImageMainClass: T[String] = Task { mainClass().getOrElse(sys.error("Don't know what main class to use")) } @@ -393,26 +392,26 @@ trait CliLaunchers extends SbtModule { self => } Task { - mill.define.Target.traverse(allModuleDeps(this :: Nil).distinct)(m => + mill.define.Task.traverse(allModuleDeps(this :: Nil).distinct)(m => Task.Anon(m.jar()) )() } } - def nativeImageClassPath: Target[Seq[PathRef]] = Task { + def nativeImageClassPath: T[Seq[PathRef]] = Task { val localRepoJar0 = localRepoJar() runClasspath() :+ localRepoJar0 // isn't localRepoJar already there? } - def nativeImage: Target[PathRef] = + def nativeImage: T[PathRef] = if (Properties.isLinux && arch == "x86_64" && isCI) `linux-docker-image`.nativeImage else `base-image`.nativeImage - def nativeImageStatic: Target[PathRef] = + def nativeImageStatic: T[PathRef] = `static-image`.nativeImage - def nativeImageMostlyStatic: Target[PathRef] = + def nativeImageMostlyStatic: T[PathRef] = `mostly-static-image`.nativeImage def runWithAssistedConfig(args: String*): Command[Unit] = Task.Command { @@ -438,7 +437,7 @@ trait CliLaunchers extends SbtModule { self => } @unused - def runFromJars(args: String*): Command[CommandResult] = Task.Command { + def runFromJars(args: String*): Command[os.CommandResult] = Task.Command { val cp = jarClassPath().map(_.path).mkString(File.pathSeparator) val mainClass0 = mainClass().getOrElse(sys.error("No main class")) val command = Seq("java", "-cp", cp, mainClass0) ++ args @@ -448,16 +447,16 @@ trait CliLaunchers extends SbtModule { self => ) } - def runClasspath: Target[Seq[PathRef]] = Task { + override def runClasspath: T[Seq[PathRef]] = Task { super.runClasspath() ++ Seq(localRepoJar()) } - def jarClassPath: Target[Seq[PathRef]] = Task { + def jarClassPath: T[Seq[PathRef]] = Task { val cp = runClasspath() ++ transitiveJarsAgg() cp.filter(ref => os.exists(ref.path) && !os.isDir(ref.path)) } - def launcher: Target[PathRef] = Task { + override def launcher: T[PathRef] = Task { import coursier.launcher.{BootstrapGenerator, ClassPathEntry, Parameters, Preamble} import scala.util.Properties.isWin @@ -480,7 +479,7 @@ trait CliLaunchers extends SbtModule { self => PathRef(dest) } - def standaloneLauncher: Target[PathRef] = Task { + def standaloneLauncher: T[PathRef] = Task { val cachePath = os.Path(coursier.cache.FileCache().location, Task.workspace) def urlOf(path: os.Path): Option[String] = if (path.startsWith(cachePath)) { @@ -524,7 +523,7 @@ trait CliLaunchers extends SbtModule { self => } trait HasTests extends SbtModule { - def scalacOptions: Target[Seq[String]] = Task { + override def scalacOptions: T[Seq[String]] = Task { val sv = scalaVersion() val isScala213 = sv.startsWith("2.13.") val extraOptions = @@ -533,13 +532,13 @@ trait HasTests extends SbtModule { super.scalacOptions() ++ extraOptions } trait ScalaCliTests extends ScalaCliModule with super.SbtTests with TestModule.Munit { - def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg( + override def ivyDeps: T[Agg[Dep]] = super.ivyDeps() ++ Agg( Deps.expecty, Deps.munit ) - def forkArgs: Target[Seq[String]] = super.forkArgs() ++ Seq("-Xmx512m", "-Xms128m") + override def forkArgs: T[Seq[String]] = super.forkArgs() ++ Seq("-Xmx512m", "-Xms128m") - def repositoriesTask: Task[Seq[Repository]] = + override def repositoriesTask: Task[Seq[Repository]] = Task.Anon(super.repositoriesTask() ++ deps.customRepositories) override def testFramework: T[String] = super.testFramework @@ -547,7 +546,7 @@ trait HasTests extends SbtModule { } trait PublishLocalNoFluff extends SonatypeCentralPublishModule { - def emptyZip: Target[PathRef] = Task { + def emptyZip: T[PathRef] = Task { import java.io._ import java.util.zip._ val dest = Task.dest / "empty.zip" @@ -587,13 +586,13 @@ trait LocalRepo extends Module { def stubsModules: Seq[PublishLocalNoFluff] def version: T[String] - def localRepo: Target[Seq[PathRef]] = Task { + def localRepo: T[Seq[PathRef]] = Task { val repoRoot = os.rel / "out" / "repo" / "{VERSION}" val tasks = stubsModules.map(_.publishLocalNoFluff(repoRoot.toString)) - define.Target.sequence(tasks) + define.Task.sequence(tasks) } - private def vcsState: Target[VcsState] = + private def vcsState: T[VcsState] = if (isCI) Task(persistent = true) { VcsVersion.vcsState() @@ -602,7 +601,7 @@ trait LocalRepo extends Module { Task { VcsVersion.vcsState() } - def localRepoZip: Target[PathRef] = Task { + def localRepoZip: T[PathRef] = Task { val repoVer = vcsState().format() val ver = version() localRepo() @@ -647,7 +646,7 @@ trait LocalRepo extends Module { PathRef(dest) } - def localRepoJar: Target[PathRef] = Task { + def localRepoJar: T[PathRef] = Task { val zip = localRepoZip().path val dest = Task.dest / "repo.jar" @@ -729,7 +728,7 @@ private def doFormatNativeImageConf(dir: os.Path, format: Boolean): List[os.Path } trait FormatNativeImageConf extends JavaModule { - def nativeImageConfDirs: Target[Seq[Path]] = Task { + def nativeImageConfDirs: T[Seq[os.Path]] = Task { resources() .map(_.path / "META-INF" / "native-image") .filter(os.exists(_)) @@ -775,19 +774,19 @@ trait FormatNativeImageConf extends JavaModule { trait ScalaCliScalafixModule extends ScalafixModule { - override def semanticDbVersion: Target[String] = Deps.Versions.scalaMeta + override def semanticDbVersion: T[String] = Deps.Versions.scalaMeta - def scalafixConfig: Target[Option[Path]] = Task { + def scalafixConfig: T[Option[os.Path]] = Task { if (scalaVersion().startsWith("2.")) super.scalafixConfig() else Some(Task.workspace / ".scalafix3.conf") } - def scalacPluginIvyDeps: Target[Loose.Agg[Dep]] = super.scalacPluginIvyDeps() ++ { + def scalacPluginIvyDeps: T[Loose.Agg[Dep]] = super.scalacPluginIvyDeps() ++ { if (scalaVersion().startsWith("2.")) Seq(Deps.semanticDbScalac) else Nil } // Explicitly setting sourceroot, so that Scala CLI doesn't use a wrong one. // Using Task.workspace is more or less required, for scalafix stuff to work fine. - def scalacOptions: Target[Seq[String]] = Task { + def scalacOptions: T[Seq[String]] = Task { val sv = scalaVersion() val isScala2 = sv.startsWith("2.") val sourceRoot = Task.workspace @@ -818,7 +817,7 @@ trait ScalaCliScalafixModule extends ScalafixModule { // meant to be used with modules which still have to be cross-compiled on Scala 2.12 trait ScalaCliScalafixLegacyModule extends ScalaCliScalafixModule { - override def scalafixConfig: Target[Option[Path]] = Task { + override def scalafixConfig: T[Option[os.Path]] = Task { Some(Task.workspace / ".scalafix.legacy.conf") } } @@ -826,11 +825,11 @@ trait ScalaCliScalafixLegacyModule extends ScalaCliScalafixModule { trait ScalaCliCrossSbtModule extends CrossSbtModule with ScalaCliModule trait ScalaCliModule extends ScalaModule { - def javacOptions: Target[Seq[String]] = super.javacOptions() ++ Seq( + def javacOptions: T[Seq[String]] = super.javacOptions() ++ Seq( "--release", "16" ) - def scalacOptions: Target[Seq[String]] = Task { + def scalacOptions: T[Seq[String]] = Task { val sv = scalaVersion() val isScala213 = sv.startsWith("2.13.") val extraOptions =