KT-62004 Drop legacy JS build of kotlin-test
This commit is contained in:
committed by
Space Team
parent
291d52820c
commit
eb813b7837
@@ -1,96 +0,0 @@
|
||||
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)
|
||||
@@ -1 +0,0 @@
|
||||
node_modules
|
||||
@@ -1,105 +0,0 @@
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
|
||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute
|
||||
|
||||
plugins {
|
||||
id "com.github.node-gradle.node" version "5.0.0"
|
||||
}
|
||||
|
||||
description = 'Kotlin-test integration tests for JS'
|
||||
|
||||
apply plugin: 'kotlin-platform-js'
|
||||
|
||||
configurations {
|
||||
nodeModules {
|
||||
extendsFrom api
|
||||
attributes {
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY))
|
||||
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, KotlinUsages.KOTLIN_RUNTIME))
|
||||
attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
|
||||
attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.legacy)
|
||||
}
|
||||
}
|
||||
[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 {
|
||||
api project(':kotlin-test:kotlin-test-js')
|
||||
}
|
||||
|
||||
// package.json contains direct links to the builddir
|
||||
buildDir = "$projectDir/build"
|
||||
|
||||
["compileKotlin2Js", "compileTestKotlin2Js"].forEach {
|
||||
tasks.named(it).configure {
|
||||
kotlinOptions {
|
||||
moduleKind = "commonjs"
|
||||
freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("populateNodeModules", Copy) {
|
||||
dependsOn(compileKotlin2Js)
|
||||
dependsOn(configurations.nodeModules)
|
||||
from compileKotlin2Js.destinationDirectory
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE // temporary until stdlib mpp migration is completed
|
||||
|
||||
from {
|
||||
configurations.nodeModules.collect {
|
||||
// WORKAROUND: Some JS IR jars were absent and caused this task to fail.
|
||||
// They don't contain .js thus we can skip them.
|
||||
if (it.exists()) {
|
||||
zipTree(it.absolutePath).matching { include '*.js' }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
into "${buildDir}/node_modules"
|
||||
}
|
||||
|
||||
node {
|
||||
version = RepoDependencies.getNodejsVersion(project)
|
||||
download = true
|
||||
}
|
||||
|
||||
def createFrameworkTest(def name) {
|
||||
return tasks.register("test$name", NpmTask) {
|
||||
dependsOn(compileTestKotlin2Js, populateNodeModules, npmInstall)
|
||||
def testName = name
|
||||
def lowerName = name.toLowerCase()
|
||||
def tcOutput = project.file("$buildDir/tc-${lowerName}.log")
|
||||
def stdOutput = "$buildDir/test-${lowerName}.log"
|
||||
def errOutput = "$buildDir/test-${lowerName}.err.log"
|
||||
def exitCodeFile = project.file("$buildDir/test-${lowerName}.exit-code")
|
||||
inputs.files(sourceSets.test.output)
|
||||
inputs.dir("${buildDir}/node_modules")
|
||||
outputs.files(tcOutput, stdOutput, errOutput, exitCodeFile)
|
||||
|
||||
args = ['run', "test-$lowerName"]
|
||||
group = 'verification'
|
||||
execOverrides {
|
||||
it.ignoreExitValue = true
|
||||
it.standardOutput = new FileOutputStream(stdOutput)
|
||||
it.errorOutput = new FileOutputStream(errOutput)
|
||||
}
|
||||
|
||||
def ignoreTestFailures = rootProject.ignoreTestFailures
|
||||
doLast {
|
||||
println tcOutput.text
|
||||
if (exitCodeFile.text != "0" && !ignoreTestFailures) {
|
||||
throw new GradleException("$testName integration test failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.check {
|
||||
['Jest', 'Jasmine', 'Mocha', 'Qunit', 'Tape'].each {
|
||||
dependsOn createFrameworkTest(it)
|
||||
}
|
||||
}
|
||||
-7981
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"test-jasmine": "jasmine js/jasmine-reporter.js build/classes/kotlin/test/kotlin-test-js-it_test.js",
|
||||
"test-jest": "jest",
|
||||
"test-mocha": "mocha --reporter js/mocha-reporter.js build/classes/kotlin/test/kotlin-test-js-it_test.js",
|
||||
"test-qunit": "qunit --require ./js/qunit-reporter.js build/classes/kotlin/test/kotlin-test-js-it_test.js",
|
||||
"test-tape": "tape js/tape-reporter.js js/tape-plugin.js build/classes/kotlin/test/kotlin-test-js-it_test.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jasmine": "^3.10.0",
|
||||
"jest": "^29.5.0",
|
||||
"mocha": "^9.2.1",
|
||||
"qunit": "^2.18.2",
|
||||
"tape": "~4.10.0"
|
||||
},
|
||||
"jest": {
|
||||
"testResultsProcessor": "<rootDir>/js/jest-reporter.js",
|
||||
"testRegex": "_test\\.js$"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user