Skip to content

Commit 382c7d2

Browse files
author
alferio
committed
fix(tools): arrays and array hotspots
- core/src/main/kotlin/com/github/alfu32/sketch/ui/SketchUiOverlay.kt:5987 - PLANAR_TRANSLATE_MULTIPLE now maps to multiple-copy-translate-planar - VOLUMETRIC_TRANSLATE_MULTIPLE now maps to multiple-copy-translate-volumetric fix(snapcraft): release - Moved the Snapcraft project file to the repo root: - snapcraft.yaml - Removed the old nested config: - snap/snapcraft.yaml - Kept the GUI assets under: - snap/gui/octodraw.desktop - snap/gui/icon.png Gradle change - lwjgl3/build.gradle - bundleLinuxSnap now copies: - root snapcraft.yaml into the Snapcraft project root - snap/ into the staged snap/ directory - local Snap build still uses Snapcraft, not mksquashfs CI change - .github/workflows/release.yml - Linux CI no longer installs Snapcraft - Linux CI no longer runs :lwjgl3:bundleLinuxSnap - Linux CI no longer uploads *.snap
1 parent 38f401a commit 382c7d2

15 files changed

Lines changed: 232 additions & 105 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,13 @@ jobs:
2727
with:
2828
distribution: "temurin"
2929
java-version: "21"
30-
- name: Install Snap packaging tools
31-
run: |
32-
sudo apt-get update
33-
sudo apt-get install -y squashfs-tools
34-
- name: Build Linux bundle + Snap + JVM jars
35-
run: ./gradlew :lwjgl3:bundleLinuxTar :lwjgl3:bundleLinuxSnap :lwjgl3:jarLinux :core:pluginApiJar -PreleaseNumber="${{ inputs.tag }}"
30+
- name: Build Linux bundle + JVM jars
31+
run: ./gradlew :lwjgl3:bundleLinuxTar :lwjgl3:jarLinux :core:pluginApiJar -PreleaseNumber="${{ inputs.tag }}"
3632
- uses: actions/upload-artifact@v4
3733
with:
3834
name: octodraw-linux
3935
path: |
4036
dist/*.tar.gz
41-
dist/*.snap
4237
lwjgl3/build/libs/*.jar
4338
core/build/libs/octodraw-plugin*.jar
4439

core/src/main/kotlin/com/github/alfu32/sketch/ui/SketchUiOverlay.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5984,8 +5984,8 @@ class SketchUiOverlay(
59845984
ToolId.STRETCH -> "stretch"
59855985
ToolId.ROTATE_STRETCH -> "stretch-rotate"
59865986
ToolId.COPY_MULTIPLE -> "multiple-copy-translate"
5987-
ToolId.PLANAR_TRANSLATE_MULTIPLE -> "multiple-copy-planar-translate"
5988-
ToolId.VOLUMETRIC_TRANSLATE_MULTIPLE -> "multiple-copy-volumetric-translate"
5987+
ToolId.PLANAR_TRANSLATE_MULTIPLE -> "multiple-copy-translate-planar"
5988+
ToolId.VOLUMETRIC_TRANSLATE_MULTIPLE -> "multiple-copy-translate-volumetric"
59895989
ToolId.PLANAR_ROTATE_MULTIPLE -> "multiple-copy-planar-rotate"
59905990
ToolId.HELICOIDAL_ROTATE_MULTIPLE -> "multiple-copy-helicoidal-rotate"
59915991
ToolId.PAINT -> "paint"

lwjgl3/build.gradle

Lines changed: 92 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,19 @@ set -eu
467467
HOST_RUNTIME_DIR="/run/user/$(id -u)"
468468
CURRENT_RUNTIME_DIR="${XDG_RUNTIME_DIR:-}"
469469
SNAP_LIB_DIR="$SNAP/lib"
470+
SNAP_USR_LIB_DIR="$SNAP/usr/lib/x86_64-linux-gnu"
471+
SNAP_DRI_DIR="$SNAP_USR_LIB_DIR/dri"
472+
SNAP_EGL_VENDOR_DIR="$SNAP/usr/share/glvnd/egl_vendor.d"
473+
SNAP_ALSA_CONF="$SNAP/usr/share/alsa/alsa.conf"
470474
471475
if [ -d "$SNAP_LIB_DIR" ]; then
472476
export LD_LIBRARY_PATH="$SNAP_LIB_DIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
473477
fi
474478
479+
if [ -d "$SNAP_USR_LIB_DIR" ]; then
480+
export LD_LIBRARY_PATH="$SNAP_USR_LIB_DIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
481+
fi
482+
475483
if [ -z "$CURRENT_RUNTIME_DIR" ] || [ ! -d "$CURRENT_RUNTIME_DIR" ]; then
476484
export XDG_RUNTIME_DIR="$HOST_RUNTIME_DIR"
477485
fi
@@ -488,6 +496,18 @@ if [ -z "${XAUTHORITY:-}" ] && [ -f "$HOME/.Xauthority" ]; then
488496
export XAUTHORITY="$HOME/.Xauthority"
489497
fi
490498
499+
if [ -d "$SNAP_DRI_DIR" ]; then
500+
export LIBGL_DRIVERS_PATH="$SNAP_DRI_DIR"
501+
fi
502+
503+
if [ -d "$SNAP_EGL_VENDOR_DIR" ]; then
504+
export __EGL_VENDOR_LIBRARY_DIRS="$SNAP_EGL_VENDOR_DIR"
505+
fi
506+
507+
if [ -f "$SNAP_ALSA_CONF" ]; then
508+
export ALSA_CONFIG_PATH="$SNAP_ALSA_CONF"
509+
fi
510+
491511
exec "$SNAP/octodraw-jre" "$@"
492512
'''
493513
launchFile.setExecutable(true, false)
@@ -496,7 +516,11 @@ exec "$SNAP/octodraw-jre" "$@"
496516

497517
def copySnapDesktopRuntimeLibs = { File snapRoot ->
498518
def libDir = new File(snapRoot, "lib")
519+
def usrLibDir = new File(snapRoot, "usr/lib/x86_64-linux-gnu")
520+
def usrShareDir = new File(snapRoot, "usr/share")
499521
libDir.mkdirs()
522+
usrLibDir.mkdirs()
523+
usrShareDir.mkdirs()
500524
def searchRoots = [
501525
file("/usr/lib/x86_64-linux-gnu"),
502526
file("/lib/x86_64-linux-gnu"),
@@ -522,14 +546,42 @@ def copySnapDesktopRuntimeLibs = { File snapRoot ->
522546
"libGL.so.1",
523547
"libGLX.so.0",
524548
"libEGL.so.1",
549+
"libGLX_mesa.so.0",
550+
"libEGL_mesa.so.0",
551+
"libGLdispatch.so.0",
552+
"libOpenGL.so.0",
553+
"libGLESv2.so.2",
525554
"libdrm.so.2",
555+
"libdrm_amdgpu.so.1",
556+
"libdrm_intel.so.1",
557+
"libdrm_nouveau.so.2",
558+
"libdrm_radeon.so.1",
526559
"libgbm.so.1",
527560
"libasound.so.2",
528561
]
529562
requiredLibs.each { libName ->
530563
def source = searchRoots.collect { new File(it, libName) }.find { it.exists() }
531564
if (source != null) {
532565
ant.copy(file: source, tofile: new File(libDir, libName), overwrite: true)
566+
ant.copy(file: source, tofile: new File(usrLibDir, libName), overwrite: true)
567+
}
568+
}
569+
def driSourceDir = file("/usr/lib/x86_64-linux-gnu/dri")
570+
if (driSourceDir.exists()) {
571+
ant.copy(todir: new File(usrLibDir, "dri"), overwrite: true) {
572+
fileset(dir: driSourceDir)
573+
}
574+
}
575+
def glvndSourceDir = file("/usr/share/glvnd/egl_vendor.d")
576+
if (glvndSourceDir.exists()) {
577+
ant.copy(todir: new File(usrShareDir, "glvnd/egl_vendor.d"), overwrite: true) {
578+
fileset(dir: glvndSourceDir)
579+
}
580+
}
581+
def alsaSourceDir = file("/usr/share/alsa")
582+
if (alsaSourceDir.exists()) {
583+
ant.copy(todir: new File(usrShareDir, "alsa"), overwrite: true) {
584+
fileset(dir: alsaSourceDir)
533585
}
534586
}
535587
}
@@ -747,7 +799,7 @@ tasks.register("bundleLinuxSnap") {
747799
}
748800
def probe = null
749801
try {
750-
probe = new ProcessBuilder("mksquashfs", "-version")
802+
probe = new ProcessBuilder("snapcraft", "--version")
751803
.directory(project.projectDir)
752804
.redirectErrorStream(true)
753805
.start()
@@ -756,39 +808,56 @@ tasks.register("bundleLinuxSnap") {
756808
probe = null
757809
}
758810
if (probe == null || probe.waitFor() != 0) {
759-
throw new GradleException("mksquashfs not found. Install squashfs-tools to build the Snap package.")
811+
throw new GradleException("snapcraft not found. Install Snapcraft to build the Snap package.")
760812
}
761813
def sourceDir = rootProject.file("dist/octodraw-dist-${bundleVersion}-linux")
762814
if (!sourceDir.exists()) {
763815
throw new GradleException("Linux bundle directory not found: ${sourceDir}")
764816
}
765-
def snapRoot = file("$buildDir/snap/octodraw")
766-
project.delete(snapRoot)
817+
def snapcraftProjectDir = file("$buildDir/snapcraft/project")
818+
def snapcraftSourceDir = new File(snapcraftProjectDir, "source")
819+
def snapDir = new File(snapcraftProjectDir, "snap")
820+
project.delete(snapcraftProjectDir)
767821
project.copy {
768822
from(sourceDir)
769-
into(snapRoot)
823+
into(snapcraftSourceDir)
824+
}
825+
project.copy {
826+
from(rootProject.file("snapcraft.yaml"))
827+
into(snapcraftProjectDir)
828+
}
829+
project.copy {
830+
from(rootProject.file("snap"))
831+
into(snapDir)
770832
}
771-
ensureUnixRuntimeExecutables(snapRoot)
772-
copySnapDesktopRuntimeLibs(snapRoot)
773-
createSnapMetadata(snapRoot)
833+
ensureUnixRuntimeExecutables(snapcraftSourceDir)
774834
def outFile = rootProject.file("dist/octodraw-dist-${bundleVersion}-linux.snap")
835+
def defaultSnapName = "octodraw_${bundleVersion}_amd64.snap"
836+
def builtSnap = new File(snapcraftProjectDir, defaultSnapName)
775837
project.delete(outFile)
776-
def pack = new ProcessBuilder(
777-
"mksquashfs",
778-
snapRoot.absolutePath,
779-
outFile.absolutePath,
780-
"-noappend",
781-
"-no-fragments",
782-
"-comp",
783-
"xz",
784-
"-all-root",
785-
"-no-xattrs"
786-
)
787-
.directory(project.projectDir)
838+
project.delete(builtSnap)
839+
def pack = new ProcessBuilder("snapcraft", "--destructive-mode")
840+
.directory(snapcraftProjectDir)
788841
.inheritIO()
789-
.start()
790-
if (pack.waitFor() != 0) {
791-
throw new GradleException("mksquashfs failed while building ${outFile.name}.")
842+
pack.environment().put("OCTODRAW_SNAP_VERSION", bundleVersion)
843+
def process = pack.start()
844+
if (process.waitFor() != 0) {
845+
throw new GradleException("snapcraft failed while building ${outFile.name}.")
846+
}
847+
if (!builtSnap.exists()) {
848+
def candidates = snapcraftProjectDir.listFiles()?.findAll { it.name.endsWith(".snap") } ?: []
849+
if (candidates.isEmpty()) {
850+
throw new GradleException("snapcraft completed without producing a .snap artifact.")
851+
}
852+
builtSnap = candidates.max { it.lastModified() }
853+
}
854+
if (!builtSnap.exists()) {
855+
throw new GradleException("Snap artifact not found after snapcraft build.")
856+
}
857+
project.copy {
858+
from(builtSnap)
859+
into(outFile.parentFile)
860+
rename { outFile.name }
792861
}
793862
}
794863
}

snap/gui/icon.png

22.9 KB
Loading

snap/gui/octodraw.desktop

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Desktop Entry]
2+
Name=Octodraw
3+
Comment=3D drafting and modeling tool
4+
Exec=octodraw %U
5+
Icon=${SNAP}/meta/gui/icon.png
6+
Terminal=false
7+
Type=Application
8+
Categories=Graphics;3DGraphics;Engineering;
9+
MimeType=application/octet-stream;
10+
StartupWMClass=Octodraw

snapcraft.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: octodraw
2+
title: Octodraw
3+
summary: 3D drafting and modeling tool
4+
description: |
5+
Octodraw is a 3D drafting and modeling application.
6+
base: core22
7+
grade: stable
8+
confinement: strict
9+
adopt-info: octodraw
10+
11+
architectures:
12+
- build-on:
13+
- amd64
14+
build-for:
15+
- amd64
16+
17+
apps:
18+
octodraw:
19+
command: octodraw-jre
20+
extensions:
21+
- gnome
22+
environment:
23+
OCTODRAW_PLUGINS_DIR: $SNAP_USER_COMMON/plugins
24+
ALSA_CONFIG_PATH: $SNAP/usr/share/alsa/alsa.conf
25+
plugs:
26+
- audio-playback
27+
- home
28+
- network
29+
- network-bind
30+
- removable-media
31+
32+
parts:
33+
octodraw:
34+
plugin: dump
35+
source: source
36+
stage-packages:
37+
- libasound2
38+
- libasound2-data
39+
override-pull: |
40+
craftctl default
41+
craftctl set version "${OCTODRAW_SNAP_VERSION:-0.0.0}"
42+
override-build: |
43+
craftctl default
44+
chmod 755 "$CRAFT_PART_INSTALL/octodraw-editor" "$CRAFT_PART_INSTALL/octodraw-jre"
45+
if [ -d "$CRAFT_PART_INSTALL/jre/bin" ]; then
46+
find "$CRAFT_PART_INSTALL/jre/bin" -type f -exec chmod 755 {} \;
47+
fi
48+
if [ -f "$CRAFT_PART_INSTALL/jre/lib/jspawnhelper" ]; then
49+
chmod 755 "$CRAFT_PART_INSTALL/jre/lib/jspawnhelper"
50+
fi
51+
if [ -f "$CRAFT_PART_INSTALL/jre/lib/jexec" ]; then
52+
chmod 755 "$CRAFT_PART_INSTALL/jre/lib/jexec"
53+
fi
-62.6 KB
Loading
-84.3 KB
Loading
-37.5 KB
Loading

0 commit comments

Comments
 (0)