Introduce compiler option to dump declaration mapping.

This commit is contained in:
Ilya Gorbunov
2016-03-15 18:39:43 +03:00
parent 4e49187549
commit e7d75fccd6
8 changed files with 22 additions and 2 deletions
@@ -70,6 +70,10 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
@Argument(value = "Xskip-metadata-version-check", description = "Try loading binary incompatible classes, may cause crashes")
public boolean skipMetadataVersionCheck;
@Argument(value = "Xdump-declarations-to", description = "Path to JSON file to dump Java to Kotlin declaration mappings")
@ValueDescription("<path>")
public String declarationsOutputPath;
// Paths to output directories for friend modules.
public String[] friendPaths;
@@ -279,6 +279,7 @@ open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
configuration.put(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS, arguments.noParamAssertions)
configuration.put(JVMConfigurationKeys.DISABLE_INLINE, arguments.noInline)
configuration.put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
configuration.put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, arguments.declarationsOutputPath)
configuration.put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage);
configuration.put(CLIConfigurationKeys.REPORT_PERF, arguments.reportPerf);
}
@@ -399,7 +399,7 @@ object KotlinToJVMBytecodeCompiler {
outputDirectory,
incrementalCompilationComponents,
onIndependentPartCompilationEnd = onIndependentPartCompilationEnd,
dumpBinarySignatureMappingTo = outputDirectory?.resolve("binary-signatures.json") ?: createTempFile("binary-signatures", ".json"))
dumpBinarySignatureMappingTo = configuration.get(JVMConfigurationKeys.DECLARATIONS_JSON_PATH)?.let { File(it) })
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
val generationStart = PerformanceCounter.currentTime()
@@ -44,6 +44,8 @@ public class JVMConfigurationKeys {
public static final CompilerConfigurationKey<String> MODULE_XML_FILE_PATH = CompilerConfigurationKey.create("path to module.xml");
public static final CompilerConfigurationKey<String> DECLARATIONS_JSON_PATH = CompilerConfigurationKey.create("path to declarations output");
public static final CompilerConfigurationKey<List<Module>> MODULES =
CompilerConfigurationKey.create("module data");