KT-11410: Add Xmultifile-parts-inherit CLI option.

This commit is contained in:
Dmitry Petrov
2016-03-16 12:02:48 +03:00
parent 095cbea125
commit 0ccaf43e2c
7 changed files with 12 additions and 6 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,6 +57,7 @@ class GenerationState @JvmOverloads constructor(
disableInline: Boolean = false,
disableOptimization: Boolean = false,
val useTypeTableInSerializer: Boolean = false,
val inheritMultifileParts: Boolean = false,
val packagesWithObsoleteParts: Collection<FqName> = emptySet(),
val obsoleteMultifileClasses: Collection<FqName> = emptySet(),
// for PackageCodegen in incremental compilation mode
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,6 +64,9 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
@Argument(value = "Xreport-perf", description = "Report detailed performance statistics")
public boolean reportPerf;
@Argument(value = "Xmultifile-parts-inherit", description = "Compile multifile classes as a hierarchy of parts and facade")
public boolean inheritMultifileParts;
@Argument(value = "Xallow-kotlin-package", description = "Allow compiling code in package 'kotlin'")
public boolean allowKotlinPackage;
@@ -280,6 +280,7 @@ open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
configuration.put(JVMConfigurationKeys.DISABLE_INLINE, arguments.noInline)
configuration.put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
configuration.put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, arguments.declarationsOutputPath)
configuration.put(JVMConfigurationKeys.INHERIT_MULTIFILE_PARTS, arguments.inheritMultifileParts);
configuration.put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage);
configuration.put(CLIConfigurationKeys.REPORT_PERF, arguments.reportPerf);
}
@@ -109,10 +109,7 @@ class KotlinCoreEnvironment private constructor(
private val sourceFiles = ArrayList<KtFile>()
private val javaRoots = ArrayList<JavaRoot>()
val configuration: CompilerConfiguration = configuration.copy().let {
it.setReadOnly(true)
it
}
val configuration: CompilerConfiguration = configuration.copy().apply { setReadOnly(true) }
init {
PersistentFSConstants.setMaxIntellisenseFileSize(FileUtilRt.LARGE_FOR_CONTENT_LOADING)
@@ -399,6 +399,7 @@ object KotlinToJVMBytecodeCompiler {
configuration.get(JVMConfigurationKeys.DISABLE_INLINE, false),
configuration.get(JVMConfigurationKeys.DISABLE_OPTIMIZATION, false),
/* useTypeTableInSerializer = */ false,
configuration.get(JVMConfigurationKeys.INHERIT_MULTIFILE_PARTS, false),
packagesWithObsoleteParts,
obsoleteMultifileClasses,
targetId,
@@ -35,6 +35,8 @@ public class JVMConfigurationKeys {
CompilerConfigurationKey.create("disable inline");
public static final CompilerConfigurationKey<Boolean> DISABLE_OPTIMIZATION =
CompilerConfigurationKey.create("disable optimization");
public static final CompilerConfigurationKey<Boolean> INHERIT_MULTIFILE_PARTS =
CompilerConfigurationKey.create("compile multifile classes to a hierarchy of parts and facade");
public static final CompilerConfigurationKey<IncrementalCompilationComponents> INCREMENTAL_COMPILATION_COMPONENTS =
CompilerConfigurationKey.create("incremental cache provider");
+1
View File
@@ -4,6 +4,7 @@ where advanced options include:
-Xno-param-assertions Don't generate not-null assertions on parameters of methods accessible from Java
-Xno-optimize Disable optimizations
-Xreport-perf Report detailed performance statistics
-Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade
-Xallow-kotlin-package Allow compiling code in package 'kotlin'
-Xskip-metadata-version-check Try loading binary incompatible classes, may cause crashes
-Xdump-declarations-to <path> Path to JSON file to dump Java to Kotlin declaration mappings