Introduce compiler option to dump declaration mapping.
This commit is contained in:
@@ -877,7 +877,7 @@
|
||||
</target>
|
||||
|
||||
<target name="stdlib">
|
||||
<new-kotlinc output="${output}/classes/stdlib" moduleName="kotlin-stdlib">
|
||||
<new-kotlinc output="${output}/classes/stdlib" moduleName="kotlin-stdlib" additionalOptions="-Xdump-declarations-to ${output}/declarations/stdlib-declarations.json">
|
||||
<src>
|
||||
<include name="libraries/stdlib/src"/>
|
||||
</src>
|
||||
|
||||
+4
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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");
|
||||
|
||||
|
||||
+1
@@ -6,6 +6,7 @@ where advanced options include:
|
||||
-Xreport-perf Report detailed performance statistics
|
||||
-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
|
||||
-Xno-inline Disable method inlining
|
||||
-Xrepeat <count> Repeat compilation (for performance analysis)
|
||||
-Xplugin <path> Load plugins from the given classpath
|
||||
|
||||
@@ -50,6 +50,12 @@
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<args combine.children="append">
|
||||
<arg>-Xdump-declarations-to</arg>
|
||||
<arg>${basedir}/target/stdlib-declarations.json</arg>
|
||||
</args>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<execution>
|
||||
|
||||
@@ -103,6 +103,12 @@
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<args combine.children="append">
|
||||
<arg>-Xdump-declarations-to</arg>
|
||||
<arg>${basedir}/target/runtime-declarations.json</arg>
|
||||
</args>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
Reference in New Issue
Block a user