Gradle: Make Yarn and Snowpack builds incremental.
Change-Id: I547d2580faf4c768045361ce73b7a079a1e0d3f5
diff --git a/build.gradle b/build.gradle
index 3986100..7302b0d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,3 +1,6 @@
+import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
+import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
+
plugins {
id 'java'
id 'io.quarkus'
@@ -94,14 +97,27 @@
version "${projectVersion}"
task yarnInstall(type:Exec) {
- workingDir "src/main/resources/META-INF/resources"
+ def resourceDir = "src/main/resources/META-INF/resources"
+
+ inputs.file "${resourceDir}/package.json"
+ outputs.dir "${resourceDir}/node_modules"
+ outputs.file "${resourceDir}/yarn.lock"
+
+ workingDir resourceDir
commandLine "yarn", "install"
}
task snowpack(type:Exec) {
+ def resourceDir = "src/main/resources/META-INF/resources"
+
dependsOn yarnInstall
- workingDir "src/main/resources/META-INF/resources"
+ inputs.dir "${resourceDir}/node_modules"
+ inputs.file "${resourceDir}/yarn.lock"
+ inputs.file "${resourceDir}/package.json"
+ outputs.dir "${resourceDir}/web_modules"
+
+ workingDir resourceDir
commandLine "yarn", "run", "snowpack"
}
@@ -119,7 +135,7 @@
quarkusBuild.dependsOn compileWeb
-task buildDocker(type: com.bmuschko.gradle.docker.tasks.image.DockerBuildImage) {
+task buildDocker(type: DockerBuildImage) {
inputDir = file(".")
dockerFile = file("src/main/docker/Dockerfile.jvm")
images.add("docker.benkard.de/mulk/mulkcms2:${projectVersion}")
@@ -128,7 +144,7 @@
buildDocker.dependsOn quarkusBuild
assemble.dependsOn buildDocker
-task pushDocker(type: com.bmuschko.gradle.docker.tasks.image.DockerPushImage) {
+task pushDocker(type: DockerPushImage) {
images.add("docker.benkard.de/mulk/mulkcms2:${projectVersion}")
}