From fbbf698aea401984b935efbb71396f2a2b36b740 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Sun, 17 Nov 2024 22:11:29 +0200 Subject: [PATCH] update flatpak --- flatpak/build.sh | 3 ++ flatpak/debug.sh | 3 -- flatpak/dev.nuculabs.ImageTagger.desktop | 2 +- flatpak/dev.nuculabs.ImageTagger.yaml | 35 +++++++++++++++--------- readme.md | 7 +++-- 5 files changed, 30 insertions(+), 20 deletions(-) create mode 100755 flatpak/build.sh delete mode 100755 flatpak/debug.sh diff --git a/flatpak/build.sh b/flatpak/build.sh new file mode 100755 index 0000000..59dc0c3 --- /dev/null +++ b/flatpak/build.sh @@ -0,0 +1,3 @@ +# Script to debug the Flatpak application. +flatpak-builder --user --install --force-clean build-dir dev.nuculabs.ImageTagger.yaml +flatpak run dev.nuculabs.ImageTagger \ No newline at end of file diff --git a/flatpak/debug.sh b/flatpak/debug.sh deleted file mode 100755 index cb60baa..0000000 --- a/flatpak/debug.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Script to debug the Flatpak application. -flatpak-builder --sandbox --user --install --force-clean build-dir dev.nuculabs.ImageTagger.yaml -flatpak run dev.nuculabs.ImageTagger \ No newline at end of file diff --git a/flatpak/dev.nuculabs.ImageTagger.desktop b/flatpak/dev.nuculabs.ImageTagger.desktop index ada3b99..2649701 100644 --- a/flatpak/dev.nuculabs.ImageTagger.desktop +++ b/flatpak/dev.nuculabs.ImageTagger.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Name=ImageTagger -Exec=/app/bin/image/bin/ImageTagger +Exec=/app/bin/ImageTagger/bin/ImageTagger Terminal=false Type=Application Icon=dev.nuculabs.ImageTagger diff --git a/flatpak/dev.nuculabs.ImageTagger.yaml b/flatpak/dev.nuculabs.ImageTagger.yaml index bcf1bd6..cd2f4d8 100644 --- a/flatpak/dev.nuculabs.ImageTagger.yaml +++ b/flatpak/dev.nuculabs.ImageTagger.yaml @@ -2,13 +2,15 @@ id: dev.nuculabs.ImageTagger runtime: org.freedesktop.Platform runtime-version: '23.08' sdk: org.freedesktop.Sdk -command: /app/bin/image/bin/ImageTagger +sdk-extensions: + - org.freedesktop.Sdk.Extension.openjdk17 +command: /app/bin/ImageTagger/bin/ImageTagger finish-args: # X11 + XShm access - --share=ipc - --socket=fallback-x11 # Wayland access - # - --socket=wayland + - --socket=wayland # GPU acceleration if needed - --device=dri # Needs to save files locally @@ -16,24 +18,31 @@ finish-args: modules: - name: ImageTagger buildsystem: simple + build-options: + env: + PATH: /app/bin:/usr/bin:/usr/lib/sdk/openjdk17/bin + JAVA_HOME: /usr/lib/sdk/openjdk17/jvm/openjdk-17 + build-args: + - --share=network build-commands: - - mkdir -p /app/bin/image/ - - cp -R bin /app/bin/image/ - - cp -R lib /app/bin/image/ - - cp -R conf /app/bin/image/ - - cp -R legal /app/bin/image/ - - cp -R release /app/bin/image/ + - cp prediction.onnx img-ai/src/main/resources/dev/nuculabs/imagetagger/ai/ + - cp prediction_categories.txt img-ai/src/main/resources/dev/nuculabs/imagetagger/ai/ + - gradle jpackageImage + - mkdir -p /app/bin/ + # Copy ImageTagger folder to /app/bin + - ls img-ui/build/jpackage + - cp -R img-ui/build/jpackage/ImageTagger /app/bin/ + - ls /app/bin/ # Desktop Integration - - chmod +x /app/bin/image/lib/jexec - - chmod +x /app/bin/image/lib/jspawnhelper - mkdir -p bin /app/share/{applications,icons/hicolor/512x512/apps,metainfo} - mv ${FLATPAK_ID}.desktop /app/share/applications/${FLATPAK_ID}.desktop - mv ${FLATPAK_ID}.png /app/share/icons/hicolor/512x512/apps/${FLATPAK_ID}.png sources: + - type: git + url: https://github.com/dnutiu/ImageTagger - type: archive - path: ../img-ui/build/distributions/ImageTagger-linux.zip - # url: "https://github.com/dnutiu/ImageTagger/releases/download/v1.3/ImageTagger-linux-1.3.zip" - # sha256: 0f086e6a738b3d59e3d05cce9174316d95886e50278c03e5b452a67fd264ea40 + url: https://github.com/dnutiu/ImageTagger/releases/download/v1/AIModels.zip + sha256: "bbe80bf135621897bc6186d8f17b889064717ed3b9951702b33be869e522321c" - type: file path: dev.nuculabs.ImageTagger.png - type: file diff --git a/readme.md b/readme.md index b119160..a7a132a 100644 --- a/readme.md +++ b/readme.md @@ -49,16 +49,17 @@ To run: gradlew run ``` -### Building the FlatPak +### Building the Flatpak To build the Flatpak run the following commands: ```shell -gradlew jlinkZip cd flatpak -flatpak-builder --sandbox --user --install --force-clean build-dir dev.nuculabs.ImageTagger.yaml +./build.sh ``` +It will build the flatpak using the latest sources from this repo. + ### Building a package (Fedora Example) To build a package run