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>In sbt 1.x bare settings were project settings that applied only to the root subproject. In sbt 2.x, the bare settings in <code>build.sbt</code> are common settings that are injected to <strong>all subprojects</strong>.</p>
196
196
</div>
197
197
</div>
198
-
<pre><codeclass="language-scala">name := "root"
198
+
<pre><codeclass="language-scala">name := "root" // every subprojects will be named root!
<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>
203
+
<h2id="cross-building-sbt-plugins"><aclass="header" href="#cross-building-sbt-plugins">Cross building sbt plugins</a></h2>
204
+
<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>
205
+
<pre><codeclass="language-scala">// using sbt 2.x
206
+
lazy val plugin = (projectMatrix in file("plugin"))
<p>If you use <code>projectMatrix</code>, make sure to move the plugin to a subdirectory like <code>plugin/</code>. Otherwise, the synthetic root project will also pick up the <code>src/</code>.
214
+
Use sbt 1.10.2 or later to cross build from sbt 1.x side.</p>
203
215
<h2id="migrating-to-slash-syntax"><aclass="header" href="#migrating-to-slash-syntax">Migrating to slash syntax</a></h2>
204
216
<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>
<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. by <ahref="https://github.com/eed3si9n">@eed3si9n</a> in <ahref="https://github.com/sbt/sbt/pull/6746">#6746</a></li>
197
197
<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>
198
198
<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>
199
-
<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>
199
+
<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>
200
+
<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>
<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. by <ahref="https://github.com/eed3si9n">@eed3si9n</a> in <ahref="https://github.com/sbt/sbt/pull/6746">#6746</a></li>
1372
1372
<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>
1373
1373
<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>
1374
-
<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>
1374
+
<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>
1375
+
<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>
<p>In sbt 1.x bare settings were project settings that applied only to the root subproject. In sbt 2.x, the bare settings in <code>build.sbt</code> are common settings that are injected to <strong>all subprojects</strong>.</p>
1410
1411
</div>
1411
1412
</div>
1412
-
<pre><codeclass="language-scala">name := "root"
1413
+
<pre><codeclass="language-scala">name := "root" // every subprojects will be named root!
<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>
1418
+
<h2id="cross-building-sbt-plugins"><aclass="header" href="#cross-building-sbt-plugins">Cross building sbt plugins</a></h2>
1419
+
<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>
1420
+
<pre><codeclass="language-scala">// using sbt 2.x
1421
+
lazy val plugin = (projectMatrix in file("plugin"))
<p>If you use <code>projectMatrix</code>, make sure to move the plugin to a subdirectory like <code>plugin/</code>. Otherwise, the synthetic root project will also pick up the <code>src/</code>.
1429
+
Use sbt 1.10.2 or later to cross build from sbt 1.x side.</p>
1417
1430
<h2id="migrating-to-slash-syntax"><aclass="header" href="#migrating-to-slash-syntax">Migrating to slash syntax</a></h2>
1418
1431
<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>
0 commit comments