97 lines
2.6 KiB
Groovy
97 lines
2.6 KiB
Groovy
description = 'Kotlin Test for JS'
|
|
|
|
apply plugin: 'kotlin-platform-js'
|
|
|
|
configurations {
|
|
distJs
|
|
distLibrary
|
|
[compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath].forEach {
|
|
it.attributes {
|
|
attribute(org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute.jsCompilerAttribute, org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute.legacy)
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
expectedBy project(':kotlin-test:kotlin-test-common')
|
|
expectedBy project(':kotlin-test:kotlin-test-annotations-common')
|
|
api RepoDependencies.kotlinStdlib(project)
|
|
}
|
|
|
|
compileKotlin2Js {
|
|
kotlinOptions.freeCompilerArgs = [
|
|
"-Xallow-kotlin-package",
|
|
"-opt-in=kotlin.contracts.ExperimentalContracts",
|
|
"-opt-in=kotlin.RequiresOptIn",
|
|
"-Xforce-deprecated-legacy-compiler-usage",
|
|
"-Xexpect-actual-classes"
|
|
]
|
|
kotlinOptions {
|
|
moduleKind = "umd"
|
|
outputFile = "${buildDir}/classes/main/kotlin-test.js"
|
|
sourceMap = true
|
|
sourceMapPrefix = "./"
|
|
sourceMapEmbedSources = "always"
|
|
}
|
|
}
|
|
|
|
compileTestKotlin2Js {
|
|
kotlinOptions {
|
|
metaInfo = false
|
|
moduleKind = "umd"
|
|
freeCompilerArgs = ["-Xallow-kotlin-package", "-Xforce-deprecated-legacy-compiler-usage"]
|
|
}
|
|
}
|
|
|
|
|
|
archivesBaseName = 'kotlin-test-js'
|
|
|
|
jar {
|
|
enabled false
|
|
}
|
|
|
|
tasks.register("libraryJarWithoutIr", Jar) {
|
|
dependsOn(compileKotlin2Js)
|
|
archiveClassifier.set(null)
|
|
destinationDirectory = file("$buildDir/lib/dist")
|
|
from("$buildDir/classes/main")
|
|
LibrariesCommon.manifestAttributes(project, manifest, 'Test')
|
|
}
|
|
|
|
tasks.register("libraryJarWithIr", Zip) {
|
|
dependsOn(libraryJarWithoutIr)
|
|
archiveExtension = "jar"
|
|
destinationDirectory = file("$buildDir/libs")
|
|
|
|
duplicatesStrategy DuplicatesStrategy.FAIL
|
|
|
|
def archiveOperations = services.get(ArchiveOperations)
|
|
from { libraryJarWithoutIr.archiveFile.map { archiveOperations.zipTree(it) } }
|
|
|
|
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)
|
|
|
|
tasks.register("sourcesJar", Jar) {
|
|
dependsOn(classes)
|
|
archiveClassifier.set('sources')
|
|
from (sourceSets.main.allSource)
|
|
}
|
|
|
|
artifacts {
|
|
archives libraryJarWithIr
|
|
distLibrary libraryJarWithIr
|
|
archives sourcesJar
|
|
distJs(file(compileKotlin2Js.kotlinOptions.outputFile)) {
|
|
builtBy(compileKotlin2Js)
|
|
}
|
|
}
|
|
|
|
RepoArtifacts.sourcesJar(project)
|
|
RepoArtifacts.javadocJar(project)
|