2f39a65679
#KT-44611 In Progress
90 lines
2.2 KiB
Groovy
90 lines
2.2 KiB
Groovy
description = 'Kotlin Test for JS'
|
|
|
|
apply plugin: 'kotlin-platform-js'
|
|
|
|
configurations {
|
|
distJs
|
|
distLibrary
|
|
}
|
|
|
|
dependencies {
|
|
expectedBy project(':kotlin-test:kotlin-test-common')
|
|
expectedBy project(':kotlin-test:kotlin-test-annotations-common')
|
|
api kotlinStdlib("js")
|
|
}
|
|
|
|
compileKotlin2Js {
|
|
kotlinOptions.freeCompilerArgs = [
|
|
"-Xallow-kotlin-package",
|
|
"-opt-in=kotlin.contracts.ExperimentalContracts",
|
|
"-opt-in=kotlin.RequiresOptIn",
|
|
]
|
|
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
|
|
|
|
// workaround for https://github.com/gradle/gradle/issues/17936
|
|
def archiveOperations = services.get(ArchiveOperations)
|
|
RegularFile libraryJarWithoutIrFile = libraryJarWithoutIr.archiveFile.get()
|
|
from { archiveOperations.zipTree(libraryJarWithoutIrFile) }
|
|
|
|
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 {
|
|
archives libraryJarWithIr
|
|
distLibrary libraryJarWithIr
|
|
archives sourcesJar
|
|
distJs(file(compileKotlin2Js.kotlinOptions.outputFile)) {
|
|
builtBy(compileKotlin2Js)
|
|
}
|
|
}
|
|
|
|
configureSourcesJar()
|
|
|
|
configureJavadocJar()
|