-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Migrating from sbt 1.x | ||
====================== | ||
|
||
Changing the build to Scala 3.x | ||
------------------------------- | ||
|
||
Just so we're clear, users can build either Scala 2.x or Scala 3.x programs using either sbt 1.x or sbt 2.x. However, the Scala used that underlies `build.sbt` DSL is dictated by the sbt version. In sbt 2.0, we are migrating to Scala 3.x. | ||
|
||
This means that if you implement custom tasks or sbt plugins for sbt 2.x, it must be done using Scala 3.x. See [Scala 3.x incompatibility table][scala-incompatibility-table] the list of potential migration points. | ||
|
||
Bare settings changes | ||
--------------------- | ||
|
||
```scala | ||
version := "0.1.0" | ||
scalaVersion := "{{scala3_example_version}}" | ||
``` | ||
|
||
_Bare settings_, like the above, are settings that are written directly in `build.sbt` without `settings(...)`. In sbt 1.x bare settings were project settings that belong only to the root subproject. In sbt 2.x, the bare settings in `build.sbt` are common settings that are injected to **all subprojects**. | ||
|
||
### Migrating ThisBuild | ||
|
||
In sbt 2.x, settings scoped to `ThisBuild` should become a bare setting instead. One benefit of the new _common settings_ over `ThisBuild` is that it would act in a more predictable delegation since it would be inserted between the plugin settings and `settings(...)`, which means that it can used to define settings like `Compile / scalacOptions`, which was not possible with `ThisBuild`. | ||
|
||
Changes to `%%` | ||
--------------- | ||
|
||
In sbt 2.x, `ModuleID`'s `%%` operator became platform-aware. For JVM subprojects, `%%` remains the same, which is used to encode Scala suffix such as `_3` on Maven repositories. | ||
|
||
### Migrating `%%%` operator | ||
|
||
When Scala.JS or Scala Native become available on sbt 2.x, `%%` encodes both the Scala version such as `_3` and the platform suffix such as `_sjs1`. This means that `%%%` can be replaced with `%%` instead. | ||
|
||
```scala | ||
libraryDependencies += "org.scala-js" %% "scalajs-dom" % "2.8.0" | ||
``` | ||
|
||
Use `.platform(Platform.jvm)` in situations where JVM libraries are needed. | ||
|
||
|
||
[scala-incompatibility-table]: https://docs.scala-lang.org/scala3/guides/migration/incompatibility-table.html |