[Build] Migrate most of the build logic from Project.buildDir usage
It's going to be deprecated in Gradle 8.3 There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242 ^KTI-1473 In Progress
This commit is contained in:
committed by
Space Team
parent
b784544f8d
commit
a19bd2ed2e
@@ -1,11 +1,11 @@
|
||||
import com.github.gradle.node.npm.task.NpmTask
|
||||
import com.github.gradle.node.variant.computeNodeExec
|
||||
import org.apache.tools.ant.filters.FixCrLfFilter
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
|
||||
import org.jetbrains.kotlin.ideaExt.idea
|
||||
import org.apache.tools.ant.filters.FixCrLfFilter
|
||||
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute
|
||||
import java.util.Properties
|
||||
import org.jetbrains.kotlin.ideaExt.idea
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
@@ -14,13 +14,12 @@ plugins {
|
||||
id("com.github.node-gradle.node") version "5.0.0"
|
||||
}
|
||||
|
||||
val nodeDir = buildDir.resolve("node")
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
|
||||
node {
|
||||
download.set(true)
|
||||
version.set(nodejsVersion)
|
||||
nodeProjectDir.set(nodeDir)
|
||||
nodeProjectDir.set(layout.buildDirectory.dir("node"))
|
||||
if (cacheRedirectorEnabled) {
|
||||
distBaseUrl.set("https://cache-redirector.jetbrains.com/nodejs.org/dist")
|
||||
}
|
||||
@@ -361,7 +360,7 @@ fun Test.setUpBoxTests() {
|
||||
systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
|
||||
}
|
||||
|
||||
systemProperty("kotlin.js.test.root.out.dir", "$nodeDir/")
|
||||
systemProperty("kotlin.js.test.root.out.dir", "${node.nodeProjectDir.get().asFile}/")
|
||||
systemProperty(
|
||||
"overwrite.output", project.providers.gradleProperty("overwrite.output").orNull ?: "false"
|
||||
)
|
||||
@@ -378,8 +377,8 @@ val test = projectTest(jUnitMode = JUnitMode.JUnit5) {
|
||||
inputs.dir(rootDir.resolve("dist"))
|
||||
inputs.dir(rootDir.resolve("compiler/testData"))
|
||||
|
||||
outputs.dir("$buildDir/out")
|
||||
outputs.dir("$buildDir/out-min")
|
||||
outputs.dir(layout.buildDirectory.dir("out"))
|
||||
outputs.dir(layout.buildDirectory.dir("out-min"))
|
||||
|
||||
configureTestDistribution()
|
||||
}
|
||||
@@ -448,26 +447,25 @@ val packageJsonFile = testDataDir.resolve("package.json")
|
||||
|
||||
val prepareNpmTestData by task<Copy> {
|
||||
inputs.files(testJsFile, packageJsonFile)
|
||||
outputs.dir(nodeDir)
|
||||
|
||||
from(testJsFile)
|
||||
from(packageJsonFile)
|
||||
into(nodeDir)
|
||||
into(node.nodeProjectDir)
|
||||
}
|
||||
|
||||
val npmInstall by tasks.getting(NpmTask::class) {
|
||||
val packageLockFile = testDataDir.resolve("package-lock.json")
|
||||
|
||||
inputs.file(nodeDir.resolve("package.json"))
|
||||
inputs.file(node.nodeProjectDir.file("package.json"))
|
||||
outputs.file(packageLockFile)
|
||||
outputs.upToDateWhen { packageLockFile.exists() }
|
||||
|
||||
workingDir.set(nodeDir)
|
||||
workingDir.fileProvider(node.nodeProjectDir.asFile)
|
||||
dependsOn(prepareNpmTestData)
|
||||
}
|
||||
|
||||
val mochaTest by task<MochaTestTask> {
|
||||
workingDir.set(nodeDir)
|
||||
workingDir.fileProvider(node.nodeProjectDir.asFile)
|
||||
|
||||
val target = if (project.hasProperty("teamcity")) "runOnTeamcity" else "test"
|
||||
args.set(listOf("run", target))
|
||||
@@ -493,7 +491,7 @@ val runMocha by tasks.registering {
|
||||
projectTest("invalidationTest", jUnitMode = JUnitMode.JUnit5) {
|
||||
workingDir = rootDir
|
||||
|
||||
useJsIrBoxTests(version = version, buildDir = "$buildDir/")
|
||||
useJsIrBoxTests(version = version, buildDir = layout.buildDirectory)
|
||||
include("org/jetbrains/kotlin/incremental/*")
|
||||
dependsOn(":dist")
|
||||
forwardProperties()
|
||||
|
||||
Reference in New Issue
Block a user