Skip to content

Commit dd317da

Browse files
committed
snapcraft.yaml.template
1 parent ab8bc96 commit dd317da

10 files changed

+243
-10
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14+
- run: ./set-eclipse-package.sh
15+
env:
16+
ECLIPSE_PACKAGE: eclipse-java
1417
- uses: snapcore/action-build@v1

.github/workflows/publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
- arm64
1919
steps:
2020
- uses: actions/checkout@v4
21+
- run: ./set-eclipse-package.sh
22+
env:
23+
ECLIPSE_PACKAGE: eclipse-java
2124
- uses: docker/setup-qemu-action@v3
2225
- uses: diddlesnaps/snapcraft-multiarch-action@v1
2326
id: snapcraft

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1+
# snapcraft specifics
2+
parts
3+
stage
4+
prime
15
*.snap
6+
.snapcraft
7+
__pycache__
8+
*.pyc
9+
10+
# generated
11+
snap/snapcraft.yaml

eclipse-packages.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# all sources should have &r=1 amended
2+
latest: 2024-12R
3+
2024-12R:
4+
eclipse-java:
5+
amd64:
6+
source: https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2024-12/R/eclipse-java-2024-12-R-linux-gtk-x86_64.tar.gz&r=1
7+
checksum: "sha512/dae3fdace259f237afaadad98ac3c16bf571eb7e2704200e5159de9a6bde594c4112e983dd0eac3c35c0fd5325f1cf9d798e2fd511a5059fc02ceca71391927c"
8+
arm64:
9+
source: https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2024-12/R/eclipse-java-2024-12-R-linux-gtk-aarch64.tar.gz&r=1
10+
checksum: "sha512/03f0cd430c106995396acd4cb9a59037174bab75eee0089521b4872281b837c1ed5e6975d8e942ff96419ef4c87158fd4f0936f7dac2d6229197c4c79ef337f1"
11+
eclipse-pde:
12+
amd64:
13+
source: https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2024-12/R/eclipse-committers-2024-12-R-linux-gtk-x86_64.tar.gz&r=1
14+
checksum: "sha512/133dfeb699fe604c24d96ec521dfb201196505eaceaefd62f1d00e5d87953ee224839f113a1603c4c8dfec433155827c2d175a5ad838e6d32a7dd477a728c620"

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
yglu
2+
setuptools

set-eclipse-package.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
SOURCE=$(dirname -- ${BASH_SOURCE[0]})
3+
echo source-root: $SOURCE
4+
5+
export ECLIPSE_PACKAGE=${ECLIPSE_PACKAGE:='eclipse-java'}
6+
echo setting up for $ECLIPSE_PACKAGE
7+
export ECLIPSE_CONFINED=${ECLIPSE_CONFINED:=false}
8+
echo confinedment is enabled? $ECLIPSE_CONFINED
9+
10+
SNAPCRAFT_YAML=$SOURCE/snap/snapcraft.yaml
11+
if $ECLIPSE_CONFINED; then
12+
SNAPCRAFT_YAML_TEMPLATE=snapcraft.yaml.template_confined
13+
else
14+
SNAPCRAFT_YAML_TEMPLATE=snapcraft.yaml.template
15+
fi
16+
17+
YGLU_ENABLE_ENV=true pipx run --pip-args "-r requirements.txt" yglu snapcraft.yaml.template | tee $SNAPCRAFT_YAML
18+
19+
if [ $? -eq 0 ]; then
20+
echo written $SNAPCRAFT_YAML for $ECLIPSE_PACKAGE.
21+
else
22+
echo ERROR see above.
23+
return 1
24+
fi

snap/gui/eclipse.desktop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Version=1.0
33
Type=Application
44
Name=Eclipse
5-
Icon=${SNAP}/usr/lib/eclipse/icon.xpm
6-
Exec=eclipse %f
5+
Icon=${SNAP}/icon.xpm
6+
Exec=bin/eclipse-wrapper %f
77
Comment=Eclipse IDE
88
Categories=Development;IDE;
99
Terminal=false

snap/snapcraft.yaml renamed to snapcraft.yaml.template

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
name: eclipse
1+
ename: !- $env[ECLIPSE_PACKAGE]
2+
epackages: !- $import('eclipse-packages.yaml')
3+
4+
name: !? .ename
25
base: core22
36

4-
version: 2024-12
7+
version: !? .epackages.latest
8+
59
summary: Extensible Tool Platform and Java IDE
610
website: https://eclipse.org/ide
711
description:
@@ -13,20 +17,22 @@ description:
1317
grade: stable
1418
confinement: classic
1519

16-
architectures:
20+
architectures: # TODO use for loop here
1721
- build-on: amd64
1822
- build-on: arm64
1923

2024
apps:
21-
eclipse:
25+
!? .ename:
2226
command: bin/eclipse-wrapper
2327

2428
parts:
2529
eclipse:
2630
plugin: dump
27-
source:
28-
- on amd64: https://download.eclipse.org/technology/epp/downloads/release/${SNAPCRAFT_PROJECT_VERSION}/R/eclipse-java-${SNAPCRAFT_PROJECT_VERSION}-R-linux-gtk-x86_64.tar.gz
29-
- on arm64: https://download.eclipse.org/technology/epp/downloads/release/${SNAPCRAFT_PROJECT_VERSION}/R/eclipse-java-${SNAPCRAFT_PROJECT_VERSION}-R-linux-gtk-aarch64.tar.gz
31+
source-type: tar
32+
source: # TODO use for loop here
33+
- on amd64: !? .epackages[$_.version][$_.name].amd64.source
34+
- on arm64: !? .epackages[$_.version][$_.name].arm64.source
35+
# TODO use source-checksum once supported in multiarch setting
3036
organize:
3137
'configuration': 'usr/lib/eclipse/configuration'
3238
'dropins': 'usr/lib/eclipse/dropins'
@@ -67,9 +73,12 @@ parts:
6773
source: snap/local/wrappers
6874
organize:
6975
eclipse: bin/eclipse-wrapper
76+
eclipse_desktop:
77+
plugin: dump
78+
source: snap/gui
7079

7180
lint:
7281
ignore:
73-
- classic
82+
- classic # confinement paradoxon
7483
- library:
7584
- usr/lib/**/*.so*

snapcraft.yaml.template_confined

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
ename: !- $env[ECLIPSE_PACKAGE]
2+
name: !? .ename
3+
base: core24
4+
5+
epackages: !- $import('eclipse-packages.yaml')
6+
version: !? .epackages.latest
7+
8+
summary: Extensible Tool Platform and Java IDE
9+
description:
10+
Eclipse provides IDEs and platforms for nearly every language and architecture.
11+
We are famous for our Java IDE, C/C++, JavaScript and PHP IDEs built on extensible
12+
platforms for creating desktop, Web and cloud IDEs. These platforms deliver the most
13+
extensive collection of add-on tools available for software developers.
14+
15+
grade: stable
16+
confinement: strict
17+
18+
compression: lzo
19+
20+
platforms:
21+
amd64:
22+
build-on: amd64
23+
24+
apps:
25+
!? .ename:
26+
command: bin/eclipse-wrapper
27+
extensions: [gnome]
28+
desktop: eclipse.desktop
29+
environment:
30+
## https://docs.gtk.org/glib/running.html#environment-variables
31+
G_MESSAGES_DEBUG: all
32+
## https://docs.mesa3d.org/envvars.html
33+
LIBGL_DEBUG: 1
34+
DRI_PRIME_DEBUG: 1
35+
MESA_DEBUG: 1
36+
MESA_VK_DEVICE_SELECT_DEBUG: 1
37+
# AMD_DEBUG: all
38+
## https://trac.webkit.org/wiki/EnvironmentVariables
39+
WEBKIT_DEBUG: all
40+
plugs:
41+
- personal-sourcedir
42+
- personal-workspace
43+
- personal-gitconfig
44+
- personal-sshid
45+
- personal-maven-cache
46+
- network
47+
48+
plugs:
49+
personal-sourcedir:
50+
interface: personal-files
51+
write:
52+
- $HOME/projs
53+
personal-workspace:
54+
interface: personal-files
55+
write:
56+
- $HOME/eclipse-workspace
57+
personal-gitconfig:
58+
interface: personal-files
59+
write:
60+
- $HOME/.gitconfig
61+
personal-sshid:
62+
interface: ssh-keys
63+
personal-maven-cache:
64+
interface: personal-files
65+
write:
66+
- $HOME/.m2
67+
68+
parts:
69+
eclipse:
70+
plugin: dump
71+
source-type: tar
72+
source: # TODO use for loop here
73+
- on amd64: !? .epackages[$_.version][$_.name].amd64.source
74+
- on arm64: !? .epackages[$_.version][$_.name].arm64.source
75+
# TODO use source-checksum once supported in multiarch setting
76+
organize:
77+
'configuration': 'usr/lib/eclipse/configuration'
78+
'dropins': 'usr/lib/eclipse/dropins'
79+
'features': 'usr/lib/eclipse/features'
80+
'p2': 'usr/lib/eclipse/p2'
81+
'plugins': 'usr/lib/eclipse/plugins'
82+
'readme': 'usr/lib/eclipse/readme'
83+
'.eclipseproduct': 'usr/lib/eclipse/.eclipseproduct'
84+
'artifacts.xml': 'usr/lib/eclipse/artifacts.xml'
85+
'eclipse': 'usr/lib/eclipse/eclipse'
86+
'eclipse.ini': 'usr/lib/eclipse/eclipse.ini'
87+
'icon.xpm': 'usr/lib/eclipse/icon.xpm'
88+
build-attributes:
89+
- no-patchelf
90+
stage-packages:
91+
- libffi7
92+
- libfreetype6
93+
- libpng16-16
94+
- libgdk-pixbuf2.0-0
95+
- libsecret-1-0
96+
- libasound2
97+
- libxi6
98+
- libxrender1
99+
- libxtst6
100+
override-prime: |
101+
craftctl default
102+
find $SNAPCRAFT_PRIME/usr/lib/eclipse/ -type d -exec chmod 755 {} \;
103+
find $SNAPCRAFT_PRIME/usr/lib/eclipse/ -type f -exec chmod 644 {} \;
104+
find $SNAPCRAFT_PRIME/usr/lib/eclipse/ -type f -exec chmod +x {} \;
105+
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/aix*/
106+
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/darwin*/
107+
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/freebsd*/
108+
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/openbsd*/
109+
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/sunos*/
110+
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/win32*/
111+
after:
112+
- eclipse_deps
113+
wrappers:
114+
plugin: dump
115+
source: snap/local/wrappers
116+
organize:
117+
eclipse: bin/eclipse-wrapper
118+
eclipse_desktop:
119+
plugin: dump
120+
source: snap/gui
121+
eclipse_deps:
122+
plugin: nil
123+
stage-snaps:
124+
- git-confined
125+
126+
layout:
127+
/usr/local/bin:
128+
bind: $SNAP/usr/bin
129+
/usr/libexec/git-core:
130+
symlink: $SNAP/usr/libexec/git-core
131+
/usr/share/git-core:
132+
symlink: $SNAP/usr/share/git-core
133+
134+
lint:
135+
ignore:
136+
- library:
137+
- usr/lib/**/*.so*

try-build.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ -n $1 ]; then
5+
ECLIPSE_PACKAGE=$1
6+
fi
7+
8+
export ECLIPSE_PACKAGE=${ECLIPSE_PACKAGE:='eclipse-java'}
9+
export ECLIPSE_CONFINED=${ECLIPSE_CONFINED:=false}
10+
11+
. ./set-eclipse-package.sh
12+
13+
CLEAN=${CLEAN:=false}
14+
15+
if $CLEAN; then
16+
sudo snap remove --purge $ECLIPSE_PACKAGE
17+
snapcraft clean
18+
fi
19+
20+
# sudo less /var/snap/lxd/common/lxd/logs/lxd.log
21+
snapcraft pack --debug
22+
23+
AUTORUN=${AUTORUN:=false}
24+
if $AUTORUN; then
25+
if $ECLIPSE_CONFINED; then
26+
sudo snap install ./$(echo $ECLIPSE_PACKAGE)_*_$(dpkg --print-architecture).snap --dangerous
27+
else
28+
sudo snap install ./$(echo $ECLIPSE_PACKAGE)_*_$(dpkg --print-architecture).snap --dangerous --classic
29+
fi
30+
snap run $ECLIPSE_PACKAGE &
31+
fi

0 commit comments

Comments
 (0)