Skip to content

Update to sbt 2.0.0 and cross-publish plugin for sbt 1.x and 2.x#7

Draft
rolang wants to merge 1 commit into
masterfrom
publish-for-sbt2
Draft

Update to sbt 2.0.0 and cross-publish plugin for sbt 1.x and 2.x#7
rolang wants to merge 1 commit into
masterfrom
publish-for-sbt2

Conversation

@rolang

@rolang rolang commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

Upgrade the build to sbt 2.0.0 and configure the sbt plugin module to cross-publish for both sbt 1.x and sbt 2.x.

Changes

  • sbt version: project/build.properties updated to sbt.version=2.0.0
  • Cross-building: The plugin module now cross-builds for Scala 2.12 (sbt 1.12.11) and Scala 3.8.4 (sbt 2.0.0) via pluginCrossBuild / sbtVersion mapping
  • Version-specific sources:
    • src/main/scala-2.12/ — sbt 1 settings with Ivy-based resolver, csrConfiguration, in syntax
    • src/main/scala-3/ — sbt 2 settings with / syntax, no Ivy dependency, relies on Java URL handler for artifactregistry://
  • Core module: Now cross-compiles for Scala 3.8.4 as well (needed by sbt 2 plugin)
  • Removed: project/update.sbt (sbt-dependency-updates not available for sbt 2), project/metals.sbt (auto-generated, incompatible plugins)
  • Deprecated: sbt-sonatype plugin is no longer needed — sbt 2 has native Sonatype support (localStaging, sonaRelease)

Plugin artifacts

Two plugin artifact variants are published:

  • sbt-gar-handler_2.12_1.0 — for sbt 1.x
  • sbt-gar-handler_sbt2_3 — for sbt 2.x

Test plan

  • Verified sbt +compile cross-compiles all modules for all target Scala versions (2.12, 2.13, 3.8)
  • Verified sbt +Test/compile cross-compiles tests
  • Individual project compilation: core/compile, coursier/compile, plugin/compile all pass

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request upgrades the build to sbt 2.0.0 and updates the sbt plugin module so it can be published for both sbt 1.x (Scala 2.12) and sbt 2.x (Scala 3), with version-specific plugin implementation code split across Scala-versioned source directories.

Changes:

  • Bumped sbt to 2.0.0 and updated the build to cross-compile the core module for Scala 2.12/2.13/3.
  • Refactored the sbt plugin to delegate settings to a GarCompat implementation, split into Scala 2.12 (sbt 1) vs Scala 3 (sbt 2) source trees.
  • Added an Ivy-based Artifact Registry resolver/repository implementation for the sbt 1.x plugin variant.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
project/build.properties Updates the build to run on sbt 2.0.0.
build.sbt Adds Scala 3 cross-compilation and configures plugin cross-publishing for sbt 1 vs sbt 2.
modules/sbt/src/main/scala/dev/rolang/sbt/gar/GarPlugin.scala Delegates plugin settings to a version-specific compatibility layer.
modules/sbt/src/main/scala-3/dev/rolang/sbt/gar/GarCompat.scala sbt 2 / Scala 3 compatibility settings relying on JVM URL handler installation.
modules/sbt/src/main/scala-2.12/dev/rolang/sbt/gar/GarCompat.scala sbt 1 / Scala 2.12 compatibility settings, including coursier protocol handler deps + Ivy resolver mapping.
modules/sbt/src/main/scala-2.12/dev/rolang/sbt/gar/ArtifactRegistryIvyRepository.scala New Ivy repository/resolver implementation for Artifact Registry publishing/resolution on sbt 1.x.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants