Merge kotlin-experimental into kotlin standard library (KT-23055 fixed)
* kotlin-experimental.js has been already merged into kotlin.js * change library name to kotlin in kotlin-experimental.meta.js in order to produce correct require calls * concatenate kotlin-experimental.meta.js with kotlin.meta.js * suppress multiple module declaration warning for such use case
This commit is contained in:
committed by
Anton Bannykh
parent
d0e71acaa5
commit
7b860eab36
@@ -4,7 +4,5 @@ kotlinProject/
|
|||||||
kotlinProject.js
|
kotlinProject.js
|
||||||
kotlinProject.meta.js
|
kotlinProject.meta.js
|
||||||
lib/
|
lib/
|
||||||
kotlin-experimental.js
|
|
||||||
kotlin-experimental.meta.js
|
|
||||||
kotlin.js
|
kotlin.js
|
||||||
kotlin.meta.js
|
kotlin.meta.js
|
||||||
Vendored
-2
@@ -11,8 +11,6 @@ kotlinProject/
|
|||||||
file0.js
|
file0.js
|
||||||
jslib-example.js
|
jslib-example.js
|
||||||
jslib-example.meta.js
|
jslib-example.meta.js
|
||||||
kotlin-experimental.js
|
|
||||||
kotlin-experimental.meta.js
|
|
||||||
kotlin.js
|
kotlin.js
|
||||||
kotlin.meta.js
|
kotlin.meta.js
|
||||||
res0.js
|
res0.js
|
||||||
|
|||||||
Vendored
-2
@@ -4,7 +4,5 @@ kotlinProject/
|
|||||||
kotlinProject.js
|
kotlinProject.js
|
||||||
kotlinProject.meta.js
|
kotlinProject.meta.js
|
||||||
lib/
|
lib/
|
||||||
kotlin-experimental.js
|
|
||||||
kotlin-experimental.meta.js
|
|
||||||
kotlin.js
|
kotlin.js
|
||||||
kotlin.meta.js
|
kotlin.meta.js
|
||||||
-2
@@ -11,8 +11,6 @@ kotlinProject/
|
|||||||
file0.js
|
file0.js
|
||||||
jslib-example.js
|
jslib-example.js
|
||||||
jslib-example.meta.js
|
jslib-example.meta.js
|
||||||
kotlin-experimental.js
|
|
||||||
kotlin-experimental.meta.js
|
|
||||||
kotlin.js
|
kotlin.js
|
||||||
kotlin.meta.js
|
kotlin.meta.js
|
||||||
res0.js
|
res0.js
|
||||||
|
|||||||
Vendored
-2
@@ -7,8 +7,6 @@ kotlinProject/
|
|||||||
file0.js
|
file0.js
|
||||||
jslib-example.js
|
jslib-example.js
|
||||||
jslib-example.meta.js
|
jslib-example.meta.js
|
||||||
kotlin-experimental.js
|
|
||||||
kotlin-experimental.meta.js
|
|
||||||
kotlin.js
|
kotlin.js
|
||||||
kotlin.meta.js
|
kotlin.meta.js
|
||||||
res0.js
|
res0.js
|
||||||
|
|||||||
-4
@@ -4,14 +4,10 @@ kotlinProject/
|
|||||||
kotlinProject.js
|
kotlinProject.js
|
||||||
kotlinProject.meta.js
|
kotlinProject.meta.js
|
||||||
lib/
|
lib/
|
||||||
kotlin-experimental.js
|
|
||||||
kotlin-experimental.meta.js
|
|
||||||
kotlin.js
|
kotlin.js
|
||||||
kotlin.meta.js
|
kotlin.meta.js
|
||||||
module2/
|
module2/
|
||||||
lib/
|
lib/
|
||||||
kotlin-experimental.js
|
|
||||||
kotlin-experimental.meta.js
|
|
||||||
kotlin.js
|
kotlin.js
|
||||||
kotlin.meta.js
|
kotlin.meta.js
|
||||||
module2/
|
module2/
|
||||||
|
|||||||
@@ -202,6 +202,8 @@ public class JsConfig {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<String> moduleNames = new LinkedHashSet<>();
|
||||||
|
|
||||||
for (KotlinJavascriptMetadata metadata : metadataList) {
|
for (KotlinJavascriptMetadata metadata : metadataList) {
|
||||||
if (!metadata.getVersion().isCompatible() && !skipMetadataVersionCheck) {
|
if (!metadata.getVersion().isCompatible() && !skipMetadataVersionCheck) {
|
||||||
report.error("File '" + path + "' was compiled with an incompatible version of Kotlin. " +
|
report.error("File '" + path + "' was compiled with an incompatible version of Kotlin. " +
|
||||||
@@ -209,8 +211,13 @@ public class JsConfig {
|
|||||||
", expected version is " + JsMetadataVersion.INSTANCE);
|
", expected version is " + JsMetadataVersion.INSTANCE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!modules.add(metadata.getModuleName())) {
|
|
||||||
report.warning("Module \"" + metadata.getModuleName() + "\" is defined in more than one file");
|
moduleNames.add(metadata.getModuleName());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String moduleName : moduleNames) {
|
||||||
|
if (!modules.add(moduleName)) {
|
||||||
|
report.warning("Module \"" + moduleName + "\" is defined in more than one file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ def commonSrcDir = "${buildDir}/common-sources"
|
|||||||
def commonTestSrcDir = "${buildDir}/common-test-sources"
|
def commonTestSrcDir = "${buildDir}/common-test-sources"
|
||||||
def builtinsDir = "${rootDir}/core/builtins"
|
def builtinsDir = "${rootDir}/core/builtins"
|
||||||
def experimentalSrcDir = "${rootDir}/libraries/stdlib/experimental"
|
def experimentalSrcDir = "${rootDir}/libraries/stdlib/experimental"
|
||||||
|
def experimentalJsModuleName = 'kotlin-experimental'
|
||||||
def jsSrcGeneratedDir = "${rootDir}/js/js.libraries/src/core/generated" // to be removed soon
|
def jsSrcGeneratedDir = "${rootDir}/js/js.libraries/src/core/generated" // to be removed soon
|
||||||
def jsSrcDir = "src"
|
def jsSrcDir = "src"
|
||||||
def jsTestSrcDir = "test"
|
def jsTestSrcDir = "test"
|
||||||
def jsSrcJsDir = "${jsSrcDir}/js"
|
def jsSrcJsDir = "${jsSrcDir}/js"
|
||||||
def jsOutputFile = "${buildDir}/classes/kotlin.js"
|
def jsOutputFile = "${buildDir}/classes/kotlin.js"
|
||||||
|
def jsOutputMetaFile = "${buildDir}/classes/kotlin.meta.js"
|
||||||
|
|
||||||
def kotlinTestJsOutputFile = "${project(':kotlin-test:kotlin-test-js').buildDir}/classes/main/kotlin-test.js"
|
def kotlinTestJsOutputFile = "${project(':kotlin-test:kotlin-test-js').buildDir}/classes/main/kotlin-test.js"
|
||||||
|
|
||||||
@@ -147,7 +149,7 @@ compileExperimentalKotlin2Js {
|
|||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
languageVersion = "1.3"
|
languageVersion = "1.3"
|
||||||
apiVersion = "1.3"
|
apiVersion = "1.3"
|
||||||
outputFile = "${buildDir}/classes/main/kotlin-experimental.js"
|
outputFile = "${buildDir}/classes/experimental/${experimentalJsModuleName}.js"
|
||||||
sourceMap = true
|
sourceMap = true
|
||||||
sourceMapPrefix = "./"
|
sourceMapPrefix = "./"
|
||||||
freeCompilerArgs += ["-source-map-base-dirs", [experimentalSrcDir].join(File.pathSeparator)]
|
freeCompilerArgs += ["-source-map-base-dirs", [experimentalSrcDir].join(File.pathSeparator)]
|
||||||
@@ -215,7 +217,7 @@ task compileJs(type: JavaExec) {
|
|||||||
if (prefixToRemove != null) sourcePath.substring(prefixToRemove.length()) else sourcePath
|
if (prefixToRemove != null) sourcePath.substring(prefixToRemove.length()) else sourcePath
|
||||||
}
|
}
|
||||||
|
|
||||||
def sourceMapSourcesBaseDirs = [jsSrcDir, jsSrcJsDir, jsSrcGeneratedDir, builtinsSrcDir, commonSrcDir, projectDir]
|
def sourceMapSourcesBaseDirs = [jsSrcDir, jsSrcJsDir, jsSrcGeneratedDir, builtinsSrcDir, commonSrcDir, projectDir, experimentalSrcDir]
|
||||||
|
|
||||||
sourceMap.sourcesContent = sourceMap.sources.collect { sourceName ->
|
sourceMap.sourcesContent = sourceMap.sources.collect { sourceName ->
|
||||||
def text = sourceMapSourcesBaseDirs.collect { file("$it/$sourceName") }.find { it.exists() }?.text
|
def text = sourceMapSourcesBaseDirs.collect { file("$it/$sourceName") }.find { it.exists() }?.text
|
||||||
@@ -224,6 +226,10 @@ task compileJs(type: JavaExec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceMapFile.text = groovy.json.JsonOutput.toJson(sourceMap)
|
sourceMapFile.text = groovy.json.JsonOutput.toJson(sourceMap)
|
||||||
|
|
||||||
|
file(jsOutputMetaFile).text = file(compileKotlin2Js.outputFile.path.replaceAll('\\.js$', '.meta.js')).text +
|
||||||
|
file(compileExperimentalKotlin2Js.outputFile.path.replaceAll('\\.js$', '.meta.js')).text
|
||||||
|
.replaceFirst(experimentalJsModuleName, 'kotlin')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,8 +254,11 @@ task mergedJar(type: Jar, dependsOn: classes) {
|
|||||||
includeEmptyDirs false
|
includeEmptyDirs false
|
||||||
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
||||||
from jsOutputFile
|
from jsOutputFile
|
||||||
|
from jsOutputMetaFile
|
||||||
from "${jsOutputFile}.map"
|
from "${jsOutputFile}.map"
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
|
from sourceSets.experimental.output
|
||||||
|
exclude "${experimentalJsModuleName}.*"
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user