-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathbuild.gradle.kts
35 lines (32 loc) · 1.49 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.nio.file.Files
import kotlin.io.path.Path
import org.siouan.frontendgradleplugin.infrastructure.gradle.InstallFrontendTask
plugins {
id("org.siouan.frontend-jdk21") version "10.0.0"
}
frontend {
nodeVersion.set("22.11.0")
assembleScript.set("run build")
checkScript.set("run check")
verboseModeEnabled.set(true)
}
tasks.named<InstallFrontendTask>("installFrontend") {
val ciPlatformPresent = providers.environmentVariable("CI").isPresent()
val lockFilePath = "${projectDir}/yarn.lock"
val retainedMetadataFileNames: Set<String>
if (ciPlatformPresent) {
retainedMetadataFileNames = setOf(lockFilePath)
} else {
// The naive configuration below allows to skip the task if the last successful execution did not change neither
// the package.json file, nor the lock file, nor the node_modules directory. Any other scenario where for
// example the lock file is regenerated will lead to another execution before the task is "up-to-date" because
// the lock file is both an input and an output of the task.
retainedMetadataFileNames = mutableSetOf("${projectDir}/package.json")
if (Files.exists(Path(lockFilePath))) {
retainedMetadataFileNames.add(lockFilePath)
}
outputs.file(lockFilePath).withPropertyName("lockFile")
}
inputs.files(retainedMetadataFileNames).withPropertyName("metadataFiles")
outputs.dir("${projectDir}/node_modules").withPropertyName("nodeModulesDirectory")
}