From 9374e4d66011d7044f99f6a144741ba53619fe85 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 22 May 2024 10:30:20 +0200 Subject: [PATCH 1/5] Auto-add essential scalaBridge versions --- build.sc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/build.sc b/build.sc index fd99044b7a2..a643f6662f1 100644 --- a/build.sc +++ b/build.sc @@ -192,7 +192,6 @@ object Deps { val jarjarabrams = ivy"com.eed3si9n.jarjarabrams::jarjar-abrams-core:1.14.0" val requests = ivy"com.lihaoyi::requests:0.8.2" - /** Used to manage transitive versions. */ val transitiveDeps = Seq( ivy"org.apache.ant:ant:1.10.14", @@ -236,10 +235,14 @@ def millBinPlatform: T[String] = T { def baseDir = build.millSourcePath -val bridgeScalaVersions = Seq( +val bridgeScalaVersions = (Seq( + Deps.scalaVersion, + Deps.scalaVersionForScoverageWorker1, + Deps.workerScalaVersion212 +) ++ Seq( // Our version of Zinc doesn't work with Scala 2.12.0 and 2.12.4 compiler // bridges. We skip 2.12.1 because it's so old not to matter, and we need a - // non-supported scala versionm for testing purposes. We skip 2.13.0-2 because + // non-supported scala version for testing purposes. We skip 2.13.0-2 because // scaladoc fails on windows /*"2.12.0",*/ /*2.12.1",*/ "2.12.2", "2.12.3", /*"2.12.4",*/ "2.12.5", @@ -257,7 +260,8 @@ val bridgeScalaVersions = Seq( "2.12.17", "2.12.18", "2.12.19", - /*"2.13.0", "2.13.1", "2.13.2",*/ "2.13.3", + /*"2.13.0", "2.13.1", "2.13.2",*/ + "2.13.3", "2.13.4", "2.13.5", "2.13.6", @@ -267,8 +271,9 @@ val bridgeScalaVersions = Seq( "2.13.10", "2.13.11", "2.13.12", - "2.13.13" -) + "2.13.13", + "2.13.14" +)).distinct // We limit the number of compiler bridges to compile and publish for local // development and testing, because otherwise it takes forever to compile all From 590025e6dccf25d78fa482f344214e7160d81280 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 22 May 2024 10:57:26 +0200 Subject: [PATCH 2/5] Build essential compiler bridge jars in CI --- .github/workflows/actions.yml | 9 ++++++++- .github/workflows/run-mill-action.yml | 5 +++++ build.sc | 13 ++++++------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 5957a62ea31..d75c0f9dc1f 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -53,7 +53,6 @@ jobs: ./mill -i -k __.ivyDepsTree ./mill -i -k __.ivyDepsTree --withRuntime - uses: ./.github/workflows/run-mill-action.yml with: java-version: ${{ matrix.java-version }} @@ -86,11 +85,19 @@ jobs: - java-version: 17 millargs: docs.githubPages + uses: ./.github/workflows/run-mill-action.yml with: java-version: ${{ matrix.java-version }} millargs: ${{ matrix.millargs }} + compiler-bridge: + uses: ./.github/workflows/run-mill-action.yml + with: + java-version: '8' + millargs: bridge.__.publishLocal + env-bridge-versions: 'essential' + format-check: uses: ./.github/workflows/run-mill-action.yml with: diff --git a/.github/workflows/run-mill-action.yml b/.github/workflows/run-mill-action.yml index 40e4d787dce..0e2c8b888b4 100644 --- a/.github/workflows/run-mill-action.yml +++ b/.github/workflows/run-mill-action.yml @@ -21,6 +21,9 @@ on: timeout-minutes: default: 90 type: number + env-bridge-versions: + default: '' + type: string jobs: build: @@ -28,6 +31,8 @@ jobs: runs-on: ${{ inputs.os }} continue-on-error: ${{ inputs.continue-on-error }} timeout-minutes: ${{ inputs.timeout-minutes }} + env: + MILL_COMPILER_BRIDGE_VERSIONS: ${{ inputs.env-bridge-versions }} steps: - uses: actions/checkout@v4 diff --git a/build.sc b/build.sc index a643f6662f1..93e3afb3c4b 100644 --- a/build.sc +++ b/build.sc @@ -235,11 +235,9 @@ def millBinPlatform: T[String] = T { def baseDir = build.millSourcePath -val bridgeScalaVersions = (Seq( - Deps.scalaVersion, - Deps.scalaVersionForScoverageWorker1, - Deps.workerScalaVersion212 -) ++ Seq( +val essentialBridgeScalaVersions = + Seq(Deps.scalaVersion, Deps.scalaVersionForScoverageWorker1, Deps.workerScalaVersion212) +val bridgeScalaVersions = (essentialBridgeScalaVersions ++ Seq( // Our version of Zinc doesn't work with Scala 2.12.0 and 2.12.4 compiler // bridges. We skip 2.12.1 because it's so old not to matter, and we need a // non-supported scala version for testing purposes. We skip 2.13.0-2 because @@ -282,9 +280,10 @@ val bridgeScalaVersions = (Seq( // if given. val compilerBridgeScalaVersions = interp.watchValue(sys.env.get("MILL_COMPILER_BRIDGE_VERSIONS")) match { - case None => Seq.empty[String] + case None | Some("") => Seq.empty[String] case Some("all") => bridgeScalaVersions - case Some(versions) => versions.split(',').map(_.trim).toSeq + case Some("essential") => essentialBridgeScalaVersions + case Some(versions) => versions.split(',').map(_.trim()).toSeq } val bridgeVersion = "0.0.1" From 83e5ad79d3fae00a6b99c66e6fd86969504e8cc6 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 22 May 2024 15:17:16 +0200 Subject: [PATCH 3/5] Rework compiler bridge build setup, add missing dependencies Fix https://github.com/com-lihaoyi/mill/issues/2576 --- build.sc | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/build.sc b/build.sc index 93e3afb3c4b..f9dcbaaaa11 100644 --- a/build.sc +++ b/build.sc @@ -529,7 +529,8 @@ trait BridgeModule extends MillPublishJavaModule with CrossScalaModule { def pomSettings = commonPomSettings(artifactName()) def crossFullScalaVersion = true def ivyDeps = Agg( - ivy"org.scala-sbt:compiler-interface:${Versions.zinc}", + ivy"org.scala-sbt:compiler-interface:${Deps.zinc.version}", + ivy"org.scala-sbt:util-interface:${Deps.zinc.version}", ivy"org.scala-lang:scala-compiler:${crossScalaVersion}" ) @@ -538,23 +539,21 @@ trait BridgeModule extends MillPublishJavaModule with CrossScalaModule { Seq(PathRef(T.dest)) } - def generatedSources = T { - import mill.scalalib.api.ZincWorkerUtil.{grepJar, scalaBinaryVersion} - val resolvedJars = resolveDeps( - T.task { - Agg(ivy"org.scala-sbt::compiler-bridge:${Deps.zinc.dep.version}").map(bindDependency()) - }, + def compilerBridgeIvyDeps: T[Agg[Dep]] = Agg( + ivy"org.scala-sbt::compiler-bridge:${Deps.zinc.version}".exclude("*" -> "*") + ) + + def compilerBridgeSourceJars: T[Agg[PathRef]] = T { + resolveDeps( + T.task { compilerBridgeIvyDeps().map(bindDependency()) }, sources = true )() + } - val bridgeJar = grepJar( - resolvedJars, - s"compiler-bridge_${scalaBinaryVersion(scalaVersion())}", - Deps.zinc.dep.version, - true - ) - - mill.api.IO.unpackZip(bridgeJar.path, os.rel) + def generatedSources = T { + compilerBridgeSourceJars().foreach { jar => + mill.api.IO.unpackZip(jar.path, os.rel) + } Seq(PathRef(T.dest)) } From c31665ffe6f5cb69eaa73da424067b357124724e Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 22 May 2024 15:39:21 +0200 Subject: [PATCH 4/5] . --- .github/workflows/actions.yml | 2 +- .github/workflows/run-mill-action.yml | 2 +- build.sc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index d75c0f9dc1f..d862bab7533 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -152,7 +152,7 @@ jobs: publish-sonatype: # when in master repo, publish all tags and manual runs on main if: github.repository == 'com-lihaoyi/mill' && (startsWith( github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' ) ) - needs: [linux, windows, format-check, bincompat-check, scalafix-check, itest] + needs: [linux, windows, compiler-bridge, format-check, bincompat-check, scalafix-check, itest] runs-on: ubuntu-latest diff --git a/.github/workflows/run-mill-action.yml b/.github/workflows/run-mill-action.yml index 0e2c8b888b4..91b8ad2e724 100644 --- a/.github/workflows/run-mill-action.yml +++ b/.github/workflows/run-mill-action.yml @@ -22,7 +22,7 @@ on: default: 90 type: number env-bridge-versions: - default: '' + default: 'none' type: string jobs: diff --git a/build.sc b/build.sc index f9dcbaaaa11..0211e148486 100644 --- a/build.sc +++ b/build.sc @@ -280,10 +280,10 @@ val bridgeScalaVersions = (essentialBridgeScalaVersions ++ Seq( // if given. val compilerBridgeScalaVersions = interp.watchValue(sys.env.get("MILL_COMPILER_BRIDGE_VERSIONS")) match { - case None | Some("") => Seq.empty[String] + case None | Some("") | Some("none") => Seq.empty[String] case Some("all") => bridgeScalaVersions case Some("essential") => essentialBridgeScalaVersions - case Some(versions) => versions.split(',').map(_.trim()).toSeq + case Some(versions) => versions.split(',').map(_.trim()).filterNot(_.isEmpty).toSeq } val bridgeVersion = "0.0.1" From 73fef9c78952084618fc81c3a846ff17d80a446b Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 22 May 2024 15:42:05 +0200 Subject: [PATCH 5/5] . --- build.sc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sc b/build.sc index 0211e148486..c95245469ab 100644 --- a/build.sc +++ b/build.sc @@ -237,7 +237,8 @@ def baseDir = build.millSourcePath val essentialBridgeScalaVersions = Seq(Deps.scalaVersion, Deps.scalaVersionForScoverageWorker1, Deps.workerScalaVersion212) -val bridgeScalaVersions = (essentialBridgeScalaVersions ++ Seq( +// published compiler bridges +val bridgeScalaVersions = Seq( // Our version of Zinc doesn't work with Scala 2.12.0 and 2.12.4 compiler // bridges. We skip 2.12.1 because it's so old not to matter, and we need a // non-supported scala version for testing purposes. We skip 2.13.0-2 because @@ -269,9 +270,8 @@ val bridgeScalaVersions = (essentialBridgeScalaVersions ++ Seq( "2.13.10", "2.13.11", "2.13.12", - "2.13.13", - "2.13.14" -)).distinct + "2.13.13" +) // We limit the number of compiler bridges to compile and publish for local // development and testing, because otherwise it takes forever to compile all @@ -281,7 +281,7 @@ val bridgeScalaVersions = (essentialBridgeScalaVersions ++ Seq( val compilerBridgeScalaVersions = interp.watchValue(sys.env.get("MILL_COMPILER_BRIDGE_VERSIONS")) match { case None | Some("") | Some("none") => Seq.empty[String] - case Some("all") => bridgeScalaVersions + case Some("all") => (essentialBridgeScalaVersions ++ bridgeScalaVersions).distinct case Some("essential") => essentialBridgeScalaVersions case Some(versions) => versions.split(',').map(_.trim()).filterNot(_.isEmpty).toSeq }