Skip to content

Commit

Permalink
Document plugin cross building
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Oct 3, 2024
1 parent b8b5719 commit 3e2c97d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 18 additions & 1 deletion src/reference/changes/migrating-from-sbt-1.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,31 @@ In sbt 1.x bare settings were project settings that applied only to the root sub
```

```scala
name := "root"
name := "root" // every subprojects will be named root!
publish / skip := true
```

### Migrating ThisBuild

In sbt 2.x, bare settings settings should no longer be scoped to `ThisBuild`. One benefit of the new _common settings_ over `ThisBuild` is that it would act in a more predictable delegation. These settings are inserted between plugins settings and those defined in `settings(...)`, meaning they can be used to define settings like `Compile / scalacOptions`, which was not possible with `ThisBuild`.

Cross building sbt plugins
--------------------------

In sbt 2.x, if you cross build an sbt plugin with Scala 3.x and 2.12.x, it will automatically cross build against sbt 1.x and sbt 2.x:

```scala
// using sbt 2.x
lazy val plugin = (projectMatrix in file("."))
.enablePlugins(SbtPlugin)
.settings(
name := "sbt-vimquit",
)
.jvmPlatform(scalaVersions = Seq("3.3.3", "2.12.20"))
```

Use sbt 1.10.2 or later to cross build from sbt 1.x side.

Migrating to slash syntax
-------------------------

Expand Down
4 changes: 3 additions & 1 deletion src/reference/changes/sbt-2.0-change-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ See also [Migrating from sbt 1.x](./migrating-from-sbt-1.x.md).
- Bare settings are added to all subprojects, as opposed to just the root subproject, and thus replacing the role that `ThisBuild` has played. by [@eed3si9n][@eed3si9n] in [#6746][6746]
- `test` task is changed to be incremental test that can cache test results. Use `testFull` for full test by [@eed3si9n][@eed3si9n] in [#7686][7686]
- sbt 2.x plugins are published with `_sbt2_3` suffix by [@eed3si9n][@eed3si9n] in [#7671][7671]
- sbt 2.x adds `platform` setting so `ModuleID`'s `%%` operator can cross build on JVM as well as JS and Native, as opposed to `%%%` operator that was created in a plugin to workaround this issue. by [@eed3si9n][@eed3si9n] in [#6746][6746]
- sbt 2.x adds `platform` setting so `ModuleID`'s `%%` operator can cross build on JVM as well as JS and Native, as opposed to `%%%` operator that was created in a plugin to workaround this issue, by [@eed3si9n][@eed3si9n] in [#6746][6746]
- Dropped `useCoursier` setting so Coursier cannot be opted out, by [@eed3si9n][@eed3si9n] in [#7712][7712]

### Dropped dreprecations

Expand All @@ -41,5 +42,6 @@ See also:
[7671]: https://github.com/sbt/sbt/pull/7671
[7686]: https://github.com/sbt/sbt/pull/7686
[7700]: https://github.com/sbt/sbt/pull/7700
[7712]: https://github.com/sbt/sbt/pull/7712
[@eed3si9n]: https://github.com/eed3si9n
[@adpi2]: https://github.com/adpi2

0 comments on commit 3e2c97d

Please sign in to comment.