Revert [JS IR] commits that failed build

Revert "[JS IR] Build hybrid versions of stdlib and kotlin.test"
This reverts commit b9f88350dd.

Revert "[JS IR] Add gradle plugin integration tests"
This reverts commit d872b27663.

Revert "Update bootstrap"
This reverts commit bc47594c7a.

Revert "[JS IR] Support generating both IR and pre-IR libraries"
This reverts commit 1b8df45bfe.
This commit is contained in:
Nikolay Krasko
2019-11-05 13:57:49 +03:00
parent 722f7ff056
commit 740f851a10
28 changed files with 338 additions and 423 deletions
@@ -106,24 +106,22 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
// Advanced options
@Argument(
value = "-Xir-produce-klib-dir",
description = "Generate unpacked KLIB into parent directory of output JS file.\n" +
"In combination with -meta-info generates both IR and pre-IR versions of library."
)
var irProduceKlibDir: Boolean by FreezableVar(false)
@Argument(value = "-Xir", description = "Use IR backend")
var irBackend: Boolean by FreezableVar(false)
@Argument(
value = "-Xir-produce-klib-file",
description = "Generate packed klib into file specified by -output. Disables pre-IR backend"
value = "-Xir-produce-only",
valueDescription = "{ klib, js }",
description = "Type of output to produce. Overrides -meta-info argument."
)
var irProduceKlibFile: Boolean by FreezableVar(false)
var irProduceOnly: String? by NullableStringFreezableVar(null)
@Argument(value = "-Xir-produce-js", description = "Generates JS file using IR backend. Also disables pre-IR backend")
var irProduceJs: Boolean by FreezableVar(false)
@Argument(value = "-Xir-only", description = "Disables pre-IR backend")
var irOnly: Boolean by FreezableVar(false)
@Argument(
value = "-Xir-legacy-gradle-plugin-compatibility",
description = "Make KLIB generation compatible with legacy gradle plugin"
)
var irLegacyGradlePluginCompatibility: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanTrueDefault::class)
@Argument(value = "-Xtyped-arrays", description = "Translate primitive arrays to JS typed arrays")
@@ -146,9 +144,3 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xenable-js-scripting", description = "Enable experimental support of .kts files using K/JS (with -Xir only)")
var enableJsScripting: Boolean by FreezableVar(false)
}
fun K2JSCompilerArguments.isPreIrBackendDisabled(): Boolean =
irOnly || irProduceJs || irProduceKlibFile
fun K2JSCompilerArguments.isIrBackendEnabled(): Boolean =
irProduceKlibDir || irProduceJs || irProduceKlibFile
@@ -36,7 +36,6 @@ 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;
@@ -187,13 +186,8 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
) {
MessageCollector messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY);
ExitCode exitCode = OK;
if (K2JSCompilerArgumentsKt.isIrBackendEnabled(arguments)) {
exitCode = getIrCompiler().doExecute(arguments, configuration.copy(), rootDisposable, paths);
}
if (K2JSCompilerArgumentsKt.isPreIrBackendDisabled(arguments)) {
return exitCode;
if (arguments.getIrBackend()) {
return getIrCompiler().doExecute(arguments, configuration, rootDisposable, paths);
}
if (arguments.getFreeArgs().isEmpty() && !IncrementalCompilation.isEnabledForJs()) {
@@ -394,10 +388,8 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
@NotNull CompilerConfiguration configuration, @NotNull K2JSCompilerArguments arguments,
@NotNull Services services
) {
if (K2JSCompilerArgumentsKt.isIrBackendEnabled(arguments)) {
if (arguments.getIrBackend()) {
getIrCompiler().setupPlatformSpecificArgumentsAndServices(configuration, arguments, services);
}
if (K2JSCompilerArgumentsKt.isPreIrBackendDisabled(arguments)) {
return;
}
@@ -175,12 +175,17 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
it.libraryFile.absolutePath in friendAbsolutePaths
}
if (arguments.irProduceKlibDir || arguments.irProduceKlibFile) {
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)) {
val outputKlibPath =
if (arguments.irProduceKlibDir)
if (arguments.irLegacyGradlePluginCompatibility)
File(outputFilePath).parent
else
outputFilePath
"$outputFilePath.klib"
generateKLib(
project = config.project,
@@ -189,11 +194,11 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
allDependencies = resolvedLibraries,
friendDependencies = friendDependencies,
outputKlibPath = outputKlibPath,
nopack = arguments.irProduceKlibDir
nopack = arguments.irLegacyGradlePluginCompatibility
)
}
if (arguments.irProduceJs) {
if (produceKind == ProduceKind.JS || produceKind == ProduceKind.DEFAULT) {
val phaseConfig = createPhaseConfig(jsPhases, arguments, messageCollector)
val compiledModule = compile(