Yarn manipulation in build script
- Remove yarn folder in task inside build script to not import GradleUserHomeLookup - Check yarn folder existence in task inside build script
This commit is contained in:
+6
-9
@@ -1,7 +1,6 @@
|
|||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
import org.gradle.api.logging.LogLevel
|
import org.gradle.api.logging.LogLevel
|
||||||
import org.gradle.wrapper.GradleUserHomeLookup
|
|
||||||
import org.jetbrains.kotlin.gradle.tasks.USING_JS_INCREMENTAL_COMPILATION_MESSAGE
|
import org.jetbrains.kotlin.gradle.tasks.USING_JS_INCREMENTAL_COMPILATION_MESSAGE
|
||||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||||
import org.jetbrains.kotlin.gradle.util.getFilesByNames
|
import org.jetbrains.kotlin.gradle.util.getFilesByNames
|
||||||
@@ -421,18 +420,16 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||||
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
|
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||||
|
|
||||||
GradleUserHomeLookup.gradleUserHome().resolve("yarn").deleteRecursively()
|
build("yarnFolderRemove") {
|
||||||
|
assertSuccessful()
|
||||||
|
}
|
||||||
|
|
||||||
build("kotlinYarnSetup") {
|
build("kotlinYarnSetup", "yarnFolderCheck") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
assertTasksExecuted(
|
assertTasksExecuted(
|
||||||
":kotlinYarnSetup"
|
":kotlinYarnSetup",
|
||||||
)
|
":yarnFolderCheck"
|
||||||
|
|
||||||
assertFileExists(
|
|
||||||
path = GradleUserHomeLookup.gradleUserHome().resolve("yarn").canonicalPath,
|
|
||||||
inWorkingDir = false
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
@@ -14,6 +14,24 @@ repositories {
|
|||||||
|
|
||||||
yarn
|
yarn
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
val yarnFolderRemove by registering {
|
||||||
|
doLast {
|
||||||
|
yarn.installationDir.deleteRecursively()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val yarnFolderCheck by registering {
|
||||||
|
dependsOn(getByName("kotlinYarnSetup"))
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
if (!yarn.installationDir.exists()) {
|
||||||
|
throw GradleException()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
kotlin.sourceSets {
|
kotlin.sourceSets {
|
||||||
getByName("main") {
|
getByName("main") {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
Reference in New Issue
Block a user