diff --git a/build.xml b/build.xml
index 9b0d02963b6..c962fba9534 100644
--- a/build.xml
+++ b/build.xml
@@ -307,37 +307,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
fileNames = new ArrayList(Arrays.asList(jsFiles));
+ fileNames.add(JS_OUT_FILE);
+
+ List filePaths = ContainerUtil.map(fileNames, new Function() {
+ @Override
+ public String fun(String s) {
+ return getOutputFileByName(s).getAbsolutePath();
+ }
+ });
+
+ RhinoUtils.runRhinoTest(filePaths, new RhinoFunctionResultChecker("out", "foo", "box", "OK"));
}
private void doJsAntTestForPostfixPrefix(@Nullable String prefix, @Nullable String postfix) throws Exception {
@@ -90,6 +102,16 @@ public class AntTaskJsTest extends AntTaskBaseTest {
doJsAntTest();
}
+ @Test
+ public void simpleWithStdlibAndAnotherLib() throws Exception {
+ doJsAntTest("jslib-example.js");
+ }
+
+ @Test
+ public void simpleWithStdlibAndFolderAsAnotherLib() throws Exception {
+ doJsAntTest("jslib-example.js");
+ }
+
@Test
public void simpleWithMainFQArgs() throws Exception {
doJsAntTest();
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/build.log.expected b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/build.log.expected
new file mode 100644
index 00000000000..ef2906cf7b6
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/build.log.expected
@@ -0,0 +1,11 @@
+OUT:
+Buildfile: [TestData]/build.xml
+
+build:
+[kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
+ [unzip] Expanding: [TestData]/jslib-example.jar into [Temp]
+
+BUILD SUCCESSFUL
+Total time: [time]
+
+Return code: 0
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/build.xml b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/build.xml
new file mode 100644
index 00000000000..a4bb60f224f
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/build.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/jslib-example.jar b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/jslib-example.jar
new file mode 100644
index 00000000000..9ab9caad358
Binary files /dev/null and b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/jslib-example.jar differ
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/root1/foo.kt b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/root1/foo.kt
new file mode 100644
index 00000000000..c6da571924b
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/root1/foo.kt
@@ -0,0 +1,14 @@
+package foo
+
+import library.sample.*
+
+var ok = "FAIL"
+
+fun main(args: Array) {
+ val p = Pair(10, 20)
+ val x = pairAdd(p)
+ ok = "OK"
+ println("x=$x")
+}
+
+fun box(): String = ok
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/build.log.expected b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/build.log.expected
new file mode 100644
index 00000000000..f1a7a8e9413
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/build.log.expected
@@ -0,0 +1,11 @@
+OUT:
+Buildfile: [TestData]/build.xml
+
+build:
+[kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
+ [copy] Copying 1 file to [Temp]
+
+BUILD SUCCESSFUL
+Total time: [time]
+
+Return code: 0
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/build.xml b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/build.xml
new file mode 100644
index 00000000000..7c2815d2bb2
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/build.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/LibraryExample.kt b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/LibraryExample.kt
new file mode 100644
index 00000000000..28569346084
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/LibraryExample.kt
@@ -0,0 +1,8 @@
+package library.sample
+
+public fun pairAdd(p: Pair): Int = p.first + p.second
+
+public fun pairMul(p: Pair): Int = p.first * p.second
+
+public data class IntHolder(val value: Int)
+
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/META-INF/MANIFEST.MF b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..00281ee90c5
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.9.1
+Created-By: 1.7.0_72-b14 (Oracle Corporation)
+Built-By: JetBrains
+Implementation-Vendor: JetBrains
+Implementation-Version: snapshot
+Specification-Title: Kotlin JavaScript Lib
+Kotlin-JS-Module-Name: jslib-example
+
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/ReadMe.md b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/ReadMe.md
new file mode 100644
index 00000000000..6c269930b08
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/ReadMe.md
@@ -0,0 +1,6 @@
+# jslib-example
+
+Path to sources: compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example
+
+The archive compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/jslib-example.jar should be updated after
+changing some files in source folder.
\ No newline at end of file
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/jslib-example.js b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/jslib-example.js
new file mode 100644
index 00000000000..8fb2ce81d48
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example/jslib-example.js
@@ -0,0 +1,37 @@
+(function (Kotlin) {
+ 'use strict';
+ var _ = Kotlin.defineRootPackage(null, /** @lends _ */ {
+ library: Kotlin.definePackage(null, /** @lends _.library */ {
+ sample: Kotlin.definePackage(null, /** @lends _.library.sample */ {
+ pairAdd_bunuun$: function (p) {
+ return p.first + p.second;
+ },
+ pairMul_bunuun$: function (p) {
+ return p.first * p.second;
+ },
+ IntHolder: Kotlin.createClass(null, function (value) {
+ this.value = value;
+ }, /** @lends _.library.sample.IntHolder.prototype */ {
+ component1: function () {
+ return this.value;
+ },
+ copy_za3lpa$: function (value) {
+ return new _.library.sample.IntHolder(value === void 0 ? this.value : value);
+ },
+ toString: function () {
+ return 'IntHolder(value=' + Kotlin.toString(this.value) + ')';
+ },
+ hashCode: function () {
+ var result = 0;
+ result = result * 31 + Kotlin.hashCode(this.value) | 0;
+ return result;
+ },
+ equals_za3rmp$: function (other) {
+ return this === other || (other !== null && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && Kotlin.equals(this.value, other.value)));
+ }
+ })
+ })
+ })
+ });
+ Kotlin.defineModule('jslib-example', _);
+}(Kotlin));
diff --git a/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/root1/foo.kt b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/root1/foo.kt
new file mode 100644
index 00000000000..c6da571924b
--- /dev/null
+++ b/compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/root1/foo.kt
@@ -0,0 +1,14 @@
+package foo
+
+import library.sample.*
+
+var ok = "FAIL"
+
+fun main(args: Array) {
+ val p = Pair(10, 20)
+ val x = pairAdd(p)
+ ok = "OK"
+ println("x=$x")
+}
+
+fun box(): String = ok
diff --git a/compiler/testData/cli/js/withFolderAsLib.args b/compiler/testData/cli/js/withFolderAsLib.args
index 0dcea39b299..7052021ee8b 100644
--- a/compiler/testData/cli/js/withFolderAsLib.args
+++ b/compiler/testData/cli/js/withFolderAsLib.args
@@ -1,5 +1,5 @@
$TESTDATA_DIR$/withLib.kt
-library-files
-dist/jslib-example
+compiler/integration-tests/testData/ant/js/simpleWithStdlibAndFolderAsAnotherLib/jslib-example
-output
$TEMP_DIR$/out.js
diff --git a/compiler/testData/cli/js/withLib.args b/compiler/testData/cli/js/withLib.args
index ae65dafb653..f9b2ba58947 100644
--- a/compiler/testData/cli/js/withLib.args
+++ b/compiler/testData/cli/js/withLib.args
@@ -1,5 +1,5 @@
$TESTDATA_DIR$/withLib.kt
-library-files
-dist/jslib-example.jar
+compiler/integration-tests/testData/ant/js/simpleWithStdlibAndAnotherLib/jslib-example.jar
-output
$TEMP_DIR$/out.js