From 3575a91e7df8954ed59451cc28552e885871b13f Mon Sep 17 00:00:00 2001 From: Denghui Dong Date: Sat, 21 Oct 2023 16:18:43 +0800 Subject: [PATCH] build: build frontend only when needed --- server/server.gradle | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/server.gradle b/server/server.gradle index 42e7d3e3..f5100948 100644 --- a/server/server.gradle +++ b/server/server.gradle @@ -69,8 +69,17 @@ tasks.named('compileJava') { inputs.files(tasks.named('processResources')) } +import java.nio.file.Files + tasks.named("processResources") { - dependsOn(':frontend:build') + if (!Files.exists(projectDir.toPath().resolve("src/main/resources/static")) + || gradle.startParameter.taskNames.contains("clean")) { + dependsOn(':frontend:build') + } +} + +tasks.named("clean") { + delete(projectDir.toPath().resolve("src/main/resources/static")) } // for kryo