Backport sbt 2.x cross-publishing support to series/0.18#1973
Merged
kubukoz merged 15 commits intoJun 18, 2026
Conversation
Port of PR disneystreaming#1903 from series/0.19. The sbt plugin is now cross-published for both sbt 1.x (Scala 2.12) and sbt 2.x (Scala 3.8), using a Compat shim to abstract over the Settings type and other API differences. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sbt 1.12.x is the first version whose sbtPluginExtra understands major version "2", which is required for cross-publishing the plugin against sbt 2.0.0-RC9. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Import sbtcompat.PluginCompat for toFiles/parseModuleIDStrAttribute - Import Compat._ for Def.uncached extension method - Wrap task bodies with Def.uncached (no-op under sbt 1, cached-task opt-out under sbt 2) - Replace .map(_.data) with toFiles() using implicit FileConverter - Replace .metadata.get(moduleID.key) with SbtCompat.moduleIDStr lookup - Change Def.Setting[_] to Def.Setting[?] for Scala 3 compatibility - Fix protobuf test glob pattern and remove pinned sbt version from multiple-artifacts-same-namespace Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kubukoz
reviewed
Jun 15, 2026
Member
|
CI changes next? |
This test was added to series/0.18 after the original sbt2 PR, so its plugins.sbt was missing the dependency exclusion block needed when running under sbt 2 / Scala 3. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Port of commit 754720f from series/0.19: - Add sbt 2 excludeDependencies block to plugins.sbt - Replace hardcoded target/scala-2.13/ path assertions with checkLayout sbt tasks that use Compile/sourceManaged, which resolves correctly under both sbt 1 and sbt 2 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
fwiw I would do it without scalafix specifically (the CI changes I mentioned were mostly supposed to achieve parallelism in the sbt1/2 builds) |
…riants Now that the sbt plugin is cross-published for sbt 1.x (codegenPlugin, Scala 2.12) and sbt 2.x (codegenPlugin3, Scala 3.8), run each scripted test as two explicit steps instead of relying on root-project aggregation which is implicit and fragile. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In sbt 2, java.io.File is not a valid output type for a cached task. Three task bodies that return Seq[File] were missing the Def.uncached wrapper that was already applied to the ModuleID-returning tasks: - smithy4sCodegen (delegates to cachedSmithyCodegen) - smithy4sAllDependenciesAsJars - smithy4sGeneratedSmithyFiles (implements its own sbt 1 cache internally) Def.uncached is a no-op on sbt 1 via Compat.DefOps. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
a8f71a4 to
559e7e9
Compare
Add sbtVersion to the sbt-plugin matrix so each (test, sbtVersion) combination runs as an independent job rather than sequentially within one job. Also pull the relevant remote caches for sbt 2 scripted tests (2_13_jvm and 3_0_jvm) since codegenPlugin3/publishLocal depends on those artifacts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In sbt 2, task keys returning java.io.File or Seq[File] must either use virtual file refs or be marked @transient to opt out of caching. Without this, any scripted-test build.sbt that overrides these keys (e.g. smithyBuild := Some(...), smithy4sInternalDependenciesAsJars := Nil, smithy4sAllDependenciesAsJars +=) fails to reload. Backported from disneystreaming#1961. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kubukoz
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of PR #1903 from series/0.19. The sbt plugin is now cross-published for both sbt 1.x (Scala 2.12) and sbt 2.x (Scala 3.8), using a Compat shim to abstract over the Settings type and other API differences.
PR Checklist (not all items are relevant to all PRs)