CLI K2: report an error for JS/Native/Metadata #KT-52035 Fixed
This commit is contained in:
@@ -172,6 +172,10 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
@Nullable KotlinPaths paths
|
||||
) {
|
||||
MessageCollector messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY);
|
||||
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
||||
messageCollector.report(ERROR, "K2 does not support JS target right now", null);
|
||||
return ExitCode.COMPILATION_ERROR;
|
||||
}
|
||||
|
||||
ExitCode exitCode = OK;
|
||||
|
||||
|
||||
@@ -87,6 +87,10 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
paths: KotlinPaths?
|
||||
): ExitCode {
|
||||
val messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
||||
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
||||
messageCollector.report(ERROR, "K2 does not support JS target right now")
|
||||
return ExitCode.COMPILATION_ERROR
|
||||
}
|
||||
|
||||
val pluginLoadResult = loadPlugins(paths, arguments, configuration)
|
||||
if (pluginLoadResult != ExitCode.OK) return pluginLoadResult
|
||||
|
||||
@@ -58,6 +58,10 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
|
||||
paths: KotlinPaths?
|
||||
): ExitCode {
|
||||
val collector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
||||
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
||||
collector.report(ERROR, "K2 does not support compilation to metadata right now")
|
||||
return ExitCode.COMPILATION_ERROR
|
||||
}
|
||||
val performanceManager = configuration.getNotNull(CLIConfigurationKeys.PERF_MANAGER)
|
||||
|
||||
val pluginLoadResult = loadPlugins(paths, arguments, configuration)
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
$TESTDATA_DIR$/fir.kt
|
||||
-Xuse-fir
|
||||
-output
|
||||
$TEMP_DIR$
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
package test
|
||||
|
||||
class Some
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
error: k2 does not support JS target right now
|
||||
COMPILATION_ERROR
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
$TESTDATA_DIR$/fir.kt
|
||||
-Xuse-fir
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package test
|
||||
|
||||
expect class Some
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
error: k2 does not support compilation to metadata right now
|
||||
COMPILATION_ERROR
|
||||
@@ -1112,6 +1112,11 @@ public class CliTestGenerated extends AbstractCliTest {
|
||||
runTest("compiler/testData/cli/js/emptySources.args");
|
||||
}
|
||||
|
||||
@TestMetadata("fir.args")
|
||||
public void testFir() throws Exception {
|
||||
runTest("compiler/testData/cli/js/fir.args");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineCycle.args")
|
||||
public void testInlineCycle() throws Exception {
|
||||
runTest("compiler/testData/cli/js/inlineCycle.args");
|
||||
@@ -1363,6 +1368,11 @@ public class CliTestGenerated extends AbstractCliTest {
|
||||
runTest("compiler/testData/cli/metadata/anonymousObjectType.args");
|
||||
}
|
||||
|
||||
@TestMetadata("fir.args")
|
||||
public void testFir() throws Exception {
|
||||
runTest("compiler/testData/cli/metadata/fir.args");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritorOfExpectSealedClass.args")
|
||||
public void testInheritorOfExpectSealedClass() throws Exception {
|
||||
runTest("compiler/testData/cli/metadata/inheritorOfExpectSealedClass.args");
|
||||
|
||||
@@ -62,6 +62,10 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
configuration, EnvironmentConfigFiles.NATIVE_CONFIG_FILES)
|
||||
val project = environment.project
|
||||
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) ?: MessageCollector.NONE
|
||||
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
||||
messageCollector.report(ERROR, "K2 does not support Native target right now")
|
||||
return ExitCode.COMPILATION_ERROR
|
||||
}
|
||||
configuration.put(CLIConfigurationKeys.PHASE_CONFIG, createPhaseConfig(toplevelPhase, arguments, messageCollector))
|
||||
|
||||
val enoughArguments = arguments.freeArgs.isNotEmpty() || arguments.isUsefulWithoutFreeArgs
|
||||
|
||||
Reference in New Issue
Block a user