Skip to content

Commit bc5b8df

Browse files
committed
updated site
1 parent aa10992 commit bc5b8df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1507
-349
lines changed

2.x/docs/en/Setup.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ <h3 id="installing-from-sdkman"><a class="header" href="#installing-from-sdkman"
228228
</code></pre>
229229
<h3 id="universal-packages"><a class="header" href="#universal-packages">Universal packages</a></h3>
230230
<ul>
231-
<li><a href="https://github.com/sbt/sbt/releases/download/v1.10.0/sbt-1.10.0.zip">sbt-1.10.0.zip</a></li>
232-
<li><a href="https://github.com/sbt/sbt/releases/download/v1.10.0/sbt-1.10.0.tgz">sbt-1.10.0.tgz</a></li>
233-
<li><a href="https://github.com/sbt/sbt/releases/download/v1.10.0/sbt-1.10.0.msi">sbt-1.10.0.msi</a></li>
231+
<li><a href="https://github.com/sbt/sbt/releases/download/v1.11.4/sbt-1.11.4.zip">sbt-1.11.4.zip</a></li>
232+
<li><a href="https://github.com/sbt/sbt/releases/download/v1.11.4/sbt-1.11.4.tgz">sbt-1.11.4.tgz</a></li>
233+
<li><a href="https://github.com/sbt/sbt/releases/download/v1.11.4/sbt-1.11.4.msi">sbt-1.11.4.msi</a></li>
234234
</ul>
235235
<h2 id="verify-the-sbt-runner"><a class="header" href="#verify-the-sbt-runner">Verify the sbt runner</a></h2>
236236
<pre><code class="language-bash">sbt --script-version
237-
# 1.10.0
237+
# 1.11.4
238238
</code></pre>
239239

240240
</main>

2.x/docs/en/changes/migrating-from-sbt-1.x.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,13 @@ <h1 class="menu-title">The Book of sbt</h1>
211211
<h1 id="migrating-from-sbt-1x"><a class="header" href="#migrating-from-sbt-1x">Migrating from sbt 1.x</a></h1>
212212
<h2 id="changing-buildsbt-dsl-to-scala-3x"><a class="header" href="#changing-buildsbt-dsl-to-scala-3x">Changing <code>build.sbt</code> DSL to Scala 3.x</a></h2>
213213
<p>As a reminder, users can build either Scala 2.x or Scala 3.x programs using either sbt 1.x or sbt 2.x. However, the Scala that underlies the <code>build.sbt</code> DSL is determined by the sbt version. In sbt 2.0, we are migrating to Scala 3.x.</p>
214-
<p>This means that if you implement custom tasks or sbt plugins for sbt 2.x, it must be done using Scala 3.x. See <a href="https://docs.scala-lang.org/scala3/guides/migration/incompatibility-table.html">Scala 3.x incompatibility table</a> and <a href="https://docs.scala-lang.org/scala3/guides/migration/tooling-scala2-xsource3.html">Scala 2 with -Xsource:3</a>.</p>
214+
<p>This means that if you implement custom tasks or sbt plugins for sbt 2.x, it must be done using Scala 3.x. Consult <a href="https://docs.scala-lang.org/scala3/guides/migration/incompatibility-table.html">Scala 3.x incompatibility table</a> and <a href="https://docs.scala-lang.org/scala3/guides/migration/tooling-scala2-xsource3.html">Scala 2 with -Xsource:3</a> for details about Scala 3.x.</p>
215215
<pre><code class="language-scala">// This works on Scala 2.12.20 under -Xsource:3
216216
import sbt.{ given, * }
217217
</code></pre>
218218
<h2 id="bare-settings-changes"><a class="header" href="#bare-settings-changes">Bare settings changes</a></h2>
219219
<pre><code class="language-scala">version := "0.1.0"
220-
scalaVersion := "3.6.4"
220+
scalaVersion := "3.7.2"
221221
</code></pre>
222222
<p><em>Bare settings</em>, like the example above, are settings written directly in <code>build.sbt</code> without <code>settings(...)</code>.</p>
223223
<div id="admonition-warning" class="admonition admonish-warning" role="note" aria-labelledby="admonition-warning-title">
@@ -236,11 +236,17 @@ <h2 id="bare-settings-changes"><a class="header" href="#bare-settings-changes">B
236236
</code></pre>
237237
<h3 id="migrating-thisbuild"><a class="header" href="#migrating-thisbuild">Migrating ThisBuild</a></h3>
238238
<p>In sbt 2.x, bare settings settings should no longer be scoped to <code>ThisBuild</code>. One benefit of the new <em>common settings</em> over <code>ThisBuild</code> is that it would act in a more predictable delegation. These settings are inserted between plugins settings and those defined in <code>settings(...)</code>, meaning they can be used to define settings like <code>Compile / scalacOptions</code>, which was not possible with <code>ThisBuild</code>.</p>
239+
<h2 id="migrating-to-cached-tasks"><a class="header" href="#migrating-to-cached-tasks">Migrating to cached tasks</a></h2>
240+
<p>See <a href="../reference/cached-task.html">Cached task</a> reference for details, including the way to opt out of caching.</p>
241+
<h2 id="migration-away-from-integrationtest"><a class="header" href="#migration-away-from-integrationtest">Migration away from IntegrationTest</a></h2>
242+
<p>To migrate away from the <code>IntegrationTest</code> configuration, create a separate subproject and implement it as normal test.</p>
239243
<h2 id="migrating-to-slash-syntax"><a class="header" href="#migrating-to-slash-syntax">Migrating to slash syntax</a></h2>
240244
<p>sbt 1.x supported both the sbt 0.13 style syntax and the slash syntax. sbt 2.x removes the support for the sbt 0.13 syntax, so use the slash syntax for both sbt shell and in <code>build.sbt</code>:</p>
241245
<pre><code class="language-scala">&lt;project-id&gt; / Config / intask / key
242246
</code></pre>
243247
<p>For example, <code>test:compile</code> will no longer work on the shell. Use <code>Test/compile</code> instead. See <a href="https://eed3si9n.com/syntactic-scalafix-rule-for-unified-slash-syntax/">syntactic Scalafix rule for unified slash syntax</a> for semi-automated migration of <code>build.sbt</code> files.</p>
248+
<pre><code class="language-bash">scalafix --rules=https://gist.githubusercontent.com/eed3si9n/57e83f5330592d968ce49f0d5030d4d5/raw/7f576f16a90e432baa49911c9a66204c354947bb/Sbt0_13BuildSyntax.scala *.sbt project/*.scala
249+
</code></pre>
244250
<h2 id="cross-building-sbt-plugins"><a class="header" href="#cross-building-sbt-plugins">Cross building sbt plugins</a></h2>
245251
<p>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:</p>
246252
<pre><code class="language-scala">// using sbt 2.x

2.x/docs/en/changes/sbt-2.0-change-summary.html

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,23 @@ <h1 id="sbt-20-changes-draft"><a class="header" href="#sbt-20-changes-draft">sbt
225225
<h2 id="changes-with-compatibility-implications"><a class="header" href="#changes-with-compatibility-implications">Changes with compatibility implications</a></h2>
226226
<p>See also <a href="./migrating-from-sbt-1.x.html">Migrating from sbt 1.x</a>.</p>
227227
<ul>
228-
<li>sbt 2.x uses Scala 3.x (currently <strong>3.6.4</strong>) for build definitions and plugins (Both sbt 1.x and 2.x are capable of building Scala 2.x and 3.x) by <a href="https://github.com/eed3si9n">@eed3si9n</a>, <a href="https://github.com/adpi2">@adpi2</a>, and others.</li>
229-
<li>Bare settings are added to all subprojects, as opposed to just the root subproject, and thus replacing the role that <code>ThisBuild</code> has played.</li>
230-
<li><code>test</code> task is changed to be incremental test that can cache test results. Use <code>testFull</code> for full test by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/7686">#7686</a></li>
231-
<li>Default settings and tasks keys typed to <code>URL</code> <code>apiMappings</code>, <code>apiURL</code>, <code>homepage</code>, <code>organizationHomepage</code>, <code>releaseNotesURL</code> were changed to <code>URI</code> in <a href="https://github.com/sbt/sbt/pull/7927">#7927</a>.</li>
228+
<li><strong>Scala 3 in metabuild</strong>. sbt 2.x build.sbt DSL, used for build definitions and plugins, is based on Scala 3.x (currently <strong>3.7.2</strong>) (Both sbt 1.x and 2.x are capable of building Scala 2.x and 3.x) by <a href="https://github.com/eed3si9n">@eed3si9n</a>, <a href="https://github.com/adpi2">@adpi2</a>, and others.</li>
229+
<li><strong>Common settings</strong>. Bare settings are added to all subprojects, as opposed to just the root subproject, and thus replacing the role that <code>ThisBuild</code> has played.</li>
230+
<li><strong>Cached task</strong>. All tasks are cached by default. Details in <a href="../concepts/caching.html">Caching</a>.</li>
231+
<li><strong>Incremental test</strong>. <code>test</code> task is changed to be incremental test that can cache test results. Use <code>testFull</code> for full test by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/7686">#7686</a></li>
232+
<li><code>test</code> task type is changed from <code>Unit</code> to <code>TestResult</code> by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/8181">#8181</a></li>
233+
<li>Default settings and tasks keys typed to <code>URL</code> (i.e. <code>apiMappings</code>, <code>apiURL</code>, <code>homepage</code>, <code>organizationHomepage</code>, <code>releaseNotesURL</code>) were changed to <code>URI</code> in <a href="https://github.com/sbt/sbt/pull/7927">#7927</a>.</li>
232234
<li><code>licenses</code> key is changed from <code>Seq[(String, URL)]</code> to <code>Seq[License]</code> in <a href="https://github.com/sbt/sbt/pull/7927">#7927</a>.</li>
233235
<li>sbt 2.x plugins are published with <code>_sbt2_3</code> suffix by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/7671">#7671</a></li>
234236
<li>sbt 2.x adds <code>platform</code> setting so <code>ModuleID</code>'s <code>%%</code> operator can cross build on JVM as well as JS and Native, as opposed to <code>%%%</code> operator that was created in a plugin to workaround this issue, by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/6746">#6746</a></li>
235237
<li>Dropped <code>useCoursier</code> setting so Coursier cannot be opted out, by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/7712">#7712</a></li>
236238
<li><code>Key.Classpath</code> is changed to be an alias of the <code>Seq[Attributed[xsbti.HashedVirtualFileRef]]</code> type, instead of <code>Seq[Attributed[File]]</code>. Similarly, some task keys that used to return <code>File</code> have changed to return <code>HashedVirtualFileRef</code> instead. See <a href="../concepts/caching.html#caching-files">Caching Files</a>.</li>
237-
<li>In sbt 2.x <code>target</code> defaults to <code>target/out/jvm/scala-3.6.4/&lt;subproject&gt;/</code>, as opposed to <code>&lt;subproject&gt;/target/</code>.</li>
239+
<li>In sbt 2.x <code>target</code> defaults to <code>target/out/jvm/scala-3.7.2/&lt;subproject&gt;/</code>, as opposed to <code>&lt;subproject&gt;/target/</code>.</li>
238240
</ul>
239241
<h3 id="dropped-dreprecations"><a class="header" href="#dropped-dreprecations">Dropped dreprecations</a></h3>
240242
<ul>
241-
<li>sbt 0.13 style shell syntax by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/7700">#7700</a></li>
243+
<li>Removed <code>IntegrationTest</code> configuration in <a href="https://github.com/sbt/sbt/pull/8184">#8184</a></li>
244+
<li>Removed sbt 0.13 style shell syntax in <a href="https://github.com/sbt/sbt/pull/7700">#7700</a></li>
242245
</ul>
243246
<h2 id="features"><a class="header" href="#features">Features</a></h2>
244247
<ul>
@@ -248,15 +251,14 @@ <h2 id="features"><a class="header" href="#features">Features</a></h2>
248251
</ul>
249252
<h3 id="common-settings"><a class="header" href="#common-settings">Common settings</a></h3>
250253
<p>In sbt 2.x, the bare settings in <code>build.sbt</code> are interpreted to be common settings, and are injected to all subprojects. This means we can now set <code>scalaVersion</code> without using <code>ThisBuild</code> scoping:</p>
251-
<pre><code class="language-scala">scalaVersion := "3.6.4"
254+
<pre><code class="language-scala">scalaVersion := "3.7.2"
252255
</code></pre>
253256
<p>This also fixes the so-called dynamic dispatch problem:</p>
254257
<pre><code class="language-scala">lazy val hi = taskKey[String]("")
255258
hi := name.value + "!"
256259
</code></pre>
257260
<p>In sbt 1.x <code>hi</code> task will capture the name of the root project, but in sbt 2.x it will return the <code>name</code> of each subproject with <code>!</code>:</p>
258-
<pre><code class="language-scala">$ export SBT_NATIVE_CLIENT=true
259-
$ sbt show hi
261+
<pre><code class="language-scala">$ sbt show hi
260262
[info] entering *experimental* thin client - BEEP WHIRR
261263
[info] terminate the server with `shutdown`
262264
&gt; show hi
@@ -268,33 +270,30 @@ <h3 id="common-settings"><a class="header" href="#common-settings">Common settin
268270
<p>Contributed by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/6746">#6746</a></p>
269271
<h3 id="sbt-query"><a class="header" href="#sbt-query">sbt query</a></h3>
270272
<p>To filter down the subprojects, sbt 2.x introduces sbt query.</p>
271-
<pre><code class="language-bash">$ export SBT_NATIVE_CLIENT=true
272-
$ sbt foo.../test
273+
<pre><code class="language-bash">$ sbt foo.../test
273274
</code></pre>
274275
<p>The above runs all subprojects that begins with <code>foo</code>.</p>
275276
<pre><code class="language-bash">$ sbt ...@scalaBinaryVersion=3/test
276277
</code></pre>
277278
<p>The above runs all subprojects whose <code>scalaBinaryVersion</code> is <code>3</code>. Contributed by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/7699">#7699</a></p>
278279
<h3 id="localremote-cache-system"><a class="header" href="#localremote-cache-system">Local/remote cache system</a></h3>
279-
<p>sbt 2.x implements cached task, which can automatically cache the task results to local disk and Bazel-compatible remote cache.</p>
280+
<p>sbt 2.x implements cached task by default, which can automatically cache the task results to local disk and Bazel-compatible remote cache.</p>
280281
<pre><code class="language-scala">lazy val task1 = taskKey[String]("doc for task1")
281282

282-
task1 := (Def.cachedTask {
283-
name.value + version.value + "!"
284-
}).value
283+
task1 := name.value + version.value + "!"
285284
</code></pre>
286285
<p>This tracks the inputs into the <code>task1</code> and creates a machine-wide disk cache, which can also be configured to also use a remote cache. Since it's common for sbt tasks to also produce files on the side, we also provide a mechanism to cache file contents:</p>
287286
<pre><code class="language-scala">lazy val task1 = taskKey[String]("doc for task1")
288287

289-
task1 := (Def.cachedTask {
288+
task1 := {
290289
val converter = fileConverter.value
291290
....
292291
val output = converter.toVirtualFile(somefile)
293292
Def.declareOutput(output)
294293
name.value + version.value + "!"
295-
}).value
294+
}
296295
</code></pre>
297-
<p>Contributed by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/7464">#7464</a> / <a href="https://github.com/sbt/sbt/pull/7525">#7525</a></p>
296+
<p>See <a href="../concepts/caching.html">Caching</a> for details. Contributed by <a href="https://github.com/eed3si9n">@eed3si9n</a> in <a href="https://github.com/sbt/sbt/pull/7464">#7464</a> / <a href="https://github.com/sbt/sbt/pull/7525">#7525</a>.</p>
298297
<h2 id="previously-on-sbt"><a class="header" href="#previously-on-sbt">Previously on sbt</a></h2>
299298
<p>See also:</p>
300299
<ul>

2.x/docs/en/concepts/caching.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,11 @@ <h3 id="hermetic-build"><a class="header" href="#hermetic-build">Hermetic build<
222222
<p>A build that ends up capturing ephemeral inputs, are said to <em>break the hermeticity</em> or <em>non-hermetic</em>. Another common way the hermeticity is broken is capturing absolute paths as either input or output. Sometimes the path gets embedded into the JAR via a macro, you might not know until you inspect the bytecode.</p>
223223
<h2 id="automatic-caching"><a class="header" href="#automatic-caching">Automatic caching</a></h2>
224224
<p>Here's a demonstration of the automatic caching:</p>
225-
<pre><code class="language-scala">import sbt.util.CacheImplicits.given
225+
<pre><code class="language-scala">val someKey = taskKey[String]("something")
226226

227-
val someKey = taskKey[String]("something")
228-
229-
someKey := (Def.cachedTask {
230-
name.value + version.value + "!"
231-
}).value
227+
someKey := name.value + version.value + "!"
232228
</code></pre>
233-
<p>The task will be automatically cached based on the two settings <code>name</code> and <code>version</code>. The first time we run the task it will be executed onsite, but the second time onward, it will use the disk cache:</p>
229+
<p>In sbt 2.x, the task result will be automatically cached based on the two settings <code>name</code> and <code>version</code>. The first time we run the task it will be executed onsite, but the second time onward, it will use the disk cache:</p>
234230
<pre><code>sbt:demo&gt; show someKey
235231
[info] demo0.1.0-SNAPSHOT!
236232
[success] elapsed time: 0 s, cache 0%, 1 onsite task
@@ -257,7 +253,7 @@ <h2 id="caching-files"><a class="header" href="#caching-files">Caching files</a>
257253
<h3 id="the-effect-of-file-creation"><a class="header" href="#the-effect-of-file-creation">The effect of file creation</a></h3>
258254
<p>There are many tasks that generate file that do not use <code>VirtualFile</code> as the return type. For example, <code>compile</code> returns <code>Analysis</code> instead, and <code>*.class</code> file generation happens as a <em>side effect</em> in sbt 1.x.</p>
259255
<p>To participate in caching, we need to declare these effects as something we care about.</p>
260-
<pre><code class="language-scala">someKey := Def.cachedTask {
256+
<pre><code class="language-scala">someKey := {
261257
val conv = fileConverter.value
262258
val out: java.nio.file.Path = createFile(...)
263259
val vf: xsbti.VirtualFile = conv.toVirtualFile(out)
@@ -268,7 +264,9 @@ <h3 id="the-effect-of-file-creation"><a class="header" href="#the-effect-of-file
268264
<h2 id="remote-caching"><a class="header" href="#remote-caching">Remote caching</a></h2>
269265
<p>You can optionally extend the build to use remote cache in addition to the local disk cache. Remote caching could improve build performance by allowing multiple machines to share build artifacts and outputs.</p>
270266
<p>Imagine you have a dozen people in your project or a company. Each morning, you will <code>git pull</code> the changes the dozen people made, and you need to build their code. If you have a successful project, the code size will only get bigger over time, and the % of the time you spend building someone else's in your day increases. This becomes the limiting factor of your team size and code size. Remote caching reverses this tide by CI systems hydrate the cache and you can download the artifacts and task outputs.</p>
271-
<p>sbt 2.x implements Bazel-compatible gRPC interface, which works with number of backend both open source and commercial.</p>
267+
<p>sbt 2.x implements Bazel-compatible gRPC interface, which works with number of backend both open source and commercial. See <a href="../reference/remote-cache-setup.html">Remote cache setup</a> for more details.</p>
268+
<h2 id="reference"><a class="header" href="#reference">Reference</a></h2>
269+
<p>See also <a href="../reference/cached-task.html">Cached task</a> reference guide.</p>
272270

273271
</main>
274272

2.x/docs/en/concepts/cross-building.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ <h2 id="historical-context"><a class="header" href="#historical-context">Histori
230230
<h2 id="project-matrix"><a class="header" href="#project-matrix">Project matrix</a></h2>
231231
<p>sbt 2.x introduces project matrix, which enables cross building to happen in parallel.</p>
232232
<pre><code class="language-scala">organization := "com.example"
233-
scalaVersion := "3.6.4"
233+
scalaVersion := "3.7.2"
234234
version := "0.1.0-SNAPSHOT"
235235

236236
lazy val core = (projectMatrix in file("core"))
237237
.settings(
238238
name := "core"
239239
)
240-
.jvmPlatform(scalaVersions = Seq("3.6.4", "2.13.15"))
240+
.jvmPlatform(scalaVersions = Seq("3.7.2", "2.13.16"))
241241
</code></pre>
242242
<p>See <a href="../reference/cross-building-setup.html">cross building setup</a> for more details on the setup.</p>
243243

2.x/docs/en/concepts/sbt-query.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ <h3 id="subproject-reference"><a class="header" href="#subproject-reference">Sub
222222
<a class="admonition-anchor-link" href="#admonition-buildsbt-example-1"></a>
223223
</div>
224224
<div>
225-
<pre><code class="language-scala">scalaVersion := "3.6.4"
225+
<pre><code class="language-scala">scalaVersion := "3.7.2"
226226

227227
lazy val foo = project
228228
</code></pre>
@@ -263,13 +263,13 @@ <h3 id="scalabinaryversion-parameter"><a class="header" href="#scalabinaryversio
263263
.settings(
264264
libraryDependencies += toolkit,
265265
)
266-
.jvmPlatform(scalaVersions = Seq("3.6.4", "2.13.15"))
266+
.jvmPlatform(scalaVersions = Seq("3.7.2", "2.13.16"))
267267

268268
lazy val bar = projectMatrix
269269
.settings(
270270
libraryDependencies += toolkit,
271271
)
272-
.jvmPlatform(scalaVersions = Seq("3.6.4", "2.13.15"))
272+
.jvmPlatform(scalaVersions = Seq("3.7.2", "2.13.16"))
273273
</code></pre>
274274
</div>
275275
</div>

2.x/docs/en/guide/build-definition-basics.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ <h3 id="vals-and-lazy-vals"><a class="header" href="#vals-and-lazy-vals"><code>v
268268
val toolkit = "org.scala-lang" %% "toolkit" % toolkitV
269269
val toolkitTest = "org.scala-lang" %% "toolkit-test" % toolkitV
270270

271-
scalaVersion := "3.6.4"
271+
scalaVersion := "3.7.2"
272272
libraryDependencies += toolkit
273273
libraryDependencies += (toolkitTest % Test)
274274
</code></pre>

0 commit comments

Comments
 (0)