| 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", |
| "-Xforce-deprecated-legacy-compiler-usage" |
| ] |
| 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 |
| } |
| |
| task libraryJarWithoutIr(type: Jar, dependsOn: compileKotlin2Js) { |
| archiveClassifier.set(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 |
| |
| 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) |
| |
| task sourcesJar(type: Jar, dependsOn: classes) { |
| archiveClassifier.set('sources') |
| from (sourceSets.main.allSource) |
| } |
| |
| artifacts { |
| archives libraryJarWithIr |
| distLibrary libraryJarWithIr |
| archives sourcesJar |
| distJs(file(compileKotlin2Js.kotlinOptions.outputFile)) { |
| builtBy(compileKotlin2Js) |
| } |
| } |
| |
| configureSourcesJar() |
| |
| configureJavadocJar() |