mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
[Build] Bump gradle-node-plugin version to 3.0.1 to support conf cache
:kotlin-test:kotlin-test-js:kotlin-test-js-it will still have old version as integration test run logic cannot be fully refactored to the new version (approximately till 3.1) Relates to #KT-44611
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import com.moowork.gradle.node.NodeExtension
|
||||
import com.moowork.gradle.node.npm.NpmTask
|
||||
import com.github.gradle.node.npm.task.NpmTask
|
||||
import de.undercouch.gradle.tasks.download.Download
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||
@@ -9,14 +8,15 @@ import org.jetbrains.kotlin.ideaExt.idea
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
id("com.github.node-gradle.node") version "2.2.0"
|
||||
id("com.github.node-gradle.node") version "3.0.1"
|
||||
id("de.undercouch.download")
|
||||
id("com.gradle.enterprise.test-distribution")
|
||||
}
|
||||
|
||||
node {
|
||||
download = true
|
||||
version = "10.16.2"
|
||||
download.set(true)
|
||||
version.set("10.16.2")
|
||||
nodeProjectDir.set(buildDir)
|
||||
}
|
||||
|
||||
val antLauncherJar by configurations.creating
|
||||
@@ -304,8 +304,6 @@ val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateJs
|
||||
dependsOn(":compiler:generateTestData")
|
||||
}
|
||||
|
||||
extensions.getByType(NodeExtension::class.java).nodeModulesDir = buildDir
|
||||
|
||||
val prepareMochaTestData by tasks.registering(Copy::class) {
|
||||
from(testDataDir) {
|
||||
include("package.json")
|
||||
@@ -316,30 +314,26 @@ val prepareMochaTestData by tasks.registering(Copy::class) {
|
||||
|
||||
val npmInstall by tasks.getting(NpmTask::class) {
|
||||
dependsOn(prepareMochaTestData)
|
||||
setWorkingDir(buildDir)
|
||||
workingDir.set(buildDir)
|
||||
}
|
||||
|
||||
val runMocha by task<NpmTask> {
|
||||
setWorkingDir(buildDir)
|
||||
workingDir.set(buildDir)
|
||||
|
||||
val target = if (project.hasProperty("teamcity")) "runOnTeamcity" else "test"
|
||||
setArgs(listOf("run", target))
|
||||
args.set(listOf("run", target))
|
||||
|
||||
setIgnoreExitValue(kotlinBuildProperties.ignoreTestFailures)
|
||||
ignoreExitValue.set(kotlinBuildProperties.ignoreTestFailures)
|
||||
|
||||
dependsOn(npmInstall, "test")
|
||||
|
||||
val check by tasks
|
||||
check.dependsOn(this)
|
||||
|
||||
doFirst {
|
||||
setEnvironment(
|
||||
mapOf(
|
||||
"KOTLIN_JS_LOCATION" to rootDir.resolve("dist/js/kotlin.js"),
|
||||
"KOTLIN_JS_TEST_LOCATION" to rootDir.resolve("dist/js/kotlin-test.js")
|
||||
)
|
||||
)
|
||||
}
|
||||
environment.set(mapOf(
|
||||
"KOTLIN_JS_LOCATION" to rootDir.resolve("dist/js/kotlin.js").toString(),
|
||||
"KOTLIN_JS_TEST_LOCATION" to rootDir.resolve("dist/js/kotlin-test.js").toString()
|
||||
))
|
||||
}
|
||||
|
||||
projectTest("wasmTest", true) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import com.moowork.gradle.node.npm.NpmTask
|
||||
import com.github.gradle.node.npm.task.NpmTask
|
||||
|
||||
plugins {
|
||||
id("com.github.node-gradle.node") version "2.2.0"
|
||||
id("com.github.node-gradle.node") version "3.0.1"
|
||||
base
|
||||
}
|
||||
|
||||
description = "Node utils"
|
||||
|
||||
node {
|
||||
download = true
|
||||
download.set(true)
|
||||
}
|
||||
|
||||
val deployDir = "$buildDir/deploy_to_npm"
|
||||
@@ -47,15 +47,15 @@ fun Project.createCopyLibraryFilesTask(libraryName: String, fromJar: String): Co
|
||||
fun Project.createPublishToNpmTask(templateName: String): NpmTask {
|
||||
return task<NpmTask>("publish-$templateName-to-npm") {
|
||||
val deployDir = File("$deployDir/$templateName")
|
||||
setWorkingDir(deployDir)
|
||||
workingDir.set(deployDir)
|
||||
|
||||
val deployArgs = listOf("publish", "--//registry.npmjs.org/:_authToken=$authToken", "--tag=$deployTag")
|
||||
if (dryRun == "true") {
|
||||
println("$deployDir \$ npm arguments: $deployArgs");
|
||||
setArgs(listOf("pack"))
|
||||
args.set(listOf("pack"))
|
||||
}
|
||||
else {
|
||||
setArgs(deployArgs)
|
||||
args.set(deployArgs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
|
||||
|
||||
plugins {
|
||||
// TODO: update gradle-node-plugin to support configuration cache
|
||||
id "com.github.node-gradle.node" version "2.2.0"
|
||||
}
|
||||
|
||||
@@ -26,13 +27,16 @@ dependencies {
|
||||
// package.json contains direct links to the builddir
|
||||
buildDir = "$projectDir/build"
|
||||
|
||||
[compileKotlin2Js, compileTestKotlin2Js]*.configure {
|
||||
kotlinOptions.moduleKind = "commonjs"
|
||||
["compileKotlin2Js", "compileTestKotlin2Js"].forEach {
|
||||
tasks.named(it).configure {
|
||||
kotlinOptions.moduleKind = "commonjs"
|
||||
}
|
||||
}
|
||||
|
||||
task populateNodeModules(type: Copy, dependsOn: compileKotlin2Js) {
|
||||
from compileKotlin2Js.destinationDir
|
||||
tasks.register("populateNodeModules", Copy) {
|
||||
dependsOn(compileKotlin2Js)
|
||||
dependsOn(configurations.nodeModules)
|
||||
from compileKotlin2Js.destinationDir
|
||||
|
||||
from {
|
||||
configurations.nodeModules.collect {
|
||||
@@ -53,7 +57,7 @@ node {
|
||||
}
|
||||
|
||||
def createFrameworkTest(def name) {
|
||||
return tasks.create("test$name", NpmTask) {
|
||||
return tasks.register("test$name", NpmTask) {
|
||||
dependsOn(compileTestKotlin2Js, populateNodeModules, npmInstall)
|
||||
def lowerName = name.toLowerCase()
|
||||
def tcOutput = "$buildDir/tc-${lowerName}.log"
|
||||
@@ -80,6 +84,8 @@ def createFrameworkTest(def name) {
|
||||
}
|
||||
}
|
||||
|
||||
['Jest', 'Jasmine', 'Mocha', 'Qunit', 'Tape'].each {
|
||||
check.dependsOn createFrameworkTest(it)
|
||||
tasks.check {
|
||||
['Jest', 'Jasmine', 'Mocha', 'Qunit', 'Tape'].each {
|
||||
dependsOn createFrameworkTest(it)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.github.node-gradle.node" version "2.2.0"
|
||||
id "com.github.node-gradle.node" version "3.0.1"
|
||||
}
|
||||
|
||||
description = 'Kotlin Standard Library for JS'
|
||||
@@ -325,7 +325,7 @@ artifacts {
|
||||
node {
|
||||
download = true
|
||||
version = '12.18.0'
|
||||
nodeModulesDir = buildDir
|
||||
nodeProjectDir = buildDir
|
||||
}
|
||||
|
||||
// Otherwise Node ignores nodeModulesDir
|
||||
@@ -352,8 +352,8 @@ task runMocha(type: NodeTask, dependsOn: [testClasses, installMocha, ':kotlin-te
|
||||
args = ['--reporter', 'min']
|
||||
}
|
||||
|
||||
args += ['--timeout', '10s']
|
||||
args += [jsTestOutputFile, kotlinTestJsTestOutputFile]
|
||||
args = args.get() + ['--timeout', '10s']
|
||||
args = args.get() + [jsTestOutputFile, kotlinTestJsTestOutputFile]
|
||||
|
||||
execOverrides {
|
||||
it.ignoreExitValue = rootProject.ignoreTestFailures
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import com.moowork.gradle.node.yarn.YarnTask
|
||||
import com.github.gradle.node.yarn.task.YarnTask
|
||||
|
||||
description = "Simple Kotlin/JS tests runner with TeamCity reporter"
|
||||
|
||||
plugins {
|
||||
id("base")
|
||||
id("com.github.node-gradle.node") version "2.2.0"
|
||||
id("com.github.node-gradle.node") version "3.0.1"
|
||||
}
|
||||
|
||||
publish()
|
||||
@@ -19,19 +19,20 @@ dependencies {
|
||||
}
|
||||
|
||||
node {
|
||||
version = "11.9.0"
|
||||
download = true
|
||||
nodeModulesDir = projectDir
|
||||
version.set("11.9.0")
|
||||
download.set(true)
|
||||
nodeProjectDir.set(projectDir)
|
||||
}
|
||||
|
||||
tasks {
|
||||
named("yarn") {
|
||||
val nodeModulesDir = projectDir.resolve("node_modules")
|
||||
outputs.upToDateWhen {
|
||||
projectDir.resolve("node_modules").isDirectory
|
||||
nodeModulesDir.isDirectory
|
||||
}
|
||||
// Without it several yarns can works incorrectly
|
||||
(this as YarnTask).apply {
|
||||
args = args + "--network-concurrency" + "1" + "--mutex" + "network"
|
||||
args.set(args.get() + "--network-concurrency" + "1" + "--mutex" + "network")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +40,8 @@ tasks {
|
||||
group = "build"
|
||||
|
||||
dependsOn("yarn")
|
||||
setWorkingDir(projectDir)
|
||||
args = listOf("build")
|
||||
workingDir.set(projectDir)
|
||||
args.set(listOf("build"))
|
||||
|
||||
inputs.dir("src")
|
||||
inputs.files(
|
||||
|
||||
Reference in New Issue
Block a user