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