Restore KotlinCompilerVersion.IS_PRE_RELEASE
This commit is a slightly modified revert of 4f29c113.
IS_PRE_RELEASE allows to make LATEST_STABLE version behave as
experimental when this flag is set to true.
The general goal is to prepare fix of KT-62058; after this commit
one can do it by changing IS_PRE_RELEASE flag to true.
The fix of KT-62058 is planned to be done during bootstrapping.
This preparation and the future fix are parts of umbrella KT-61951.
This commit is contained in:
committed by
Space Team
parent
850201a65c
commit
156097fe17
@@ -15,6 +15,23 @@ 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@")
|
||||
*/
|
||||
@@ -41,5 +58,12 @@ 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"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user