e9cea3358d
This avoids having both libraryJarWithoutIr and default jar artifact, which points to the same path as libraryJarWithIr, in the dependent projects' classpath. Use libraryJarWithIr instead. For local builds where libraryJarWithIr doesn't contain any IR, this should have the same effect.
88 lines
2.0 KiB
Groovy
88 lines
2.0 KiB
Groovy
description = 'Kotlin Test for JS'
|
|
|
|
apply plugin: 'kotlin-platform-js'
|
|
|
|
configurePublishing(project)
|
|
|
|
configurations {
|
|
sources
|
|
distJs
|
|
distLibrary
|
|
}
|
|
|
|
dependencies {
|
|
expectedBy project(':kotlin-test:kotlin-test-common')
|
|
expectedBy project(':kotlin-test:kotlin-test-annotations-common')
|
|
compile kotlinStdlib("js")
|
|
}
|
|
|
|
compileKotlin2Js {
|
|
kotlinOptions.freeCompilerArgs = [
|
|
"-Xallow-kotlin-package",
|
|
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
|
|
]
|
|
kotlinOptions {
|
|
moduleKind = "umd"
|
|
outputFile = "${buildDir}/classes/main/kotlin-test.js"
|
|
sourceMap = true
|
|
sourceMapPrefix = "./"
|
|
sourceMapEmbedSources = "always"
|
|
}
|
|
}
|
|
|
|
compileTestKotlin2Js {
|
|
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"]
|
|
kotlinOptions {
|
|
metaInfo = false
|
|
moduleKind = "umd"
|
|
}
|
|
}
|
|
|
|
|
|
archivesBaseName = 'kotlin-test-js'
|
|
|
|
jar {
|
|
enabled false
|
|
}
|
|
|
|
task libraryJarWithoutIr(type: Jar, dependsOn: compileKotlin2Js) {
|
|
classifier = null
|
|
destinationDirectory = file("$buildDir/lib/dist")
|
|
from("$buildDir/classes/main")
|
|
manifestAttributes(manifest, project, 'Test')
|
|
}
|
|
|
|
task libraryJarWithIr(type: Zip, dependsOn: libraryJarWithoutIr) {
|
|
archiveExtension = "jar"
|
|
destinationDirectory = file("$buildDir/libs")
|
|
|
|
duplicatesStrategy DuplicatesStrategy.FAIL
|
|
|
|
from zipTree(libraryJarWithoutIr.archiveFile)
|
|
if (rootProject.includeStdlibJsIr) {
|
|
def irKlib = tasks.getByPath(":kotlin-stdlib-js-ir:generateKotlinTestKLib")
|
|
dependsOn(irKlib)
|
|
from fileTree("${irKlib.outputs.files.singleFile.path}/klib")
|
|
}
|
|
}
|
|
|
|
jar.dependsOn(libraryJarWithIr)
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
classifier = 'sources'
|
|
from (sourceSets.main.allSource)
|
|
}
|
|
|
|
artifacts {
|
|
runtime libraryJarWithIr
|
|
archives libraryJarWithIr
|
|
distLibrary libraryJarWithoutIr
|
|
archives sourcesJar
|
|
sources sourcesJar
|
|
distJs(file(compileKotlin2Js.kotlinOptions.outputFile)) {
|
|
builtBy(compileKotlin2Js)
|
|
}
|
|
}
|
|
|
|
javadocJar()
|