Revert "Revert [JS IR] commits that failed build"
This reverts commit 740f851a
This commit is contained in:
committed by
Svyatoslav Kuzmich
parent
181d023e3c
commit
155a760ee9
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys;
|
||||
import org.jetbrains.kotlin.cli.common.CommonCompilerPerformanceManager;
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArgumentsKt;
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants;
|
||||
import org.jetbrains.kotlin.cli.common.config.ContentRootsKt;
|
||||
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport;
|
||||
@@ -45,7 +46,6 @@ import org.jetbrains.kotlin.cli.common.messages.MessageUtil;
|
||||
import org.jetbrains.kotlin.cli.common.output.OutputUtilsKt;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||
import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser;
|
||||
import org.jetbrains.kotlin.config.*;
|
||||
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker;
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker;
|
||||
@@ -186,8 +186,13 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
) {
|
||||
MessageCollector messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY);
|
||||
|
||||
if (arguments.getIrBackend()) {
|
||||
return getIrCompiler().doExecute(arguments, configuration, rootDisposable, paths);
|
||||
ExitCode exitCode = OK;
|
||||
|
||||
if (K2JSCompilerArgumentsKt.isIrBackendEnabled(arguments)) {
|
||||
exitCode = getIrCompiler().doExecute(arguments, configuration.copy(), rootDisposable, paths);
|
||||
}
|
||||
if (K2JSCompilerArgumentsKt.isPreIrBackendDisabled(arguments)) {
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
if (arguments.getFreeArgs().isEmpty() && !IncrementalCompilation.isEnabledForJs()) {
|
||||
@@ -388,8 +393,10 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
@NotNull CompilerConfiguration configuration, @NotNull K2JSCompilerArguments arguments,
|
||||
@NotNull Services services
|
||||
) {
|
||||
if (arguments.getIrBackend()) {
|
||||
if (K2JSCompilerArgumentsKt.isIrBackendEnabled(arguments)) {
|
||||
getIrCompiler().setupPlatformSpecificArgumentsAndServices(configuration, arguments, services);
|
||||
}
|
||||
if (K2JSCompilerArgumentsKt.isPreIrBackendDisabled(arguments)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import org.jetbrains.kotlin.cli.common.*
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode.*
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode.COMPILATION_ERROR
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode.OK
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants
|
||||
import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoot
|
||||
@@ -175,17 +176,12 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
it.libraryFile.absolutePath in friendAbsolutePaths
|
||||
}
|
||||
|
||||
val produceKind = produceMap[arguments.irProduceOnly]
|
||||
if (produceKind == null) {
|
||||
messageCollector.report(ERROR, "Unknown produce kind: ${arguments.irProduceOnly}. Valid values are: js, klib")
|
||||
}
|
||||
|
||||
if (produceKind == ProduceKind.KLIB || (produceKind == ProduceKind.DEFAULT && arguments.metaInfo)) {
|
||||
if (arguments.irProduceKlibDir || arguments.irProduceKlibFile) {
|
||||
val outputKlibPath =
|
||||
if (arguments.irLegacyGradlePluginCompatibility)
|
||||
if (arguments.irProduceKlibDir)
|
||||
File(outputFilePath).parent
|
||||
else
|
||||
"$outputFilePath.klib"
|
||||
outputFilePath
|
||||
|
||||
generateKLib(
|
||||
project = config.project,
|
||||
@@ -194,11 +190,11 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
allDependencies = resolvedLibraries,
|
||||
friendDependencies = friendDependencies,
|
||||
outputKlibPath = outputKlibPath,
|
||||
nopack = arguments.irLegacyGradlePluginCompatibility
|
||||
nopack = arguments.irProduceKlibDir
|
||||
)
|
||||
}
|
||||
|
||||
if (produceKind == ProduceKind.JS || produceKind == ProduceKind.DEFAULT) {
|
||||
if (arguments.irProduceJs) {
|
||||
val phaseConfig = createPhaseConfig(jsPhases, arguments, messageCollector)
|
||||
|
||||
val compiledModule = compile(
|
||||
|
||||
Reference in New Issue
Block a user