Remove KotlinCompilerVersion.IS_PRE_RELEASE

Now, milestones of major Kotlin releases (e.g. 1.6.0-M1) will NOT
generate prerelease binaries anymore.

The reason for that is it's proven to be quite a complicated process to
turn on IR_PRE_RELEASE after the release is branched, perform double
bootstrap and fix tests, and then do it again in reverse just before
release. With the new release cadence, we don't have that much time to
do it and verify that everything works as intended.

Note that this only removes the "global" prerelease flag. Compiler will
still generate prerelease binaries if a non-stable language version is
used. For example, Kotlin 1.6.0-M1 with `-language-version 1.7` will
generate prerelease binaries.
This commit is contained in:
Alexander Udalov
2021-08-03 21:44:39 +02:00
parent 6de823396b
commit 4f29c113b7
12 changed files with 21 additions and 154 deletions
@@ -15,23 +15,6 @@ public class KotlinCompilerVersion {
public static final String VERSION_FILE_PATH = "/META-INF/compiler.version";
public static final String VERSION;
// True if the latest stable language version supported by this compiler has not yet been released.
// Binaries produced by this compiler with that language version (or any future language version) are going to be marked
// as "pre-release" and will not be loaded by release versions of the compiler.
// Change this value before and after every major release
private static final boolean IS_PRE_RELEASE = false;
public static final String TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY = "kotlin.test.is.pre.release";
public static boolean isPreRelease() {
String overridden = System.getProperty(TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY);
if (overridden != null) {
return Boolean.parseBoolean(overridden);
}
return IS_PRE_RELEASE;
}
/**
* @return version of this compiler, or `null` if it isn't known (if VERSION is "@snapshot@")
*/
@@ -40,6 +23,7 @@ public class KotlinCompilerVersion {
return VERSION.equals("@snapshot@") ? null : VERSION;
}
@SuppressWarnings({"TryFinallyCanBeTryWithResources", "ConstantConditions"})
private static String loadKotlinCompilerVersion() throws IOException {
BufferedReader versionReader = new BufferedReader(
new InputStreamReader(KotlinCompilerVersion.class.getResourceAsStream(VERSION_FILE_PATH)));
@@ -57,12 +41,5 @@ public class KotlinCompilerVersion {
catch (IOException e) {
throw new IllegalStateException("Failed to read compiler version from " + VERSION_FILE_PATH);
}
if (!VERSION.equals("@snapshot@") && !VERSION.contains("-") && IS_PRE_RELEASE) {
throw new IllegalStateException(
"IS_PRE_RELEASE cannot be true for a compiler without '-' in its version.\n" +
"Please change IS_PRE_RELEASE to false, commit and push this change to master"
);
}
}
}