simplified the kotlin-js-library source generation so we can selectively include some of the kotlin standard library for use in JS compilation
This commit is contained in:
@@ -64,8 +64,12 @@
|
|||||||
<module>docs/website</module>
|
<module>docs/website</module>
|
||||||
|
|
||||||
<module>examples/kotlin-java-example</module>
|
<module>examples/kotlin-java-example</module>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
TODO temporary disabled until we can get the kotlin/dom code compiled as JS
|
||||||
<module>examples/js-example</module>
|
<module>examples/js-example</module>
|
||||||
<module>examples/browser-example</module>
|
<module>examples/browser-example</module>
|
||||||
|
-->
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -17,12 +17,48 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-sources</id>
|
||||||
|
<phase>process-sources</phase>
|
||||||
|
<configuration>
|
||||||
|
<target>
|
||||||
|
<delete dir="${basedir}/target/generated-js-library" failonerror="false" />
|
||||||
|
<mkdir dir="${basedir}/target/generated-js-library"/>
|
||||||
|
<copy todir="${basedir}/target/generated-js-library">
|
||||||
|
<fileset dir="${kotlin-js-lib-srcdir}"/>
|
||||||
|
</copy>
|
||||||
|
<copy todir="${basedir}/target/generated-js-library/kotlin">
|
||||||
|
<fileset dir="${basedir}/../../stdlib/src/kotlin/dom">
|
||||||
|
<include name="**/*.kt"/>
|
||||||
|
<exclude name="**/*JVM.kt"/>
|
||||||
|
</fileset>
|
||||||
|
<fileset dir="${basedir}/../../stdlib/src/kotlin/support">
|
||||||
|
<include name="**/*.kt"/>
|
||||||
|
<exclude name="**/*JVM.kt"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<copy tofile="${basedir}/target/generated-js-library/kotlin-lib.js"
|
||||||
|
file="${kotlin-js-lib-srcdir}/../../js.translator/testFiles/kotlin_lib.js"/>
|
||||||
|
</target>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin-maven-plugin</artifactId>
|
<artifactId>kotlin-maven-plugin</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<librarySourceDir>${kotlin-js-lib-srcdir}</librarySourceDir>
|
<librarySourceDir>${basedir}/target/generated-js-library</librarySourceDir>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
-3
@@ -46,9 +46,6 @@ public class JSSourceJarMojo extends AbstractMojo {
|
|||||||
|
|
||||||
FileUtils.copyDirectoryStructure(librarySourceDir, outputDir);
|
FileUtils.copyDirectoryStructure(librarySourceDir, outputDir);
|
||||||
|
|
||||||
// lets copy the standard JS library source too
|
|
||||||
FileUtils.copyFile(new File(librarySourceDir, "../../js.translator/testFiles/kotlin_lib.js"), new File(outputDir, "kotlin-lib.js"));
|
|
||||||
|
|
||||||
// now lets generate the META-INF/services/org.jetbrains.kotlin.js.librarySource file
|
// now lets generate the META-INF/services/org.jetbrains.kotlin.js.librarySource file
|
||||||
PrintWriter writer = new PrintWriter(new FileWriter(metaInfFile));
|
PrintWriter writer = new PrintWriter(new FileWriter(metaInfFile));
|
||||||
appendSourceFiles(writer, outputDir.getCanonicalPath(), outputDir);
|
appendSourceFiles(writer, outputDir.getCanonicalPath(), outputDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user