@@ -493,7 +493,7 @@ object Build {
493
493
}
494
494
)
495
495
496
- val publishSettings = Seq (
496
+ private val basePublishSettings = Seq (
497
497
publishMavenStyle := true ,
498
498
publishTo := {
499
499
val nexus = " https://oss.sonatype.org/"
@@ -524,6 +524,35 @@ object Build {
524
524
pomIncludeRepository := { _ => false }
525
525
)
526
526
527
+ /** Constants for the `verScheme` parameter of `publishSettings`.
528
+ *
529
+ * sbt does not define constants in its API for `versionScheme`. It
530
+ * specifies some strings instead. We use the following version schemes,
531
+ * depending on the artifacts and the versioning policy in `VERSIONING.md`:
532
+ *
533
+ * - `"strict"` for artifacts whose public API can break in patch releases (e.g., `test-bridge`)
534
+ * - `"pvp"` for artifacts whose public API can break in minor releases
535
+ * - `"semver-spec"` for artifacts whose public API can only break in major releases (e.g., `library`)
536
+ *
537
+ * At the moment, we only set the version scheme for artifacts in the
538
+ * "library ecosystem", i.e., scalajs-library, scalajs-test-interface,
539
+ * scalajs-junit-runtime and scalajs-test-bridge. Artifacts of the "tools
540
+ * ecosystem" do not have a version scheme set, as the jury is still out on
541
+ * what is the best way to specify them.
542
+ *
543
+ * See also https://www.scala-sbt.org/1.x/docs/Publishing.html#Version+scheme
544
+ */
545
+ object VersionScheme {
546
+ final val BreakOnPatch = " strict"
547
+ final val BreakOnMinor = " pvp"
548
+ final val BreakOnMajor = " semver-spec"
549
+ }
550
+
551
+ def publishSettings (verScheme : Option [String ]): Seq [Setting [_]] = Def .settings(
552
+ basePublishSettings,
553
+ versionScheme := verScheme,
554
+ )
555
+
527
556
val fatalWarningsSettings = Def .settings(
528
557
scalacOptions += " -Xfatal-warnings" ,
529
558
@@ -712,7 +741,7 @@ object Build {
712
741
713
742
val commonIrProjectSettings = Def .settings(
714
743
commonSettings,
715
- publishSettings,
744
+ publishSettings( None ) ,
716
745
fatalWarningsSettings,
717
746
name := " Scala.js IR" ,
718
747
previousArtifactSetting,
@@ -748,7 +777,7 @@ object Build {
748
777
id = " compiler" , base = file(" compiler" )
749
778
).settings(
750
779
commonSettings,
751
- publishSettings,
780
+ publishSettings( None ) ,
752
781
fatalWarningsSettings,
753
782
name := " Scala.js compiler" ,
754
783
crossVersion := CrossVersion .full, // because compiler api is not binary compatible
@@ -801,7 +830,7 @@ object Build {
801
830
802
831
val commonLinkerInterfaceSettings = Def .settings(
803
832
commonSettings,
804
- publishSettings,
833
+ publishSettings( None ) ,
805
834
fatalWarningsSettings,
806
835
name := " Scala.js linker interface" ,
807
836
@@ -889,7 +918,7 @@ object Build {
889
918
890
919
def commonLinkerSettings (library : LocalProject ) = Def .settings(
891
920
commonSettings,
892
- publishSettings,
921
+ publishSettings( None ) ,
893
922
fatalWarningsSettings,
894
923
name := " Scala.js linker" ,
895
924
ensureSAMSupportSetting,
@@ -1052,7 +1081,7 @@ object Build {
1052
1081
id = " testAdapter" , base = file(" test-adapter" )
1053
1082
).settings(
1054
1083
commonSettings,
1055
- publishSettings,
1084
+ publishSettings( None ) ,
1056
1085
fatalWarningsSettings,
1057
1086
name := " Scala.js sbt test adapter" ,
1058
1087
libraryDependencies ++= Seq (
@@ -1072,7 +1101,7 @@ object Build {
1072
1101
lazy val plugin : Project = Project (id = " sbtPlugin" , base = file(" sbt-plugin" ))
1073
1102
.enablePlugins(ScriptedPlugin ).settings(
1074
1103
commonSettings,
1075
- publishSettings,
1104
+ publishSettings( None ) ,
1076
1105
fatalWarningsSettings,
1077
1106
name := " Scala.js sbt plugin" ,
1078
1107
normalizedName := " sbt-scalajs" ,
@@ -1429,7 +1458,7 @@ object Build {
1429
1458
MyScalaJSPlugin
1430
1459
).settings(
1431
1460
commonSettings,
1432
- publishSettings,
1461
+ publishSettings( Some ( VersionScheme . BreakOnMajor )) ,
1433
1462
crossVersion := CrossVersion .binary, // no _sjs suffix
1434
1463
fatalWarningsSettings,
1435
1464
name := " Scala.js library" ,
@@ -1549,7 +1578,7 @@ object Build {
1549
1578
MyScalaJSPlugin
1550
1579
).settings(
1551
1580
commonSettings,
1552
- publishSettings,
1581
+ publishSettings( Some ( VersionScheme . BreakOnMajor )) ,
1553
1582
crossVersion := CrossVersion .binary, // no _sjs suffix
1554
1583
fatalWarningsSettings,
1555
1584
name := " Scala.js test interface" ,
@@ -1564,7 +1593,7 @@ object Build {
1564
1593
MyScalaJSPlugin
1565
1594
).settings(
1566
1595
commonSettings,
1567
- publishSettings,
1596
+ publishSettings( Some ( VersionScheme . BreakOnPatch )) ,
1568
1597
crossVersion := CrossVersion .binary, // no _sjs suffix
1569
1598
fatalWarningsSettings,
1570
1599
name := " Scala.js test bridge" ,
@@ -1588,7 +1617,7 @@ object Build {
1588
1617
MyScalaJSPlugin
1589
1618
).settings(
1590
1619
commonSettings,
1591
- publishSettings,
1620
+ publishSettings( Some ( VersionScheme . BreakOnMajor )) ,
1592
1621
crossVersion := CrossVersion .binary, // no _sjs suffix
1593
1622
fatalWarningsSettings,
1594
1623
name := " Scala.js JUnit test runtime" ,
@@ -1642,7 +1671,7 @@ object Build {
1642
1671
id = " jUnitPlugin" , base = file(" junit-plugin" )
1643
1672
).settings(
1644
1673
commonSettings,
1645
- publishSettings,
1674
+ publishSettings( None ) ,
1646
1675
fatalWarningsSettings,
1647
1676
name := " Scala.js JUnit test plugin" ,
1648
1677
crossVersion := CrossVersion .full,
0 commit comments