You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Use <code>.platform(Platform.jvm)</code> in case where JVM libraries are needed.</p>
281
+
<h2id="changes-to-target"><aclass="header" href="#changes-to-target">Changes to <code>target</code></a></h2>
282
+
<p>In sbt 2.x, the <code>target</code> directory is unified to be a single <code>target/</code> directory in the working directory, and each subproject creates a subdirectory encoding platform, Scala version, and the subproject id. To absorb this change in scripted tests, <code>exists</code>, <code>absent</code>, and <code>delete</code> now supports glob expression <code>**</code>, as well as <code>||</code>.</p>
<p>To use the same <code>*.scala</code> source but target both sbt 1.x and 2.x, we can create a shim, for example an object named <code>PluginCompat</code> in both <code>src/main/scala-2.12/</code> and <code>src/main/scala-3/</code>.</p>
<h2id="changes-with-compatibility-implications"><aclass="header" href="#changes-with-compatibility-implications">Changes with compatibility implications</a></h2>
226
226
<p>See also <ahref="./migrating-from-sbt-1.x.html">Migrating from sbt 1.x</a>.</p>
227
227
<ul>
228
-
<li>sbt 2.x uses Scala 3.x for build definitions and plugins (Both sbt 1.x and 2.x are capable of building Scala 2.x and 3.x) by <ahref="https://github.com/eed3si9n">@eed3si9n</a>, <ahref="https://github.com/adpi2">@adpi2</a>, and others.</li>
228
+
<li>sbt 2.x uses Scala 3.x (currently <strong>3.6.2</strong>) for build definitions and plugins (Both sbt 1.x and 2.x are capable of building Scala 2.x and 3.x) by <ahref="https://github.com/eed3si9n">@eed3si9n</a>, <ahref="https://github.com/adpi2">@adpi2</a>, and others.</li>
229
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
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 <ahref="https://github.com/eed3si9n">@eed3si9n</a> in <ahref="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 <ahref="https://github.com/sbt/sbt/pull/7927">#7927</a>.</li>
232
+
<li><code>licenses</code> key is changed from <code>Seq[(String, URL)]</code> to <code>Seq[License]</code> in <ahref="https://github.com/sbt/sbt/pull/7927">#7927</a>.</li>
231
233
<li>sbt 2.x plugins are published with <code>_sbt2_3</code> suffix by <ahref="https://github.com/eed3si9n">@eed3si9n</a> in <ahref="https://github.com/sbt/sbt/pull/7671">#7671</a></li>
232
234
<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 <ahref="https://github.com/eed3si9n">@eed3si9n</a> in <ahref="https://github.com/sbt/sbt/pull/6746">#6746</a></li>
233
235
<li>Dropped <code>useCoursier</code> setting so Coursier cannot be opted out, by <ahref="https://github.com/eed3si9n">@eed3si9n</a> in <ahref="https://github.com/sbt/sbt/pull/7712">#7712</a></li>
234
236
<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 <ahref="../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.2/<subproject>/</code>, as opposed to <code><subproject>/target/</code>.</li>
<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>
<p>Zinc is the incremental compiler for Scala, developed and maintained by sbt project.
231
231
An often overlooked aspect of Zinc is that Zinc provides a stable API to invoke <strong>any modern versions</strong> of Scala compiler. Combined with the fact that Coursier can resolve any Scala version, with sbt we can invoke any modern versions of Scala just by writing a single line <code>build.sbt</code>:</p>
0 commit comments