JS backend: add -meta-info command line option for cli compiler

This commit is contained in:
Michael Nedzelsky
2014-12-29 14:17:34 +03:00
parent 711501af56
commit 3bf14518e8
7 changed files with 26 additions and 0 deletions
@@ -38,6 +38,10 @@ public class K2JSCompilerArguments extends CommonCompilerArguments {
@Argument(value = "source-map", description = "Generate source map")
public boolean sourceMap;
@Argument(value = "meta-info", description = "Generate meta information and save to the given file")
@ValueDescription("<path>")
public String metaInfo;
@Argument(value = "target", description = "Generate JS files for specific ECMA version (only ECMA 5 is supported)")
@ValueDescription("<version>")
public String target;
+1
View File
@@ -18,6 +18,7 @@
<orderEntry type="module" module-name="backend-common" />
<orderEntry type="module" module-name="serialization" />
<orderEntry type="module" module-name="serialization.jvm" />
<orderEntry type="module" module-name="js.serializer" />
<orderEntry type="module" module-name="util" />
</component>
</module>
@@ -29,6 +29,7 @@ import kotlin.Function1;
import kotlin.Unit;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.utils.serializer.KotlinJavaScriptSerializer;
import org.jetbrains.kotlin.analyzer.AnalysisResult;
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection;
import org.jetbrains.kotlin.cli.common.CLICompiler;
@@ -191,6 +192,10 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
}
OutputUtilsPackage.writeAll(outputFiles, outputDir, messageCollector);
if (arguments.metaInfo != null) {
new KotlinJavaScriptSerializer().serialize(config.getModuleId(), analysisResult.getModuleDescriptor(), new File(arguments.metaInfo));
}
return OK;
}