[JS] Remove legacy js in maven

This commit is contained in:
Ilya Goncharov
2023-06-13 19:28:15 +02:00
committed by Space Team
parent 0ac0c51c23
commit 49b2ac1b10
28 changed files with 1 additions and 685 deletions
@@ -211,13 +211,7 @@
<pomExclude>test-enable-extensions/pom.xml</pomExclude>
<pomExclude>test-kapt-allopen/pom.xml</pomExclude>
<pomExclude>test-lombok-with-kapt/pom.xml</pomExclude>
<!-- exclude js and mpp -->
<pomExclude>test-js-moduleKind/pom.xml</pomExclude>
<pomExclude>test-js-accessToInternal/pom.xml</pomExclude>
<pomExclude>test-js-suppressWarnings/pom.xml</pomExclude>
<pomExclude>test-js-sourceMap/pom.xml</pomExclude>
<pomExclude>test-js-extraArguments/pom.xml</pomExclude>
<pomExclude>test-js-sourceMapEmbedSources/pom.xml</pomExclude>
<!-- exclude mpp -->
<pomExclude>test-multiplatform/pom.xml</pomExclude>
<!-- exclude kts -->
<pomExclude>test-helloworld-kts/pom.xml</pomExclude>
@@ -1 +0,0 @@
this['test-js-accessToInternal-tests'].org.jetbrains.test();
@@ -1,83 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-js-accessToInternal</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>js</goal>
</goals>
<configuration>
<output>${project.basedir}/customOutput/</output>
<args>
<arg>-Xforce-deprecated-legacy-compiler-usage</arg>
</args>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-js</goal>
</goals>
<configuration>
<args>
<arg>-Xforce-deprecated-legacy-compiler-usage</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/js/</outputDirectory>
<includes>**/*.js</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -1,31 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains
internal val CONST = "CONST"
open class PublicClass {
internal fun foo(): String = "foo"
internal val bar: String = "bar"
open internal fun baz(): String = "PublicClass.baz()"
}
internal data class InternalDataClass(val x: Int, val y: Int)
internal fun box(): String {
return "OK"
}
@@ -1,41 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains
class PublicClassHeir : PublicClass() {
override internal fun baz(): String = "PublicClassHeir.baz()"
}
fun <T> assertEquals(e: T, a: T) {
if (e != a) throw Exception("Expected: $e, actual: $a")
}
fun test() {
assertEquals("CONST", CONST)
assertEquals("foo", PublicClass().foo())
assertEquals("bar", PublicClass().bar)
assertEquals("PublicClass.baz()", PublicClass().baz())
assertEquals("foo", PublicClassHeir().foo())
assertEquals("bar", PublicClassHeir().bar)
assertEquals("PublicClassHeir.baz()", PublicClassHeir().baz())
val data = InternalDataClass(10, 20)
assertEquals(10, data.x)
assertEquals(20, data.y)
}
@@ -1,21 +0,0 @@
import java.io.*;
import javax.script.*;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
File file = new File(basedir, "target/js/test-js-accessToInternal.js");
if (!file.exists() || !file.isFile()) {
throw new FileNotFoundException("Could not find generated JS : " + file);
}
File testFile = new File(basedir, "target/test-js/test-js-accessToInternal-tests.js");
if (!testFile.exists() || !testFile.isFile()) {
throw new FileNotFoundException("Could not find generated JS : " + testFile);
}
String basePath = basedir.getPath();
ScriptEngine engine = new NashornScriptEngineFactory().getScriptEngine();
engine.eval(new FileReader(basePath + "/target/js/kotlin.js"));
engine.eval(new FileReader(basePath + "/target/js/test-js-accessToInternal.js"));
engine.eval(new FileReader(basePath + "/target/test-js/test-js-accessToInternal-tests.js"));
engine.eval(new FileReader(basePath + "/check.js"));
@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-js-extraArguments</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>js</goal>
</goals>
</execution>
</executions>
<configuration>
<args>
<arg>-Xno-inline</arg>
<arg>-Xforce-deprecated-legacy-compiler-usage</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -1,9 +0,0 @@
package org.jetbrains
fun main(args : Array<String>) {
println(getGreeting())
}
fun getGreeting() : String {
return "Hello, World!"
}
@@ -1,6 +0,0 @@
import java.io.*;
File file = new File(basedir, "target/js/test-js-extraArguments.js");
if (!file.exists() || !file.isFile()) {
throw new FileNotFoundException("Could not find generated JS : " + file);
}
@@ -1,23 +0,0 @@
var amdModules = {};
// Hard-code expected dependency order since we are unable to refer to modules by filename here.
var moduleNames = ["kotlin", "test-js-moduleKind", "check"];
function define(moduleName, dependencies, body) {
if (Array.isArray(moduleName)) {
body = dependencies;
dependencies = moduleName;
moduleName = moduleNames.shift();
}
else {
if (moduleName !== moduleNames.shift()) throw new Error("Unexpected dependency")
}
var resolvedDependencies = [];
var currentModule = {};
amdModules[moduleName] = currentModule;
for (var i = 0; i < dependencies.length; ++i) {
var dependencyName = dependencies[i];
var dependency = dependencyName === 'exports' ? currentModule : amdModules[dependencyName];
resolvedDependencies.push(dependency);
}
body.apply(body, resolvedDependencies);
}
define.amd = {};
@@ -1,21 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define("check", ["test-js-moduleKind"], function(app) {
if (app.foo.bar() != "OK") {
throw new Error("Unexpected result");
}
});
@@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-js-moduleKind</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>js</goal>
</goals>
</execution>
</executions>
<configuration>
<moduleKind>umd</moduleKind>
<args>
<arg>-Xforce-deprecated-legacy-compiler-usage</arg>
</args>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/js/</outputDirectory>
<includes>**/*.js</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -1,19 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package foo
fun bar() = "OK"
@@ -1,16 +0,0 @@
import java.io.*;
import javax.script.*;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
File file = new File(basedir, "target/js/test-js-moduleKind.js");
if (!file.exists() || !file.isFile()) {
throw new FileNotFoundException("Could not find generated JS : " + file);
}
String basePath = basedir.getPath();
ScriptEngine engine = new NashornScriptEngineFactory().getScriptEngine();
engine.eval(new FileReader(basePath + "/amd.js"));
engine.eval(new FileReader(basePath + "/target/js/kotlin.js"));
engine.eval(new FileReader(basePath + "/target/js/test-js-moduleKind.js"));
engine.eval(new FileReader(basePath + "/check.js"));
@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-js-sourceMap</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>js</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceMap>true</sourceMap>
<sourceMapPrefix>prefixprefix/</sourceMapPrefix>
<args>
<arg>-Xforce-deprecated-legacy-compiler-usage</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -1,19 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains
fun bar() = "OK"
@@ -1,3 +0,0 @@
source(new File(basedir, "../../../verify-common.bsh").getAbsolutePath());
assertFileContains("target/js/test-js-sourceMap.js.map", "\"prefixprefix/org/jetbrains/HelloWorld.kt\"")
@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-js-sourceMapEmbedSources</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>js</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceMap>true</sourceMap>
<sourceMapEmbedSources>always</sourceMapEmbedSources>
<args>
<arg>-Xforce-deprecated-legacy-compiler-usage</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -1,3 +0,0 @@
package org.jetbrains
fun bar() = "OK"
@@ -1,5 +0,0 @@
source(new File(basedir, "../../../verify-common.bsh").getAbsolutePath());
assertFileContains("target/js/test-js-sourceMapEmbedSources.js.map", "\"org/jetbrains/HelloWorld.kt\"");
assertFileContains("target/js/test-js-sourceMapEmbedSources.js.map", "\"package org.jetbrains");
assertFileContains("target/js/test-js-sourceMapEmbedSources.js.map", "fun bar() = \\\"OK\\\"")
@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-js-suppressWarningsAndVersion</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>js</goal>
</goals>
</execution>
</executions>
<configuration>
<nowarn>true</nowarn>
<args>
<arg>-Xforce-deprecated-legacy-compiler-usage</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -1,19 +0,0 @@
package org.jetbrains
import kotlin.Any
fun foo(p: Int??) {
}
interface T {
abstract fun foo()
}
fun main(args : Array<String>) {
println(getGreeting())
}
fun getGreeting() : String {
return "Hello, World!"
}
@@ -1,6 +0,0 @@
import java.io.*;
File file = new File(basedir, "target/js/test-js-suppressWarningsAndVersion.js");
if (!file.exists() || !file.isFile()) {
throw new FileNotFoundException("Could not find generated JS : " + file);
}
@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-multimodule-root</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>test-multimodule-js</artifactId>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-js</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-multimodule-shared</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>js</goal>
</goals>
<configuration>
<multiPlatform>true</multiPlatform>
<args>
<arg>-Xforce-deprecated-legacy-compiler-usage</arg>
</args>
</configuration>
</execution>
<execution>
<id>compile-test</id>
<phase>test-compile</phase>
<goals>
<goal>test-js</goal>
</goals>
<configuration>
<multiPlatform>true</multiPlatform>
<args>
<arg>-Xforce-deprecated-legacy-compiler-usage</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -1,9 +0,0 @@
package org.jetbrains
fun main(args: Array<String>) {
doMain()
}
actual fun doMain() {
console.info(getGreeting())
}
@@ -1,10 +0,0 @@
package org.jetbrains
import kotlin.test.*
class JSSpecificTest {
@Test
fun test1() {
assertEquals(1, 1)
}
}
@@ -11,7 +11,6 @@
<modules>
<module>shared</module>
<module>js</module>
<module>jvm</module>
</modules>
</project>
@@ -12,11 +12,6 @@ if (!classFile.exists()) {
throw new FileNotFoundException("Could not find generated class file: " + classFile);
}
File scriptFile = new File(basedir, "js/target/js/test-multimodule-js.js");
if (!scriptFile.exists()) {
throw new FileNotFoundException("Could not find generated JavaScript file: " + scriptFile);
}
File metaFile = new File(basedir, "shared/target/classes/org/jetbrains/ApiKt.kotlin_metadata");
if (!metaFile.exists()) {
throw new FileNotFoundException("Could not find generated common metadata file: " + metaFile);