From 3606ed313712dcca4a2c4423ac6d929f8ca0fbdb Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sat, 5 Oct 2024 12:45:46 -0400 Subject: [PATCH] Document how to cross build using sbt 1.x --- book.toml | 2 +- .../changes/migrating-from-sbt-1.x.md | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/book.toml b/book.toml index 9c7abe02..e1fb3199 100644 --- a/book.toml +++ b/book.toml @@ -13,7 +13,7 @@ cname = "www.scala-sbt.org" [preprocessor.variables] [preprocessor.variables.variables] -sbt_version = "2.0.0-alpha7" +sbt_version = "2.0.0-M2" sbt_runner_version = "1.10.0" scala3_example_version = "3.3.3" scala2_13_example_version = "2.13.15" diff --git a/src/reference/changes/migrating-from-sbt-1.x.md b/src/reference/changes/migrating-from-sbt-1.x.md index dae2fde0..d1b957de 100644 --- a/src/reference/changes/migrating-from-sbt-1.x.md +++ b/src/reference/changes/migrating-from-sbt-1.x.md @@ -47,7 +47,29 @@ lazy val plugin = (projectMatrix in file("plugin")) ``` If you use `projectMatrix`, make sure to move the plugin to a subdirectory like `plugin/`. Otherwise, the synthetic root project will also pick up the `src/`. -Use sbt 1.10.2 or later to cross build from sbt 1.x side. + +### Cross building sbt plugin with sbt 1.x + +Use sbt 1.10.2 or later, if you want to cross build using sbt 1.x. + +```scala +// using sbt 1.x +lazy val scala212 = "2.12.20" +lazy val scala3 = "3.3.4" +ThisBuild / crossScalaVersions := Seq(scala212, scala3) + +lazy val plugin = (project in file("plugin")) + .enablePlugins(SbtPlugin) + .settings( + name := "sbt-vimquit", + (pluginCrossBuild / sbtVersion) := { + scalaBinaryVersion.value match { + case "2.12" => "1.5.8" + case _ => "{{sbt_version}}" + } + }, + ) +``` Migrating to slash syntax -------------------------