90 lines
2.1 KiB
Groovy
90 lines
2.1 KiB
Groovy
description = 'Kotlin Test for JS'
|
|
|
|
apply plugin: 'kotlin-platform-js'
|
|
|
|
configurePublishing(project)
|
|
|
|
configurations {
|
|
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",
|
|
"-Xopt-in=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)
|
|
|
|
dependsOn(":kotlin-test:kotlin-test-js-ir:compileKotlinJs")
|
|
from {
|
|
def irKlib = tasks.getByPath(":kotlin-test:kotlin-test-js-ir:compileKotlinJs")
|
|
fileTree(irKlib.outputs.files.first().path)
|
|
}
|
|
}
|
|
|
|
jar.dependsOn(libraryJarWithIr)
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
classifier = 'sources'
|
|
from (sourceSets.main.allSource)
|
|
}
|
|
|
|
artifacts {
|
|
runtime libraryJarWithIr
|
|
archives libraryJarWithIr
|
|
publishedRuntime libraryJarWithIr
|
|
distLibrary libraryJarWithIr
|
|
archives sourcesJar
|
|
distJs(file(compileKotlin2Js.kotlinOptions.outputFile)) {
|
|
builtBy(compileKotlin2Js)
|
|
}
|
|
}
|
|
|
|
configureSourcesJar()
|
|
|
|
configureJavadocJar()
|