Skip to content

Commit

Permalink
snapcraft.yaml.template
Browse files Browse the repository at this point in the history
  • Loading branch information
janesser committed Jan 5, 2025
1 parent ab8bc96 commit dd317da
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./set-eclipse-package.sh
env:
ECLIPSE_PACKAGE: eclipse-java
- uses: snapcore/action-build@v1
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
- arm64
steps:
- uses: actions/checkout@v4
- run: ./set-eclipse-package.sh
env:
ECLIPSE_PACKAGE: eclipse-java
- uses: docker/setup-qemu-action@v3
- uses: diddlesnaps/snapcraft-multiarch-action@v1
id: snapcraft
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# snapcraft specifics
parts
stage
prime
*.snap
.snapcraft
__pycache__
*.pyc

# generated
snap/snapcraft.yaml
14 changes: 14 additions & 0 deletions eclipse-packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# all sources should have &r=1 amended
latest: 2024-12R
2024-12R:
eclipse-java:
amd64:
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
checksum: "sha512/dae3fdace259f237afaadad98ac3c16bf571eb7e2704200e5159de9a6bde594c4112e983dd0eac3c35c0fd5325f1cf9d798e2fd511a5059fc02ceca71391927c"
arm64:
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
checksum: "sha512/03f0cd430c106995396acd4cb9a59037174bab75eee0089521b4872281b837c1ed5e6975d8e942ff96419ef4c87158fd4f0936f7dac2d6229197c4c79ef337f1"
eclipse-pde:
amd64:
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
checksum: "sha512/133dfeb699fe604c24d96ec521dfb201196505eaceaefd62f1d00e5d87953ee224839f113a1603c4c8dfec433155827c2d175a5ad838e6d32a7dd477a728c620"
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yglu
setuptools
24 changes: 24 additions & 0 deletions set-eclipse-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
SOURCE=$(dirname -- ${BASH_SOURCE[0]})
echo source-root: $SOURCE

export ECLIPSE_PACKAGE=${ECLIPSE_PACKAGE:='eclipse-java'}
echo setting up for $ECLIPSE_PACKAGE
export ECLIPSE_CONFINED=${ECLIPSE_CONFINED:=false}
echo confinedment is enabled? $ECLIPSE_CONFINED

SNAPCRAFT_YAML=$SOURCE/snap/snapcraft.yaml
if $ECLIPSE_CONFINED; then
SNAPCRAFT_YAML_TEMPLATE=snapcraft.yaml.template_confined
else
SNAPCRAFT_YAML_TEMPLATE=snapcraft.yaml.template
fi

YGLU_ENABLE_ENV=true pipx run --pip-args "-r requirements.txt" yglu snapcraft.yaml.template | tee $SNAPCRAFT_YAML

if [ $? -eq 0 ]; then
echo written $SNAPCRAFT_YAML for $ECLIPSE_PACKAGE.
else
echo ERROR see above.
return 1
fi
4 changes: 2 additions & 2 deletions snap/gui/eclipse.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Version=1.0
Type=Application
Name=Eclipse
Icon=${SNAP}/usr/lib/eclipse/icon.xpm
Exec=eclipse %f
Icon=${SNAP}/icon.xpm
Exec=bin/eclipse-wrapper %f
Comment=Eclipse IDE
Categories=Development;IDE;
Terminal=false
Expand Down
25 changes: 17 additions & 8 deletions snap/snapcraft.yaml → snapcraft.yaml.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: eclipse
ename: !- $env[ECLIPSE_PACKAGE]
epackages: !- $import('eclipse-packages.yaml')

name: !? .ename
base: core22

version: 2024-12
version: !? .epackages.latest

summary: Extensible Tool Platform and Java IDE
website: https://eclipse.org/ide
description:
Expand All @@ -13,20 +17,22 @@ description:
grade: stable
confinement: classic

architectures:
architectures: # TODO use for loop here
- build-on: amd64
- build-on: arm64

apps:
eclipse:
!? .ename:
command: bin/eclipse-wrapper

parts:
eclipse:
plugin: dump
source:
- 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
- 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
source-type: tar
source: # TODO use for loop here
- on amd64: !? .epackages[$_.version][$_.name].amd64.source
- on arm64: !? .epackages[$_.version][$_.name].arm64.source
# TODO use source-checksum once supported in multiarch setting
organize:
'configuration': 'usr/lib/eclipse/configuration'
'dropins': 'usr/lib/eclipse/dropins'
Expand Down Expand Up @@ -67,9 +73,12 @@ parts:
source: snap/local/wrappers
organize:
eclipse: bin/eclipse-wrapper
eclipse_desktop:
plugin: dump
source: snap/gui

lint:
ignore:
- classic
- classic # confinement paradoxon
- library:
- usr/lib/**/*.so*
137 changes: 137 additions & 0 deletions snapcraft.yaml.template_confined
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
ename: !- $env[ECLIPSE_PACKAGE]
name: !? .ename
base: core24

epackages: !- $import('eclipse-packages.yaml')
version: !? .epackages.latest

summary: Extensible Tool Platform and Java IDE
description:
Eclipse provides IDEs and platforms for nearly every language and architecture.
We are famous for our Java IDE, C/C++, JavaScript and PHP IDEs built on extensible
platforms for creating desktop, Web and cloud IDEs. These platforms deliver the most
extensive collection of add-on tools available for software developers.

grade: stable
confinement: strict

compression: lzo

platforms:
amd64:
build-on: amd64

apps:
!? .ename:
command: bin/eclipse-wrapper
extensions: [gnome]
desktop: eclipse.desktop
environment:
## https://docs.gtk.org/glib/running.html#environment-variables
G_MESSAGES_DEBUG: all
## https://docs.mesa3d.org/envvars.html
LIBGL_DEBUG: 1
DRI_PRIME_DEBUG: 1
MESA_DEBUG: 1
MESA_VK_DEVICE_SELECT_DEBUG: 1
# AMD_DEBUG: all
## https://trac.webkit.org/wiki/EnvironmentVariables
WEBKIT_DEBUG: all
plugs:
- personal-sourcedir
- personal-workspace
- personal-gitconfig
- personal-sshid
- personal-maven-cache
- network

plugs:
personal-sourcedir:
interface: personal-files
write:
- $HOME/projs
personal-workspace:
interface: personal-files
write:
- $HOME/eclipse-workspace
personal-gitconfig:
interface: personal-files
write:
- $HOME/.gitconfig
personal-sshid:
interface: ssh-keys
personal-maven-cache:
interface: personal-files
write:
- $HOME/.m2

parts:
eclipse:
plugin: dump
source-type: tar
source: # TODO use for loop here
- on amd64: !? .epackages[$_.version][$_.name].amd64.source
- on arm64: !? .epackages[$_.version][$_.name].arm64.source
# TODO use source-checksum once supported in multiarch setting
organize:
'configuration': 'usr/lib/eclipse/configuration'
'dropins': 'usr/lib/eclipse/dropins'
'features': 'usr/lib/eclipse/features'
'p2': 'usr/lib/eclipse/p2'
'plugins': 'usr/lib/eclipse/plugins'
'readme': 'usr/lib/eclipse/readme'
'.eclipseproduct': 'usr/lib/eclipse/.eclipseproduct'
'artifacts.xml': 'usr/lib/eclipse/artifacts.xml'
'eclipse': 'usr/lib/eclipse/eclipse'
'eclipse.ini': 'usr/lib/eclipse/eclipse.ini'
'icon.xpm': 'usr/lib/eclipse/icon.xpm'
build-attributes:
- no-patchelf
stage-packages:
- libffi7
- libfreetype6
- libpng16-16
- libgdk-pixbuf2.0-0
- libsecret-1-0
- libasound2
- libxi6
- libxrender1
- libxtst6
override-prime: |
craftctl default
find $SNAPCRAFT_PRIME/usr/lib/eclipse/ -type d -exec chmod 755 {} \;
find $SNAPCRAFT_PRIME/usr/lib/eclipse/ -type f -exec chmod 644 {} \;
find $SNAPCRAFT_PRIME/usr/lib/eclipse/ -type f -exec chmod +x {} \;
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/aix*/
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/darwin*/
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/freebsd*/
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/openbsd*/
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/sunos*/
rm -r $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/com.sun.jna_*v*/com/sun/jna/win32*/
after:
- eclipse_deps
wrappers:
plugin: dump
source: snap/local/wrappers
organize:
eclipse: bin/eclipse-wrapper
eclipse_desktop:
plugin: dump
source: snap/gui
eclipse_deps:
plugin: nil
stage-snaps:
- git-confined

layout:
/usr/local/bin:
bind: $SNAP/usr/bin
/usr/libexec/git-core:
symlink: $SNAP/usr/libexec/git-core
/usr/share/git-core:
symlink: $SNAP/usr/share/git-core

lint:
ignore:
- library:
- usr/lib/**/*.so*
31 changes: 31 additions & 0 deletions try-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -e

if [ -n $1 ]; then
ECLIPSE_PACKAGE=$1
fi

export ECLIPSE_PACKAGE=${ECLIPSE_PACKAGE:='eclipse-java'}
export ECLIPSE_CONFINED=${ECLIPSE_CONFINED:=false}

. ./set-eclipse-package.sh

CLEAN=${CLEAN:=false}

if $CLEAN; then
sudo snap remove --purge $ECLIPSE_PACKAGE
snapcraft clean
fi

# sudo less /var/snap/lxd/common/lxd/logs/lxd.log
snapcraft pack --debug

AUTORUN=${AUTORUN:=false}
if $AUTORUN; then
if $ECLIPSE_CONFINED; then
sudo snap install ./$(echo $ECLIPSE_PACKAGE)_*_$(dpkg --print-architecture).snap --dangerous
else
sudo snap install ./$(echo $ECLIPSE_PACKAGE)_*_$(dpkg --print-architecture).snap --dangerous --classic
fi
snap run $ECLIPSE_PACKAGE &
fi

0 comments on commit dd317da

Please sign in to comment.