diff --git a/.mill-version b/.mill-version index 511144623b..f25c43cdc2 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.10.12 \ No newline at end of file +0.10.13 diff --git a/build.sc b/build.sc index 97184549b4..7b3707ace0 100644 --- a/build.sc +++ b/build.sc @@ -1,4 +1,5 @@ -import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION` +import $file.project.millconfig +import $ivy.`com.lihaoyi::mill-contrib-bloop:` import $ivy.`io.get-coursier.util::get-cs:0.1.1` import $file.project.deps, deps.{Deps, ScalaVersions, scalaCliVersion} import $file.project.docs @@ -135,13 +136,13 @@ object `bootstrap-launcher` extends BootstrapLauncher { self => def proguardClassPath = T { proguard.runClasspath() } - object test extends Tests with CsTests { + object test extends SbtModuleTests with CsTests { def ivyDeps = super.ivyDeps() ++ Seq( Deps.collectionCompat, Deps.java8Compat ) } - object it extends Tests with CsTests { + object it extends SbtModuleTests with CsTests { def sources = T.sources( millSourcePath / "src" / "it" / "scala", millSourcePath / "src" / "it" / "java" @@ -207,7 +208,7 @@ class CoreJvm(val crossScalaVersion: String) extends CoreJvmBase { Deps.concurrentReferenceHashMap, Deps.scalaXml ) - object test extends Tests with CsTests { + object test extends CrossSbtModuleTests with CsTests { def ivyDeps = super.ivyDeps() ++ Agg( Deps.jol ) @@ -220,7 +221,7 @@ class CoreJs(val crossScalaVersion: String) extends Core with CsScalaJsModule { def ivyDeps = super.ivyDeps() ++ Agg( Deps.scalaJsDom ) - object test extends Tests with CsTests + object test extends ScalaJSTests with CsTests } class SbtMavenRepositoryJvm(val crossScalaVersion: String) extends SbtMavenRepositoryJvmBase { @@ -259,7 +260,7 @@ class CacheJvm(val crossScalaVersion: String) extends CacheJvmBase { def customLoaderCp = T { `custom-protocol-for-test`.runClasspath() } - object test extends Tests with CsTests { + object test extends CacheJvmBaseTests with CsTests { def ivyDeps = super.ivyDeps() ++ Agg( Deps.http4sBlazeServer, Deps.http4sDsl, @@ -309,7 +310,7 @@ class Env(val crossScalaVersion: String) extends CrossSbtModule with CsModule Deps.collectionCompat, Deps.jniUtils ) - object test extends Tests with CsTests { + object test extends CrossSbtModuleTests with CsTests { def ivyDeps = super.ivyDeps() ++ Agg( Deps.jimfs ) @@ -336,8 +337,8 @@ class CoursierJvm(val crossScalaVersion: String) extends CoursierJvmBase { self `proxy-setup` ) // Put CoursierTests right after TestModule, and see what happens - object test extends TestModule with Tests with CoursierTests with CsTests with JvmTests - object it extends TestModule with Tests with CoursierTests with CsTests with JvmTests { + object test extends TestModule with CrossSbtModuleTests with CoursierTests with CsTests with JvmTests + object it extends TestModule with CrossSbtModuleTests with CoursierTests with CsTests with JvmTests { def sources = T.sources( millSourcePath / "src" / "it" / "scala", millSourcePath / "src" / "it" / "java" @@ -360,7 +361,7 @@ class CoursierJs(val crossScalaVersion: String) extends Coursier with CsScalaJsM core.js(), cache.js() ) - object test extends Tests with CsTests with JsTests with CoursierTests + object test extends ScalaJSTests with CsTests with JsTests with CoursierTests } class TestsJvm(val crossScalaVersion: String) extends TestsModule { self => @@ -371,12 +372,12 @@ class TestsJvm(val crossScalaVersion: String) extends TestsModule { self => def ivyDeps = super.ivyDeps() ++ Agg( Deps.jsoup ) - object test extends Tests with CsTests with JvmTests { + object test extends CrossSbtModuleTests with CsTests with JvmTests { def moduleDeps = super.moduleDeps ++ Seq( coursier.jvm() ) } - object it extends Tests with CsTests with JvmTests with workers.UsesRedirectingServer { + object it extends CrossSbtModuleTests with CsTests with JvmTests with workers.UsesRedirectingServer { def redirectingServerCp = `redirecting-server`.runClasspath() def redirectingServerMainClass = @@ -407,7 +408,7 @@ class TestsJs(val crossScalaVersion: String) extends TestsModule with CsScalaJsM `sbt-maven-repository`.js() ) // testOptions := testOptions.dependsOn(runNpmInstallIfNeeded).value - object test extends Tests with CsTests with JsTests { + object test extends ScalaJSTests with CsTests with JsTests { def moduleDeps = super.moduleDeps ++ Seq( coursier.js() ) @@ -423,7 +424,7 @@ class ProxyTests(val crossScalaVersion: String) extends CrossSbtModule with CsMo Deps.scalaAsync, Deps.slf4JNop ) - object it extends Tests with CsTests { + object it extends CrossSbtModuleTests with CsTests { def sources = T.sources( millSourcePath / "src" / "it" / "scala", millSourcePath / "src" / "it" / "java" @@ -443,7 +444,7 @@ class ScalazJvm(val crossScalaVersion: String) extends Scalaz with CsMima { def ivyDeps = super.ivyDeps() ++ Agg( Deps.scalazConcurrent ) - object test extends Tests with CsTests { + object test extends CrossSbtModuleTests with CsTests { def moduleDeps = super.moduleDeps ++ Seq( tests.jvm().test ) @@ -462,7 +463,7 @@ class CatsJvm(val crossScalaVersion: String) extends Cats with CsMima { def moduleDeps = Seq( cache.jvm() ) - object test extends Tests with CsTests { + object test extends CrossSbtModuleTests with CsTests { def moduleDeps = super.moduleDeps ++ Seq( tests.jvm().test ) @@ -493,7 +494,7 @@ class Install(val crossScalaVersion: String) extends CrossSbtModule with CsModul Deps.argonautShapeless, Deps.catsCore ) - object test extends Tests with CsTests + object test extends CrossSbtModuleTests with CsTests } class Jvm(val crossScalaVersion: String) extends CrossSbtModule with CsModule @@ -515,7 +516,7 @@ class Jvm(val crossScalaVersion: String) extends CrossSbtModule with CsModule Deps.argonautShapeless, Deps.jsoniterCore ) - object test extends Tests with CsTests { + object test extends CrossSbtModuleTests with CsTests { def ivyDeps = super.ivyDeps() ++ Seq( Deps.osLib ) @@ -573,7 +574,7 @@ class Cli(val crossScalaVersion: String) extends CsCrossJvmJsModule os.write.over(jar, baos.toByteArray) PathRef(jar) } - object test extends Tests with CsTests + object test extends CrossSbtModuleTests with CsTests } class CliTests(val crossScalaVersion: String) extends CsCrossJvmJsModule @@ -592,7 +593,7 @@ class CliTests(val crossScalaVersion: String) extends CsCrossJvmJsModule private def sharedTestArgs = Seq( s"-Dcoursier-test.scala-cli=${GetCs.scalaCli(scalaCliVersion)}" ) - object test extends Tests with CsTests { + object test extends CrossSbtModuleTests with CsTests { def forkArgs = { val launcherTask = cli().launcher.map(_.path) val assemblyTask = cli().assembly.map(_.path) @@ -606,7 +607,7 @@ class CliTests(val crossScalaVersion: String) extends CsCrossJvmJsModule } } } - trait NativeTests extends Tests with CsTests with Bloop.Module { + trait NativeTests extends CrossSbtModuleTests with CsTests with Bloop.Module { def cliLauncher: T[PathRef] def skipBloop = true def sources = T.sources { @@ -698,7 +699,7 @@ def simpleNative04CliTest() = T.command { os.proc(tmpDir / "native-echo", "-n", "foo", "a").call() } finally cleanUp() - assert(res.out.text == "foo a") + assert(res.out.text() == "foo a") } def copyTo(task: mill.main.Tasks[PathRef], dest: os.Path) = T.command { if (task.value.length > 1) diff --git a/project/cs.sc b/project/cs.sc index fabc0b71f1..efba7c64f5 100644 --- a/project/cs.sc +++ b/project/cs.sc @@ -19,7 +19,7 @@ lazy val cs: String = candidates .filter(_.canExecute) - .toStream + .to(LazyList) .headOption .map(_.getAbsolutePath) .getOrElse { diff --git a/project/docs.sc b/project/docs.sc index 6d54450b3c..6157b64b4a 100644 --- a/project/docs.sc +++ b/project/docs.sc @@ -224,6 +224,6 @@ def gitRepoHasChanges(repo: os.Path): Boolean = { stderr = os.Pipe, mergeErrIntoOut = true ) - val output = res.out.text + val output = res.out.text() !output.contains("nothing to commit") } diff --git a/project/ghreleaseassets.sc b/project/ghreleaseassets.sc index 1b5c3d1ef0..48d11937aa 100644 --- a/project/ghreleaseassets.sc +++ b/project/ghreleaseassets.sc @@ -1,7 +1,6 @@ // from https://github.com/coursier/coursier/blob/382250d4f26b4728400a0546088e27ca0f129e8b/scripts/shared/UploadGhRelease.sc import $ivy.`com.softwaremill.sttp.client::core:2.0.0-RC6` -import $ivy.`com.lihaoyi::ujson:0.9.5` import $file.docs, docs.gitRepoHasChanges import $file.launchers, launchers.{platformExtension, platformSuffix} diff --git a/project/launchers.sc b/project/launchers.sc index 2b97eb2d6e..4374f30d93 100644 --- a/project/launchers.sc +++ b/project/launchers.sc @@ -1,5 +1,5 @@ import $ivy.`io.get-coursier::coursier-launcher:2.1.0` -import $ivy.`io.github.alexarchambault.mill::mill-native-image::0.1.23` +import $ivy.`io.github.alexarchambault.mill::mill-native-image::0.1.26` import $file.cs import $file.deps, deps.{Deps, Docker, graalVmJvmId, jvmIndex} @@ -61,7 +61,7 @@ trait Launchers extends CsModule { "-A", "lib" ).call() - val libPath = os.Path(libRes.out.text.trim, os.pwd) + val libPath = os.Path(libRes.out.text().trim(), os.pwd) os.copy.over(libPath, destDir / "csjniutils.lib") } diff --git a/project/millconfig.sc b/project/millconfig.sc new file mode 100644 index 0000000000..4395e054d2 --- /dev/null +++ b/project/millconfig.sc @@ -0,0 +1,5 @@ +interp.configureCompiler { c => + c.settings.nowarnings.value = false + c.settings.deprecation.value = true + c.settings.maxwarns.value = 100 +} diff --git a/project/mima.sc b/project/mima.sc index ba537ed9fb..191f002fa1 100644 --- a/project/mima.sc +++ b/project/mima.sc @@ -25,7 +25,7 @@ trait Mima extends ScalaModule with PublishModule { val lib = new MiMaLib(classPath.map(_.path.toIO)) - mimaPreviousArtifacts().toList.map(_.path).map { path => + mimaPreviousArtifacts().iterator.toList.map(_.path).map { path => val problems = lib.collectProblems(path.toIO, currentClassFiles.toIO) path.toString -> problems.filter { problem => mimaBinaryIssueFilters.forall(_.apply(problem)) diff --git a/project/modules/bootstrap-launcher0.sc b/project/modules/bootstrap-launcher0.sc index 6e695816ac..5fdbd94dd8 100644 --- a/project/modules/bootstrap-launcher0.sc +++ b/project/modules/bootstrap-launcher0.sc @@ -84,7 +84,7 @@ trait BootstrapLauncher extends CsModule { def assembly = T { val baseJar = jar().path - val cp = upstreamAssemblyClasspath().toSeq.map(_.path) + val cp = upstreamAssemblyClasspath().iterator.toSeq.map(_.path) val mainClass0 = mainClass().getOrElse(sys.error("No main class")) val dest = T.dest / "bootstrap-orig.jar" @@ -130,7 +130,7 @@ trait BootstrapLauncher extends CsModule { def resourceAssemblyMainClass = T("coursier.bootstrap.launcher.ResourcesLauncher") def resourceAssembly = T { val baseJar = jar().path - val cp = upstreamAssemblyClasspath().toSeq.map(_.path) + val cp = upstreamAssemblyClasspath().iterator.toSeq.map(_.path) val mainClass0 = resourceAssemblyMainClass() val dest = T.dest / "bootstrap-orig.jar" diff --git a/project/modules/cache0.sc b/project/modules/cache0.sc index 072661979e..7d70084c4b 100644 --- a/project/modules/cache0.sc +++ b/project/modules/cache0.sc @@ -43,7 +43,7 @@ trait CacheJvmBase extends Cache with CsMima with Shading { ) } - trait Tests extends super.Tests { + trait CacheJvmBaseTests extends CrossSbtModuleTests { def sources = T.sources { val dest = T.dest / "CustomLoaderClasspath.scala" val customLoaderCp0 = customLoaderCp() diff --git a/project/modules/shared.sc b/project/modules/shared.sc index 008d21927c..be64d52b78 100644 --- a/project/modules/shared.sc +++ b/project/modules/shared.sc @@ -10,26 +10,26 @@ trait CsMima extends Mima { } def commitHash = T { - os.proc("git", "rev-parse", "HEAD").call().out.text.trim + os.proc("git", "rev-parse", "HEAD").call().out.text().trim() } lazy val latestTaggedVersion = os.proc("git", "describe", "--abbrev=0", "--tags", "--match", "v*") .call().out - .trim + .trim() lazy val buildVersion = { - val gitHead = os.proc("git", "rev-parse", "HEAD").call().out.trim + val gitHead = os.proc("git", "rev-parse", "HEAD").call().out.trim() val maybeExactTag = scala.util.Try { os.proc("git", "describe", "--exact-match", "--tags", "--always", gitHead) .call().out - .trim + .trim() .stripPrefix("v") } maybeExactTag.toOption.getOrElse { val commitsSinceTaggedVersion = - os.proc('git, "rev-list", gitHead, "--not", latestTaggedVersion, "--count") - .call().out.trim + os.proc("git", "rev-list", gitHead, "--not", latestTaggedVersion, "--count") + .call().out.trim() .toInt - val gitHash = os.proc("git", "rev-parse", "--short", "HEAD").call().out.trim + val gitHash = os.proc("git", "rev-parse", "--short", "HEAD").call().out.trim() s"${latestTaggedVersion.stripPrefix("v")}-$commitsSinceTaggedVersion-$gitHash-SNAPSHOT" } } @@ -139,7 +139,7 @@ trait CsModule extends SbtModule { super.scalacPluginIvyDeps() ++ scala212Plugins } def sources = T.sources { - val sbv = mill.scalalib.api.Util.scalaBinaryVersion(scalaVersion()) + val sbv = mill.scalalib.api.ZincWorkerUtil.scalaBinaryVersion(scalaVersion()) val parent = super.sources() val extra = parent.map(_.path).filter(_.last == "scala").flatMap { p => val dirNames = Seq(s"scala-$sbv") diff --git a/project/publishing.sc b/project/publishing.sc index 10a228ce6d..88cda987a8 100644 --- a/project/publishing.sc +++ b/project/publishing.sc @@ -48,6 +48,8 @@ def publishSonatype( readTimeout = timeout.toMillis.toInt, connectTimeout = timeout.toMillis.toInt, log = log, + workspace = os.pwd, + env = sys.env, awaitTimeout = timeout.toMillis.toInt, stagingRelease = isRelease ) diff --git a/project/relativize.sc b/project/relativize.sc index 267b0d196c..519c0ae0b5 100644 --- a/project/relativize.sc +++ b/project/relativize.sc @@ -11,7 +11,7 @@ import java.nio.file.attribute.BasicFileAttributes import org.jsoup.Jsoup import org.jsoup.nodes.Element -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ def relativize(site: Path): Unit = Files.walkFileTree( diff --git a/project/shading.sc b/project/shading.sc index 1da3789e3f..b433d736d1 100644 --- a/project/shading.sc +++ b/project/shading.sc @@ -7,7 +7,7 @@ import mill._, mill.scalalib._ import java.io._ import java.util.zip._ -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.concurrent.ExecutionContext.Implicits.global trait Shading extends JavaModule with PublishModule { @@ -26,7 +26,8 @@ trait Shading extends JavaModule with PublishModule { force = depSeq.filter(_.force).map(depToDependency), mapDependencies = Some(mapDependencies()), customizer = resolutionCustomizer(), - ctx = Some(implicitly[mill.api.Ctx.Log]) + ctx = Some(implicitly[mill.api.Ctx.Log]), + coursierCacheCustomizer = None ) val types = Set( coursier.Type.jar, @@ -42,7 +43,7 @@ trait Shading extends JavaModule with PublishModule { val loadedArtifacts = Gather[Task].gather( for (a <- artifacts) yield coursier.cache.Cache.default.file(a).run.map(a.optional -> _) - ).unsafeRun + ).unsafeRun() val errors = loadedArtifacts.collect { case (false, Left(x)) => x @@ -57,7 +58,7 @@ trait Shading extends JavaModule with PublishModule { val allJars = load(resolution) val retainedJars = - load(resolution.subset(depSeq.toSeq.filterNot(shadedDepSeq.toSet).map(depToDependency))) + load(resolution.subset(depSeq.iterator.toSeq.filterNot(shadedDepSeq.iterator.toSet).map(depToDependency))) val shadedJars = allJars.filterNot(retainedJars.toSet) println(s"${shadedJars.length} JAR(s) to shade") @@ -180,6 +181,6 @@ trait Shading extends JavaModule with PublishModule { val convert = resolvePublishDependency().apply(_) val orig = super.publishXmlDeps() val shaded = shadedDependencies().iterator.map(convert).toSet - Agg(orig.toSeq.filterNot(shaded): _*) + Agg(orig.iterator.toSeq.filterNot(shaded): _*) } } diff --git a/project/workers.sc b/project/workers.sc index 6fbb5ca4d2..7870853ae1 100644 --- a/project/workers.sc +++ b/project/workers.sc @@ -61,13 +61,13 @@ trait UsesRedirectingServer extends Module { server.proc.stdin.close() var serverRunning = false var countDown = 20 - while (!serverRunning && server.proc.isAlive && countDown > 0) { + while (!serverRunning && server.proc.isAlive() && countDown > 0) { serverRunning = server.healthCheck() if (!serverRunning) Thread.sleep(500L) countDown -= 1 } - if (serverRunning && server.proc.isAlive) + if (serverRunning && server.proc.isAlive()) server else sys.error("Cannot run redirecting server") @@ -136,13 +136,13 @@ def testRepoServer = T.worker { server.proc.stdin.close() var serverRunning = false var countDown = 20 - while (!serverRunning && server.proc.isAlive && countDown > 0) { + while (!serverRunning && server.proc.isAlive() && countDown > 0) { serverRunning = server.healthCheck() if (!serverRunning) Thread.sleep(500L) countDown -= 1 } - if (serverRunning && server.proc.isAlive) { + if (serverRunning && server.proc.isAlive()) { T.log.outputStream.println(s"Test repository listening on ${server.url}") server }