From e9246b38fabfff5068af52676de6eadfd7360ba2 Mon Sep 17 00:00:00 2001
From: Kai Reinhard <k.reinhard@micromata.de>
Date: Mon, 17 Feb 2025 06:52:18 +0000
Subject: [PATCH] build.gradle -> build.gradle.kts

---
 /dev/null                          |   28 ----------------------------
 borgbutler-webapp/build.gradle.kts |   29 +++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/borgbutler-webapp/build.gradle b/borgbutler-webapp/build.gradle
deleted file mode 100644
index 7dbe97f..0000000
--- a/borgbutler-webapp/build.gradle
+++ /dev/null
@@ -1,28 +0,0 @@
-description = 'borgbutler-webapp'
-
-task npmBuild(type: Exec) {
-    workingDir '.'
-    executable 'sh'
-    commandLine 'npm', 'run', 'build'
-}
-
-task packageWebApp(type: Zip) {
-    outputs.upToDateWhen { false } // It's never up-to-date (otherwise borgbutler-webapp.jar is missed).
-    dependsOn npmBuild
-    archiveBaseName.set('borgbutler-webapp')
-    archiveExtension.set('jar')
-    destinationDirectory.set(file("${projectDir}"))
-    from('build') {
-        // optional path under which output will be visible in Java classpath, e.g. static resources path
-        into 'webapp'
-    }
-    doLast {
-        //println "**** projectDir=${projectDir}, buildDir=${buildDir}"
-        mkdir "${buildDir}/libs"
-        def jarFile = archiveFileName.get()
-        ant.move file: "${projectDir}/${jarFile}",
-                toDir: "${buildDir}/libs"
-        println("*** packageWebApp finished.")
-    }
-}
-
diff --git a/borgbutler-webapp/build.gradle.kts b/borgbutler-webapp/build.gradle.kts
new file mode 100644
index 0000000..37cc7e0
--- /dev/null
+++ b/borgbutler-webapp/build.gradle.kts
@@ -0,0 +1,29 @@
+description = "borgbutler-webapp"
+
+tasks.register<Exec>("npmBuild") {
+    workingDir = projectDir
+    commandLine("sh", "-c", "npm run build")
+}
+
+tasks.register<Zip>("packageWebApp") {
+    outputs.upToDateWhen { false } // Immer ausführen, damit nichts fehlt
+    dependsOn("npmBuild")
+
+    archiveBaseName.set("borgbutler-webapp")
+    archiveExtension.set("jar")
+    destinationDirectory.set(projectDir)
+
+    from("build") {
+        into("webapp") // Statische Ressourcen in webapp-Verzeichnis
+    }
+
+    doLast {
+        val jarFile = archiveFile.get().asFile
+        val targetDir = buildDir.resolve("libs")
+
+        mkdir(targetDir)
+        ant.invokeMethod("move", mapOf("file" to jarFile.absolutePath, "todir" to targetDir.absolutePath))
+
+        println("*** packageWebApp finished.")
+    }
+}

--
Gitblit v1.10.0