Skip to content

Commit

Permalink
Allow publishing bridge for a single version (#2822)
Browse files Browse the repository at this point in the history
Releasing a new version of the bridge just for adding a Scala version is
wasteful.
We can publish the bridge just for the new version (in our case
`2.13.12`) without tagging a `0.0.2`.
This PR adds a `bridge_versions` input to the `workflow_dispatch` which
can be `all` for the current behavior or a comma separated list of Scala
versions. This way we can release the current bridge for Scala `2.13.12`
and then add `2.13.12` to the list of supported bridges in a later PR.

Pull Request: #2822
  • Loading branch information
lolgab authored Oct 5, 2023
1 parent bdbd168 commit ff5335e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/publish-bridges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ name: Publish Bridges
# publishing workflow that runs every Mill version
on:
workflow_dispatch:
inputs:
bridge_versions:
description: 'comma-separated list of Scala versions to publish or `all` for all supported versions'
required: true
type: string

jobs:
publish-bridges:
runs-on: ubuntu-latest
Expand All @@ -19,7 +25,7 @@ jobs:
LANG: "en_US.UTF-8"
LC_MESSAGES: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
MILL_BUILD_COMPILER_BRIDGES: "true"
MILL_COMPILER_BRIDGE_VERSIONS: ${{ inputs.bridge_versions }}

steps:
- uses: actions/checkout@v4
Expand Down
21 changes: 12 additions & 9 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,6 @@ def millBinPlatform: T[String] = T {

def baseDir = build.millSourcePath

// We limit the number of compiler bridges to compile and publish for local
// development and testing, because otherwise it takes forever to compile all
// of them. Compiler bridges not in this set will get downloaded and compiled
// on the fly anyway. For publishing, we publish everything.
val buildAllCompilerBridges = interp.watchValue(sys.env.contains("MILL_BUILD_COMPILER_BRIDGES"))
val bridgeVersion = "0.0.1"

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
Expand Down Expand Up @@ -223,7 +216,17 @@ val bridgeScalaVersions = Seq(
"2.13.11"
)

val buildBridgeScalaVersions = if (!buildAllCompilerBridges) Seq() else bridgeScalaVersions
// We limit the number of compiler bridges to compile and publish for local
// development and testing, because otherwise it takes forever to compile all
// of them. Compiler bridges not in this set will get downloaded and compiled
// on the fly anyway. For publishing, we publish everything or a specific version
// 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
}
val bridgeVersion = "0.0.1"

trait MillJavaModule extends JavaModule {

Expand Down Expand Up @@ -395,7 +398,7 @@ trait MillStableScalaModule extends MillPublishScalaModule with Mima {
def skipPreviousVersions: T[Seq[String]] = T(Seq.empty[String])
}

object bridge extends Cross[BridgeModule](buildBridgeScalaVersions)
object bridge extends Cross[BridgeModule](compilerBridgeScalaVersions)
trait BridgeModule extends MillPublishJavaModule with CrossScalaModule {
def scalaVersion = crossScalaVersion
def publishVersion = bridgeVersion
Expand Down

0 comments on commit ff5335e

Please sign in to comment.