diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 5957a62ea31..d862bab7533 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: @@ -145,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 40e4d787dce..91b8ad2e724 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: 'none' + 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 fd99044b7a2..c95245469ab 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,13 @@ def millBinPlatform: T[String] = T { def baseDir = build.millSourcePath +val essentialBridgeScalaVersions = + Seq(Deps.scalaVersion, Deps.scalaVersionForScoverageWorker1, Deps.workerScalaVersion212) +// 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 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 +259,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", @@ -277,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 Some("all") => bridgeScalaVersions - case Some(versions) => versions.split(',').map(_.trim).toSeq + case None | Some("") | Some("none") => Seq.empty[String] + case Some("all") => (essentialBridgeScalaVersions ++ bridgeScalaVersions).distinct + case Some("essential") => essentialBridgeScalaVersions + case Some(versions) => versions.split(',').map(_.trim()).filterNot(_.isEmpty).toSeq } val bridgeVersion = "0.0.1" @@ -525,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}" ) @@ -534,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)) }