@@ -93,18 +93,21 @@ object Build {
93
93
94
94
/** Version of the Scala compiler used to build the artifacts.
95
95
* Reference version should track the latest version pushed to Maven:
96
- * - In main branch it should be the last RC version (using experimental TASTy required for non-bootstrapped tests)
96
+ * - In main branch it should be the last RC version
97
97
* - In release branch it should be the last stable release
98
- * 3.6.0-RC1 was released as 3.6.0 - it's having and experimental TASTy version
98
+ *
99
+ * Warning: Change of this variable needs to be consulted with `expectedTastyVersion`
99
100
*/
100
- val referenceVersion = " 3.6.0 "
101
+ val referenceVersion = " 3.6.3-RC1 "
101
102
102
103
/** Version of the Scala compiler targeted in the current release cycle
103
104
* Contains a version without RC/SNAPSHOT/NIGHTLY specific suffixes
104
105
* Should be updated ONLY after release or cutoff for previous release cycle.
105
106
*
106
107
* Should only be referred from `dottyVersion` or settings/tasks requiring simplified version string,
107
108
* eg. `compatMode` or Windows native distribution version.
109
+ *
110
+ * Warning: Change of this variable might require updating `expectedTastyVersion`
108
111
*/
109
112
val developedVersion = " 3.6.4"
110
113
@@ -116,6 +119,25 @@ object Build {
116
119
* During final, stable release is set exactly to `developedVersion`.
117
120
*/
118
121
val baseVersion = s " $developedVersion-RC1 "
122
+
123
+ /** The version of TASTY that should be emitted, checked in runtime test
124
+ * For defails on how TASTY version should be set see related discussions:
125
+ * - https://github.com/scala/scala3/issues/13447#issuecomment-912447107
126
+ * - https://github.com/scala/scala3/issues/14306#issuecomment-1069333516
127
+ * - https://github.com/scala/scala3/pull/19321
128
+ *
129
+ * Simplified rules, given 3.$minor.$patch = $developedVersion
130
+ * - Major version is always 28
131
+ * - TASTY minor version:
132
+ * - in main (NIGHTLY): {if $patch == 0 then $minor else ${minor + 1}}
133
+ * - in release branch is always equal to $minor
134
+ * - TASTY experimental version:
135
+ * - in main (NIGHTLY) is always experimental
136
+ * - in release candidate branch is experimental if {patch == 0}
137
+ * - in stable release is always non-experimetnal
138
+ */
139
+ val expectedTastyVersion = " 28.7-experimental-1"
140
+ checkReleasedTastyVersion()
119
141
120
142
/** Final version of Scala compiler, controlled by environment variables. */
121
143
val dottyVersion = {
@@ -149,9 +171,9 @@ object Build {
149
171
* For a developedVersion `3.M.P` the mimaPreviousDottyVersion should be set to:
150
172
* - `3.M.0` if `P > 0`
151
173
* - `3.(M-1).0` if `P = 0`
152
- * 3.6.1 is an exception from this rule - 3.6.0 was a broken release
174
+ * 3.6.2 is an exception from this rule - 3.6.0 was a broken release, 3.6.1 was hotfix (unstable) release
153
175
*/
154
- val mimaPreviousDottyVersion = " 3.6.1 "
176
+ val mimaPreviousDottyVersion = " 3.6.2 "
155
177
156
178
/** LTS version against which we check binary compatibility.
157
179
*
@@ -2424,6 +2446,9 @@ object Build {
2424
2446
settings(disableDocSetting).
2425
2447
settings(
2426
2448
versionScheme := Some (" semver-spec" ),
2449
+ Test / envVars ++= Map (
2450
+ " EXPECTED_TASTY_VERSION" -> expectedTastyVersion,
2451
+ ),
2427
2452
if (mode == Bootstrapped ) Def .settings(
2428
2453
commonMiMaSettings,
2429
2454
mimaForwardIssueFilters := MiMaFilters .TastyCore .ForwardsBreakingChanges ,
@@ -2473,6 +2498,34 @@ object Build {
2473
2498
case Bootstrapped => commonBootstrappedSettings
2474
2499
})
2475
2500
}
2501
+
2502
+ /* Tests TASTy version invariants during NIGHLY, RC or Stable releases */
2503
+ def checkReleasedTastyVersion (): Unit = {
2504
+ lazy val (scalaMinor, scalaPatch, scalaIsRC) = baseVersion.split(" \\ .|-" ).take(4 ) match {
2505
+ case Array (" 3" , minor, patch) => (minor.toInt, patch.toInt, false )
2506
+ case Array (" 3" , minor, patch, _) => (minor.toInt, patch.toInt, true )
2507
+ case other => sys.error(s " Invalid Scala base version string: $baseVersion" )
2508
+ }
2509
+ lazy val (tastyMinor, tastyIsExperimental) = expectedTastyVersion.split(" \\ .|-" ).take(4 ) match {
2510
+ case Array (" 28" , minor) => (minor.toInt, false )
2511
+ case Array (" 28" , minor, " experimental" , _) => (minor.toInt, true )
2512
+ case other => sys.error(s " Invalid TASTy version string: $expectedTastyVersion" )
2513
+ }
2514
+
2515
+ if (isNightly) {
2516
+ assert(tastyIsExperimental, " TASTY needs to be experimental in nightly builds" )
2517
+ val expectedTastyMinor = if (scalaPatch == 0 ) scalaMinor else scalaMinor + 1
2518
+ assert(tastyMinor == expectedTastyMinor, " Invalid TASTy minor version" )
2519
+ }
2520
+
2521
+ if (isRelease) {
2522
+ assert(scalaMinor == tastyMinor, " Minor versions of TASTY vesion and Scala version should match in release builds" )
2523
+ if (scalaIsRC && scalaPatch == 0 )
2524
+ assert(tastyIsExperimental, " TASTy should be experimental when releasing a new minor version RC" )
2525
+ else
2526
+ assert(! tastyIsExperimental, " Stable version cannot use experimental TASTY" )
2527
+ }
2528
+ }
2476
2529
}
2477
2530
2478
2531
object ScaladocConfigs {
0 commit comments