added an integration test that compiles the JS unit tests and generates the QUnit test case
This commit is contained in:
+119
-118
@@ -1,118 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-project</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project-root>../../..</project-root>
|
||||
|
||||
<asm.version>3.3.1</asm.version>
|
||||
<dart.name>dart-r3300</dart.name>
|
||||
<guava.version>11.0.2</guava.version>
|
||||
<junit-version>4.10</junit-version>
|
||||
<kotlin-maven-plugin.version>0.2.3.8</kotlin-maven-plugin.version>
|
||||
<kotlin-dist>${project-root}/dist</kotlin-dist>
|
||||
<kotlin-js-lib-srcdir>${project-root}/js/js.libraries/src</kotlin-js-lib-srcdir>
|
||||
<kotlin-sdk>${kotlin-dist}/kotlinc</kotlin-sdk>
|
||||
<maven.compiler.source>1.6</maven.compiler.source>
|
||||
<maven.compiler.target>1.6</maven.compiler.target>
|
||||
<maven-jar-plugin.version>2.4</maven-jar-plugin.version>
|
||||
<pegdown.version>1.1.0</pegdown.version>
|
||||
<surefire-version>2.5</surefire-version>
|
||||
<exec-maven-plugin.version>1.2.1</exec-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<uniqueVersion>false</uniqueVersion>
|
||||
<id>jetbrains-kotlin</id>
|
||||
<name>jetbrains-kotlin</name>
|
||||
<url>http://repository.jetbrains.com/kotlin</url>
|
||||
<layout>default</layout>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<uniqueVersion>false</uniqueVersion>
|
||||
<id>jetbrains-kotlin</id>
|
||||
<name>jetbrains-kotlin</name>
|
||||
<url>http://repository.jetbrains.com/kotlin</url>
|
||||
<layout>default</layout>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<modules>
|
||||
<module>tools/kotlin-compiler</module>
|
||||
<module>tools/runtime</module>
|
||||
<module>tools/kotlin-maven-plugin</module>
|
||||
<module>tools/kotlin-js-library</module>
|
||||
<module>tools/kdoc</module>
|
||||
<module>tools/kdoc-maven-plugin</module>
|
||||
|
||||
<module>stdlib</module>
|
||||
<module>kunit</module>
|
||||
<module>kotlin-jdbc</module>
|
||||
<module>kotlin-swing</module>
|
||||
|
||||
<module>docs/apidoc</module>
|
||||
<module>docs/website</module>
|
||||
|
||||
<module>examples/kotlin-java-example</module>
|
||||
|
||||
<module>examples/js-example</module>
|
||||
<module>examples/browser-example</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${surefire-version}</version>
|
||||
<configuration>
|
||||
<forkMode>once</forkMode>
|
||||
<useSystemClassLoader>false</useSystemClassLoader>
|
||||
<useManifestOnlyJar>false</useManifestOnlyJar>
|
||||
<failIfNoTests>false</failIfNoTests>
|
||||
<includes>
|
||||
<include>**/*Test.*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
</excludes>
|
||||
<systemProperties>
|
||||
<project.version>${project.version}</project.version>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-project</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project-root>../../..</project-root>
|
||||
|
||||
<asm.version>3.3.1</asm.version>
|
||||
<dart.name>dart-r3300</dart.name>
|
||||
<guava.version>11.0.2</guava.version>
|
||||
<junit-version>4.10</junit-version>
|
||||
<kotlin-maven-plugin.version>0.2.3.8</kotlin-maven-plugin.version>
|
||||
<kotlin-dist>${project-root}/dist</kotlin-dist>
|
||||
<kotlin-js-lib-srcdir>${project-root}/js/js.libraries/src</kotlin-js-lib-srcdir>
|
||||
<kotlin-sdk>${kotlin-dist}/kotlinc</kotlin-sdk>
|
||||
<maven.compiler.source>1.6</maven.compiler.source>
|
||||
<maven.compiler.target>1.6</maven.compiler.target>
|
||||
<maven-jar-plugin.version>2.4</maven-jar-plugin.version>
|
||||
<pegdown.version>1.1.0</pegdown.version>
|
||||
<surefire-version>2.5</surefire-version>
|
||||
<exec-maven-plugin.version>1.2.1</exec-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<uniqueVersion>false</uniqueVersion>
|
||||
<id>jetbrains-kotlin</id>
|
||||
<name>jetbrains-kotlin</name>
|
||||
<url>http://repository.jetbrains.com/kotlin</url>
|
||||
<layout>default</layout>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<uniqueVersion>false</uniqueVersion>
|
||||
<id>jetbrains-kotlin</id>
|
||||
<name>jetbrains-kotlin</name>
|
||||
<url>http://repository.jetbrains.com/kotlin</url>
|
||||
<layout>default</layout>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<modules>
|
||||
<module>tools/kotlin-compiler</module>
|
||||
<module>tools/runtime</module>
|
||||
<module>tools/kotlin-maven-plugin</module>
|
||||
<module>tools/kotlin-js-library</module>
|
||||
<module>tools/kotlin-js-tests</module>
|
||||
<module>tools/kdoc</module>
|
||||
<module>tools/kdoc-maven-plugin</module>
|
||||
|
||||
<module>stdlib</module>
|
||||
<module>kunit</module>
|
||||
<module>kotlin-jdbc</module>
|
||||
<module>kotlin-swing</module>
|
||||
|
||||
<module>docs/apidoc</module>
|
||||
<module>docs/website</module>
|
||||
|
||||
<module>examples/kotlin-java-example</module>
|
||||
|
||||
<module>examples/js-example</module>
|
||||
<module>examples/browser-example</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${surefire-version}</version>
|
||||
<configuration>
|
||||
<forkMode>once</forkMode>
|
||||
<useSystemClassLoader>false</useSystemClassLoader>
|
||||
<useManifestOnlyJar>false</useManifestOnlyJar>
|
||||
<failIfNoTests>false</failIfNoTests>
|
||||
<includes>
|
||||
<include>**/*Test.*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
</excludes>
|
||||
<systemProperties>
|
||||
<project.version>${project.version}</project.version>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -65,6 +65,10 @@
|
||||
</copy>
|
||||
<copy tofile="${basedir}/target/generated-js-library/kotlin-lib.js"
|
||||
file="${kotlin-js-lib-srcdir}/../../js.translator/testFiles/kotlin_lib.js"/>
|
||||
<copy tofile="${basedir}/target/generated-js-library/kotlin-lib-ecma3.js"
|
||||
file="${kotlin-js-lib-srcdir}/../../js.translator/testFiles/kotlin_lib_ecma3.js"/>
|
||||
<copy tofile="${basedir}/target/generated-js-library/kotlin-lib-ecma5.js"
|
||||
file="${kotlin-js-lib-srcdir}/../../js.translator/testFiles/kotlin_lib_ecma5.js"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-project</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>kotlin-js-tests</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-js-library</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/target/tests</sourceDirectory>
|
||||
|
||||
<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>
|
||||
<mkdir dir="${basedir}/target/tests"/>
|
||||
<copy todir="${basedir}/target/tests">
|
||||
<fileset dir="${basedir}/../../stdlib/test/js">
|
||||
<include name="**/*.kt"/>
|
||||
<exclude name="**/*JVM.kt"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-js-library</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>js</id>
|
||||
<goals>
|
||||
<goal>js</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>QUnit Test Suite</title>
|
||||
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen">
|
||||
<script type="text/javascript" src="qunit.js"></script>
|
||||
<script type="text/javascript" src="test.js"></script>
|
||||
<script type="text/javascript" src="deepEqual.js"></script>
|
||||
<script>
|
||||
var logs = ["begin", "testStart", "testDone", "log", "moduleStart", "moduleDone", "done"];
|
||||
for (var i = 0; i < logs.length; i++) {
|
||||
(function() {
|
||||
var log = logs[i];
|
||||
QUnit[log] = function() {
|
||||
console.log(log, arguments);
|
||||
};
|
||||
})();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit-fixture">test markup</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Kotlin Standard Library Test Suite</title>
|
||||
<link rel="stylesheet" href="qunit.css">
|
||||
<script src="qunit.js"></script>
|
||||
|
||||
<script src="../../../target/js/kotlin-lib-ecma3.js"></script>
|
||||
<script src="../../../target/js/kotlin-lib.js"></script>
|
||||
<script src="../../../target/js/kotlin-js-tests.js"></script>
|
||||
|
||||
<script src="deepEqual.js"></script>
|
||||
<script src="swarminject.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture">test markup</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,236 @@
|
||||
/**
|
||||
* QUnit v1.7.0pre - A JavaScript Unit Testing Framework
|
||||
*
|
||||
* http://docs.jquery.com/QUnit
|
||||
*
|
||||
* Copyright (c) 2012 John Resig, Jörn Zaefferer
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* or GPL (GPL-LICENSE.txt) licenses.
|
||||
*/
|
||||
|
||||
/** Font Family and Sizes */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
||||
#qunit-tests { font-size: smaller; }
|
||||
|
||||
|
||||
/** Resets */
|
||||
|
||||
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/** Header */
|
||||
|
||||
#qunit-header {
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
|
||||
color: #8699a4;
|
||||
background-color: #0d3349;
|
||||
|
||||
font-size: 1.5em;
|
||||
line-height: 1em;
|
||||
font-weight: normal;
|
||||
|
||||
border-radius: 15px 15px 0 0;
|
||||
-moz-border-radius: 15px 15px 0 0;
|
||||
-webkit-border-top-right-radius: 15px;
|
||||
-webkit-border-top-left-radius: 15px;
|
||||
}
|
||||
|
||||
#qunit-header a {
|
||||
text-decoration: none;
|
||||
color: #c2ccd1;
|
||||
}
|
||||
|
||||
#qunit-header a:hover,
|
||||
#qunit-header a:focus {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#qunit-header label {
|
||||
display: inline-block;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
#qunit-banner {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar {
|
||||
padding: 0.5em 0 0.5em 2em;
|
||||
color: #5E740B;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
#qunit-userAgent {
|
||||
padding: 0.5em 0 0.5em 2.5em;
|
||||
background-color: #2b81af;
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||
}
|
||||
|
||||
|
||||
/** Tests: Pass/Fail */
|
||||
|
||||
#qunit-tests {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li {
|
||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
||||
border-bottom: 1px solid #fff;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests li strong {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#qunit-tests li a {
|
||||
padding: 0.5em;
|
||||
color: #c2ccd1;
|
||||
text-decoration: none;
|
||||
}
|
||||
#qunit-tests li a:hover,
|
||||
#qunit-tests li a:focus {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#qunit-tests ol {
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
background-color: #fff;
|
||||
|
||||
border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
-webkit-border-radius: 15px;
|
||||
|
||||
box-shadow: inset 0px 2px 13px #999;
|
||||
-moz-box-shadow: inset 0px 2px 13px #999;
|
||||
-webkit-box-shadow: inset 0px 2px 13px #999;
|
||||
}
|
||||
|
||||
#qunit-tests table {
|
||||
border-collapse: collapse;
|
||||
margin-top: .2em;
|
||||
}
|
||||
|
||||
#qunit-tests th {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
padding: 0 .5em 0 0;
|
||||
}
|
||||
|
||||
#qunit-tests td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#qunit-tests pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#qunit-tests del {
|
||||
background-color: #e0f2be;
|
||||
color: #374e0c;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests ins {
|
||||
background-color: #ffcaca;
|
||||
color: #500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*** Test Counts */
|
||||
|
||||
#qunit-tests b.counts { color: black; }
|
||||
#qunit-tests b.passed { color: #5E740B; }
|
||||
#qunit-tests b.failed { color: #710909; }
|
||||
|
||||
#qunit-tests li li {
|
||||
margin: 0.5em;
|
||||
padding: 0.4em 0.5em 0.4em 0.5em;
|
||||
background-color: #fff;
|
||||
border-bottom: none;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/*** Passing Styles */
|
||||
|
||||
#qunit-tests li li.pass {
|
||||
color: #5E740B;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #C6E746;
|
||||
}
|
||||
|
||||
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
|
||||
#qunit-tests .pass .test-name { color: #366097; }
|
||||
|
||||
#qunit-tests .pass .test-actual,
|
||||
#qunit-tests .pass .test-expected { color: #999999; }
|
||||
|
||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
||||
|
||||
/*** Failing Styles */
|
||||
|
||||
#qunit-tests li li.fail {
|
||||
color: #710909;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #EE5757;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#qunit-tests > li:last-child {
|
||||
border-radius: 0 0 15px 15px;
|
||||
-moz-border-radius: 0 0 15px 15px;
|
||||
-webkit-border-bottom-right-radius: 15px;
|
||||
-webkit-border-bottom-left-radius: 15px;
|
||||
}
|
||||
|
||||
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
|
||||
#qunit-tests .fail .test-name,
|
||||
#qunit-tests .fail .module-name { color: #000000; }
|
||||
|
||||
#qunit-tests .fail .test-actual { color: #EE5757; }
|
||||
#qunit-tests .fail .test-expected { color: green; }
|
||||
|
||||
#qunit-banner.qunit-fail { background-color: #EE5757; }
|
||||
|
||||
|
||||
/** Result */
|
||||
|
||||
#qunit-testresult {
|
||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
||||
|
||||
color: #2b81af;
|
||||
background-color: #D2E0E6;
|
||||
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
#qunit-testresult .module-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/** Fixture */
|
||||
|
||||
#qunit-fixture {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
width: 1000px;
|
||||
height: 1000px;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
// load testswarm agent
|
||||
(function() {
|
||||
var url = window.location.search;
|
||||
url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) );
|
||||
if ( !url || url.indexOf("http") !== 0 ) {
|
||||
return;
|
||||
}
|
||||
document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date).getTime() + "'></scr" + "ipt>");
|
||||
})();
|
||||
+56
-44
@@ -39,6 +39,8 @@ import java.nio.charset.Charset;
|
||||
*/
|
||||
public class K2JSCompilerMojo extends KotlinCompileMojo {
|
||||
public static final String KOTLIN_JS_LIB = "kotlin-lib.js";
|
||||
public static final String KOTLIN_JS_LIB_ECMA3 = "kotlin-lib-ecma3.js";
|
||||
public static final String KOTLIN_JS_LIB_ECMA5 = "kotlin-lib-ecma5.js";
|
||||
|
||||
/**
|
||||
* The output JS file name
|
||||
@@ -52,10 +54,10 @@ public class K2JSCompilerMojo extends KotlinCompileMojo {
|
||||
* The output Kotlin JS file
|
||||
*
|
||||
* @required
|
||||
* @parameter default-value="${project.build.directory}/js/kotlin-lib.js"
|
||||
* @parameter default-value="${project.build.directory}/js"
|
||||
* @parameter expression="${outputKotlinJSFile}"
|
||||
*/
|
||||
private File outputKotlinJSFile;
|
||||
private File outputKotlinJSDir;
|
||||
|
||||
/**
|
||||
* Whether to copy the kotlin-lib.js file to the output directory
|
||||
@@ -83,52 +85,62 @@ public class K2JSCompilerMojo extends KotlinCompileMojo {
|
||||
|
||||
@Override
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
super.execute();
|
||||
if (copyLibraryJS != null && copyLibraryJS.booleanValue()) {
|
||||
getLog().info("Copying kotlin JS library to " + outputKotlinJSFile);
|
||||
|
||||
// lets copy the kotlin library into the output directory
|
||||
try {
|
||||
File parentFile = outputKotlinJSFile.getParentFile();
|
||||
parentFile.mkdirs();
|
||||
final InputStream inputStream = MetaInfServices.loadClasspathResource(KOTLIN_JS_LIB);
|
||||
if (inputStream == null) {
|
||||
System.out.println("WARNING: Could not find " + KOTLIN_JS_LIB + " on the classpath!");
|
||||
} else {
|
||||
InputSupplier<InputStream> inputSupplier = new InputSupplier<InputStream>() {
|
||||
@Override
|
||||
public InputStream getInput() throws IOException {
|
||||
return inputStream;
|
||||
}
|
||||
};
|
||||
Files.copy(inputSupplier, outputKotlinJSFile);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new MojoExecutionException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
if (appendLibraryJS != null && appendLibraryJS.booleanValue()) {
|
||||
getLog().info("Appending Kotlin Library JS to the generated file " + outputFile);
|
||||
|
||||
// lets copy the kotlin library into the output directory
|
||||
try {
|
||||
final InputStream inputStream = MetaInfServices.loadClasspathResource(KOTLIN_JS_LIB);
|
||||
if (inputStream == null) {
|
||||
System.out.println("WARNING: Could not find " + KOTLIN_JS_LIB + " on the classpath!");
|
||||
} else {
|
||||
InputSupplier<InputStream> inputSupplier = new InputSupplier<InputStream>() {
|
||||
@Override
|
||||
public InputStream getInput() throws IOException {
|
||||
return inputStream;
|
||||
}
|
||||
};
|
||||
String text = "\n" + FileUtil.loadTextAndClose(inputStream);
|
||||
Charset charset = Charset.defaultCharset();
|
||||
Files.append(text, new File(outputFile), charset);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new MojoExecutionException(e.getMessage(), e);
|
||||
appendFile(KOTLIN_JS_LIB_ECMA3);
|
||||
appendFile(KOTLIN_JS_LIB);
|
||||
}
|
||||
super.execute();
|
||||
if (copyLibraryJS != null && copyLibraryJS.booleanValue()) {
|
||||
getLog().info("Copying kotlin JS library to " + outputKotlinJSDir);
|
||||
|
||||
copyJsLibraryFile(KOTLIN_JS_LIB);
|
||||
copyJsLibraryFile(KOTLIN_JS_LIB_ECMA3);
|
||||
copyJsLibraryFile(KOTLIN_JS_LIB_ECMA5);
|
||||
}
|
||||
}
|
||||
|
||||
protected void appendFile(String jsLib) throws MojoExecutionException {
|
||||
// lets copy the kotlin library into the output directory
|
||||
try {
|
||||
final InputStream inputStream = MetaInfServices.loadClasspathResource(jsLib);
|
||||
if (inputStream == null) {
|
||||
System.out.println("WARNING: Could not find " + jsLib + " on the classpath!");
|
||||
} else {
|
||||
InputSupplier<InputStream> inputSupplier = new InputSupplier<InputStream>() {
|
||||
@Override
|
||||
public InputStream getInput() throws IOException {
|
||||
return inputStream;
|
||||
}
|
||||
};
|
||||
String text = "\n" + FileUtil.loadTextAndClose(inputStream);
|
||||
Charset charset = Charset.defaultCharset();
|
||||
Files.append(text, new File(outputFile), charset);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new MojoExecutionException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void copyJsLibraryFile(String jsLib) throws MojoExecutionException {
|
||||
// lets copy the kotlin library into the output directory
|
||||
try {
|
||||
outputKotlinJSDir.mkdirs();
|
||||
final InputStream inputStream = MetaInfServices.loadClasspathResource(jsLib);
|
||||
if (inputStream == null) {
|
||||
System.out.println("WARNING: Could not find " + jsLib + " on the classpath!");
|
||||
} else {
|
||||
InputSupplier<InputStream> inputSupplier = new InputSupplier<InputStream>() {
|
||||
@Override
|
||||
public InputStream getInput() throws IOException {
|
||||
return inputStream;
|
||||
}
|
||||
};
|
||||
Files.copy(inputSupplier, new File(outputKotlinJSDir, jsLib));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new MojoExecutionException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user