KT-3008 Add support of module kind to Ant task. Repair Ant JS tests
This commit is contained in:
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
(function(global) {
|
||||
var modules = {};
|
||||
modules.kotlin = kotlin;
|
||||
|
||||
function define(name, dependencies, body) {
|
||||
var resolvedDependencies = [];
|
||||
for (var i = 0; i < dependencies.length; ++i) {
|
||||
resolvedDependencies[i] = modules[dependencies[i]];
|
||||
}
|
||||
modules[name] = body.apply(body, resolvedDependencies);
|
||||
}
|
||||
define.amd = {};
|
||||
|
||||
global.define = define;
|
||||
})(this);
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
OUT:
|
||||
Buildfile: [TestData]/build.xml
|
||||
|
||||
build:
|
||||
[mkdir] Created dir: [Temp]/lib
|
||||
[kotlin2js] Compiling [[TestData]/jslib-example] => [[Temp]/lib/jslib-example.js]
|
||||
[kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
|
||||
[copy] Copying 2 files to [Temp]
|
||||
[copy] Copying 1 file to [Temp]
|
||||
|
||||
BUILD SUCCESSFUL
|
||||
Total time: [time]
|
||||
|
||||
Return code: 0
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
<project name="Ant Task Test" default="build">
|
||||
<taskdef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
|
||||
<property name="library.path" value="${test.data}/jslib-example"/>
|
||||
<property name="temp.library.path" value="${temp}/lib"/>
|
||||
<target name="build">
|
||||
<mkdir dir="${temp.library.path}"/>
|
||||
|
||||
<kotlin2js src="${library.path}" output="${temp.library.path}/jslib-example.js" metaInfo="true" moduleKind="umd"/>
|
||||
|
||||
<kotlin2js src="${test.data}/root1" output="${temp}/out.js" main="call" moduleKind="amd">
|
||||
<library>
|
||||
<pathelement path="${temp.library.path}/jslib-example.meta.js"/>
|
||||
</library>
|
||||
</kotlin2js>
|
||||
<copy todir="${temp}">
|
||||
<fileset dir="${temp.library.path}">
|
||||
<include name="**/*.js"/>
|
||||
<exclude name="META-INF/**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${temp}" file="${test.data}/amd.js"/>
|
||||
</target>
|
||||
</project>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package library.sample
|
||||
|
||||
import kotlin.js.Date
|
||||
|
||||
public class ClassA() {
|
||||
val value: Int = 100
|
||||
}
|
||||
|
||||
public fun Date.extFun(): Int = 100
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
package foo
|
||||
|
||||
import library.sample.*
|
||||
import kotlin.js.Date
|
||||
|
||||
var ok = "FAIL"
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val x = ClassA().value
|
||||
if (x == 100) {
|
||||
ok = "OK"
|
||||
}
|
||||
val date = Date()
|
||||
println(date.extFun())
|
||||
}
|
||||
|
||||
fun box(): String = ok
|
||||
Reference in New Issue
Block a user