diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1749b2d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false + +[*.yaml] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3690a8..8d55eb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3040da0..936945e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 diff --git a/.gitignore b/.gitignore index d294450..7f31bcf 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,11 @@ +# snapcraft specifics +parts +stage +prime *.snap +.snapcraft +__pycache__ +*.pyc + +# generated +snap/snapcraft.yaml diff --git a/LICENSE b/LICENSE index e23ece2..81802d6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,277 +1,21 @@ -Eclipse Public License - v 2.0 - - THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE - PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION - OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - - a) in the case of the initial Contributor, the initial content - Distributed under this Agreement, and - - b) in the case of each subsequent Contributor: - i) changes to the Program, and - ii) additions to the Program; - where such changes and/or additions to the Program originate from - and are Distributed by that particular Contributor. A Contribution - "originates" from a Contributor if it was added to the Program by - such Contributor itself or anyone acting on such Contributor's behalf. - Contributions do not include changes or additions to the Program that - are not Modified Works. - -"Contributor" means any person or entity that Distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which -are necessarily infringed by the use or sale of its Contribution alone -or when combined with the Program. - -"Program" means the Contributions Distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this Agreement -or any Secondary License (as applicable), including Contributors. - -"Derivative Works" shall mean any work, whether in Source Code or other -form, that is based on (or derived from) the Program and for which the -editorial revisions, annotations, elaborations, or other modifications -represent, as a whole, an original work of authorship. - -"Modified Works" shall mean any work in Source Code or other form that -results from an addition to, deletion from, or modification of the -contents of the Program, including, for purposes of clarity any new file -in Source Code form that contains any contents of the Program. Modified -Works shall not include works that contain only declarations, -interfaces, types, classes, structures, or files of the Program solely -in each case in order to link to, bind by name, or subclass the Program -or Modified Works thereof. - -"Distribute" means the acts of a) distributing or b) making available -in any manner that enables the transfer of a copy. - -"Source Code" means the form of a Program preferred for making -modifications, including but not limited to software source code, -documentation source, and configuration files. - -"Secondary License" means either the GNU General Public License, -Version 2.0, or any later versions of that license, including any -exceptions or additional permissions as identified by the initial -Contributor. - -2. GRANT OF RIGHTS - - a) Subject to the terms of this Agreement, each Contributor hereby - grants Recipient a non-exclusive, worldwide, royalty-free copyright - license to reproduce, prepare Derivative Works of, publicly display, - publicly perform, Distribute and sublicense the Contribution of such - Contributor, if any, and such Derivative Works. - - b) Subject to the terms of this Agreement, each Contributor hereby - grants Recipient a non-exclusive, worldwide, royalty-free patent - license under Licensed Patents to make, use, sell, offer to sell, - import and otherwise transfer the Contribution of such Contributor, - if any, in Source Code or other form. This patent license shall - apply to the combination of the Contribution and the Program if, at - the time the Contribution is added by the Contributor, such addition - of the Contribution causes such combination to be covered by the - Licensed Patents. The patent license shall not apply to any other - combinations which include the Contribution. No hardware per se is - licensed hereunder. - - c) Recipient understands that although each Contributor grants the - licenses to its Contributions set forth herein, no assurances are - provided by any Contributor that the Program does not infringe the - patent or other intellectual property rights of any other entity. - Each Contributor disclaims any liability to Recipient for claims - brought by any other entity based on infringement of intellectual - property rights or otherwise. As a condition to exercising the - rights and licenses granted hereunder, each Recipient hereby - assumes sole responsibility to secure any other intellectual - property rights needed, if any. For example, if a third party - patent license is required to allow Recipient to Distribute the - Program, it is Recipient's responsibility to acquire that license - before distributing the Program. - - d) Each Contributor represents that to its knowledge it has - sufficient copyright rights in its Contribution, if any, to grant - the copyright license set forth in this Agreement. - - e) Notwithstanding the terms of any Secondary License, no - Contributor makes additional grants to any Recipient (other than - those set forth in this Agreement) as a result of such Recipient's - receipt of the Program under the terms of a Secondary License - (if permitted under the terms of Section 3). - -3. REQUIREMENTS - -3.1 If a Contributor Distributes the Program in any form, then: - - a) the Program must also be made available as Source Code, in - accordance with section 3.2, and the Contributor must accompany - the Program with a statement that the Source Code for the Program - is available under this Agreement, and informs Recipients how to - obtain it in a reasonable manner on or through a medium customarily - used for software exchange; and - - b) the Contributor may Distribute the Program under a license - different than this Agreement, provided that such license: - i) effectively disclaims on behalf of all other Contributors all - warranties and conditions, express and implied, including - warranties or conditions of title and non-infringement, and - implied warranties or conditions of merchantability and fitness - for a particular purpose; - - ii) effectively excludes on behalf of all other Contributors all - liability for damages, including direct, indirect, special, - incidental and consequential damages, such as lost profits; - - iii) does not attempt to limit or alter the recipients' rights - in the Source Code under section 3.2; and - - iv) requires any subsequent distribution of the Program by any - party to be under a license that satisfies the requirements - of this section 3. - -3.2 When the Program is Distributed as Source Code: - - a) it must be made available under this Agreement, or if the - Program (i) is combined with other material in a separate file or - files made available under a Secondary License, and (ii) the initial - Contributor attached to the Source Code the notice described in - Exhibit A of this Agreement, then the Program may be made available - under the terms of such Secondary Licenses, and - - b) a copy of this Agreement must be included with each copy of - the Program. - -3.3 Contributors may not remove or alter any copyright, patent, -trademark, attribution notices, disclaimers of warranty, or limitations -of liability ("notices") contained within the Program from any copy of -the Program which they Distribute, provided that Contributors may add -their own appropriate notices. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities -with respect to end users, business partners and the like. While this -license is intended to facilitate the commercial use of the Program, -the Contributor who includes the Program in a commercial product -offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes -the Program in a commercial product offering, such Contributor -("Commercial Contributor") hereby agrees to defend and indemnify every -other Contributor ("Indemnified Contributor") against any losses, -damages and costs (collectively "Losses") arising from claims, lawsuits -and other legal actions brought by a third party against the Indemnified -Contributor to the extent caused by the acts or omissions of such -Commercial Contributor in connection with its distribution of the Program -in a commercial product offering. The obligations in this section do not -apply to any claims or Losses relating to any actual or alleged -intellectual property infringement. In order to qualify, an Indemnified -Contributor must: a) promptly notify the Commercial Contributor in -writing of such claim, and b) allow the Commercial Contributor to control, -and cooperate with the Commercial Contributor in, the defense and any -related settlement negotiations. The Indemnified Contributor may -participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those performance -claims and warranties, and if a court requires any other Contributor to -pay any damages as a result, the Commercial Contributor must pay -those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT -PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" -BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR -IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF -TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR -PURPOSE. Each Recipient is solely responsible for determining the -appropriateness of using and distributing the Program and assumes all -risks associated with its exercise of rights under this Agreement, -including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs -or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT -PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS -SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST -PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE -EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that the -Program itself (excluding combinations of the Program with other software -or hardware) infringes such Recipient's patent(s), then such Recipient's -rights granted under Section 2(b) shall terminate as of the date such -litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign the -responsibility to serve as the Agreement Steward to a suitable separate -entity. Each new version of the Agreement will be given a distinguishing -version number. The Program (including Contributions) may always be -Distributed subject to the version of the Agreement under which it was -received. In addition, after a new version of the Agreement is published, -Contributor may elect to Distribute the Program (including its -Contributions) under the new version. - -Except as expressly stated in Sections 2(a) and 2(b) above, Recipient -receives no rights or licenses to the intellectual property of any -Contributor under this Agreement, whether expressly, by implication, -estoppel or otherwise. All rights in the Program not expressly granted -under this Agreement are reserved. Nothing in this Agreement is intended -to be enforceable by any entity that is not a Contributor or Recipient. -No third-party beneficiary rights are created under this Agreement. - -Exhibit A - Form of Secondary Licenses Notice - -"This Source Code may also be made available under the following -Secondary Licenses when the conditions for such availability set forth -in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), -version(s), and exceptions or additional permissions here}." - - Simply including a copy of this Agreement, including this Exhibit A - is not sufficient to license the Source Code under Secondary Licenses. - - If it is not possible or desirable to put the notice in a particular - file, then You may include the notice in a location (such as a LICENSE - file in a relevant directory) where a recipient would be likely to - look for such a notice. - - You may add additional accurate notices of copyright ownership. \ No newline at end of file +MIT License + +Copyright (c) 2017 Snapcrafters + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index a3a8280..a708ee2 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,162 @@ -# Eclipse IDE Snap Package +# Eclipse (confined snap edition) -## Install [![eclipse](https://snapcraft.io/eclipse/badge.svg)](https://snapcraft.io/eclipse) +Fork from - sudo snap install eclipse +Ships a few altered approaches -([Don't have snapd installed?](https://snapcraft.io/docs/core/install)) +* flavored eclipse - any eclipse-package can be snapped, see for discussion related. +* goes along a latest snap confinement. Selected touchpoints with the home-directory remain. -## Development +Attempt to merge with snapcrafters here: . -### Build - snapcraft +## Wanna try? -### Test - sudo snap install eclipse*.snap --classic --dangerous +1. `git clone https://github.com/janesser/eclipse-snap.git` +2. edit `eclipse-packages.yaml` according to your needs, and what is available at (see comment on query-params tweaking) +3. `./try-build.sh eclipse-pde` other packages declared will work + +### Hacks included + +the snap shares following pathes with the users $HOME (accessible from both ends) +(personal-files interface restricts file-access to 'rw') + +* `$HOME/eclipse-workspace` eclipse* will start with this workspace set +* `$HOME/.m2` maven-cached files are shared (may contain maven secrets eventually) +* `$HOME/.gitconfig` share git user settings +* `$HOME/.ssh` share ssh-keys and cares about known_hosts fingerprints +* `$HOME/projs` where your sourcecode remains (bind-mount/symlink in case you have other structures at hand) + +Once you assured that these locations are okay to be connected to the confined eclipse, use below script. + +```bash +export ECLIPSE_PACKAGE=eclipse-pde +sudo snap connect $ECLIPSE_PACKAGE:personal-sourcedir +sudo snap connect $ECLIPSE_PACKAGE:personal-workspace + +sudo snap connect $ECLIPSE_PACKAGE:personal-gitconfig +sudo snap connect $ECLIPSE_PACKAGE:personal-sshid +sudo snap connect $ECLIPSE_PACKAGE:personal-maven-cache +``` + +### Troubleshoot + +* Eclipse may or may not (depending on its configuration) be prepared to run in such a limited setup. +* Some findings occur even in non-confined eclipse installations. + +### Known issues + +* something is broken with certain GPU setups + +* snapcraft times out + + SOLUTION: restart lxd daemon + + ```bash + # when build timeouts + sudo systemctl restart snap.lxd.daemon + ``` + +* p2 install fails + + SOLUTION: double-check `eclipse.ini` in regards of `eclipse.home.location` and `eclipse.p2.data.area` + (both get preset by snap/local/wrappers/eclipse) + + ```text + An error occurred while collecting items to be installed + session context was:(profile=epp.package.committers, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). + Can't download artifact osgi.bundle,org.eclipse.emf.compare,3.5.3.202406060900 required by org.eclipse.emf.compare[3.5.3.202406060900], + ... + from any of the following repositories: + file:/snap/eclipse-pde/x1/ + file:/home/jan/snap/eclipse-pde/x1/amd64/p2/org.eclipse.equinox.p2.core/cache/ + file:/home/jan/snap/eclipse-pde/x2/amd64/p2/org.eclipse.equinox.p2.core/cache/ + file:/snap/eclipse-pde/x1/.eclipseextension + file:/home/jan/snap/eclipse-pde/x2/amd64/configuration/org.eclipse.osgi/229/data/listener_1925729951/ + file:/home/jan/snap/eclipse-pde/x1/amd64/ + file:/home/jan/snap/eclipse-pde/x1/amd64/configuration/org.eclipse.osgi/229/data/listener_1925729951/ + file:/snap/eclipse-pde/x2/.eclipseextension + https://download.eclipse.org/eclipse/updates/4.33 + https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.33.0 + https://download.eclipse.org/lsp4e/releases/0.26.6 + https://download.eclipse.org/webtools/downloads/drops/R3.35.0/R-3.35.0-20240825085431/repository + https://download.eclipse.org/justj/epp/release/21.0.0.v20241024-0603 + https://download.eclipse.org/egit/updates-7.1 + https://download.eclipse.org/wildwebdeveloper/releases/1.3.9 + https://download.eclipse.org/mylyn/updates/release/4.5.0 + https://download.eclipse.org/lsp4j/updates/releases/0.23.1 + https://download.eclipse.org/technology/m2e/releases/latest + https://download.eclipse.org/releases/2024-12 + https://download.eclipse.org/technology/epp/packages/latest/ + https://download.eclipse.org/releases/latest + https://download.eclipse.org/eclipse/updates/4.34 + https://download.eclipse.org/justj/epp/release/latest + https://download.eclipse.org/tm4e/releases/0.14.0 + https://download.eclipse.org/modeling/emf/emf/builds/release/2.40.0 + https://download.eclipse.org/justj/jres/21/updates/release/latest + ``` + +* pde product can't load libswt + + SOLUTION: move configuration to a locatioan where libswt may be loaded with 'x' (which could be $SNAP_USER_DATA), but not any of personal-files-interface locations. + + + + ```text + java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: + /home/jan/eclipse-workspace/.metadata/.plugins/org.eclipse.pde.core/archi.product/org.eclipse.osgi/182/0/.cp/libswt-gtk-4967r8.so: /home/jan/eclipse-workspace/.metadata/.plugins/org.eclipse.pde.core/archi.product/org.eclipse.osgi/182/0/.cp/libswt-gtk-4967r8.so: failed to map segment from shared object + no swt-gtk in java.library.path: /var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/eclipse-pde/x8/usr/lib:/snap/eclipse-pde/x8/usr/lib/x86_64-linux-gnu:/snap/eclipse-pde/x8/gpu-2404/usr/lib/x86_64-linux-gnu:/snap/eclipse-pde/x8/gpu-2404/usr/lib/x86_64-linux-gnu/vdpau:/snap/eclipse-pde/x8/gpu-2404/usr/lib/i386-linux-gnu:/snap/eclipse-pde/x8/gpu-2404/usr/lib/i386-linux-gnu/vdpau:/var/lib/snapd/lib/gl/vdpau:/var/lib/snapd/lib/gl32/vdpau:/snap/eclipse-pde/x8/gnome-platform/lib/x86_64-linux-gnu:/snap/eclipse-pde/x8/gnome-platform/usr/lib/x86_64-linux-gnu:/snap/eclipse-pde/x8/gnome-platform/usr/lib:/snap/eclipse-pde/x8/gnome-platform/lib:/snap/eclipse-pde/x8/gnome-platform/usr/lib/x86_64-linux-gnu/libunity:/snap/eclipse-pde/x8/gnome-platform/usr/lib/x86_64-linux-gnu/pulseaudio:/snap/eclipse-pde/x8/gnome-platform/usr/lib/x86_64-linux-gnu/libproxy:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib + no swt in java.library.path: /var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/eclipse-pde/x8/usr/lib:/snap/eclipse-pde/x8/usr/lib/x86_64-linux-gnu:/snap/eclipse-pde/x8/gpu-2404/usr/lib/x86_64-linux-gnu:/snap/eclipse-pde/x8/gpu-2404/usr/lib/x86_64-linux-gnu/vdpau:/snap/eclipse-pde/x8/gpu-2404/usr/lib/i386-linux-gnu:/snap/eclipse-pde/x8/gpu-2404/usr/lib/i386-linux-gnu/vdpau:/var/lib/snapd/lib/gl/vdpau:/var/lib/snapd/lib/gl32/vdpau:/snap/eclipse-pde/x8/gnome-platform/lib/x86_64-linux-gnu:/snap/eclipse-pde/x8/gnome-platform/usr/lib/x86_64-linux-gnu:/snap/eclipse-pde/x8/gnome-platform/usr/lib:/snap/eclipse-pde/x8/gnome-platform/lib:/snap/eclipse-pde/x8/gnome-platform/usr/lib/x86_64-linux-gnu/libunity:/snap/eclipse-pde/x8/gnome-platform/usr/lib/x86_64-linux-gnu/pulseaudio:/snap/eclipse-pde/x8/gnome-platform/usr/lib/x86_64-linux-gnu/libproxy:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib + Can't load library: /home/jan/.swt/lib/linux/x86_64/libswt-gtk-4967r8.so + Can't load library: /home/jan/.swt/lib/linux/x86_64/libswt-gtk.so + Can't load library: /home/jan/.swt/lib/linux/x86_64/libswt.so + ``` + +* "jni.cpp could not determine current working directory" + + SOLUTION: set working directory to something like: /home/jan/snap/eclipse-pde/current/workspace + + ```text + [0.021s][info][exceptions] Exception (0x000000071e402720) + thrown [src/hotspot/share/prims/jni.cpp, line 539] + for thread 0x00007c1a7402dc50 + [0.021s][info][exceptions] Exception (0x000000071e402e60) + thrown [src/hotspot/share/prims/jni.cpp, line 539] + for thread 0x00007c1a7402dc50 + [0.021s][info][exceptions] Exception + thrown in interpreter method <{method} {0x00007c19ff19f638} 'platformProperties' '()[Ljava/lang/String;' in 'jdk/internal/util/SystemProps$Raw'> + at bci 0 for thread 0x00007c1a7402dc50 (main) + [0.021s][info][exceptions] Exception + thrown in interpreter method <{method} {0x00007c19ff19f588} '' '()V' in 'jdk/internal/util/SystemProps$Raw'> + at bci 5 for thread 0x00007c1a7402dc50 (main) + [0.021s][info][exceptions] Exception + thrown in interpreter method <{method} {0x00007c19ff4594e0} 'initProperties' '()Ljava/util/Map;' in 'jdk/internal/util/SystemProps'> + at bci 4 for thread 0x00007c1a7402dc50 (main) + [0.021s][info][exceptions] Exception + thrown in interpreter method <{method} {0x00007c19ff01a898} 'initPhase1' '()V' in 'java/lang/System'> + at bci 3 for thread 0x00007c1a7402dc50 (main) + Error occurred during initialization of VM + java.lang.InternalError: platform encoding not initialized + at jdk.internal.util.SystemProps$Raw.platformProperties(java.base@21.0.5/Native Method) + at jdk.internal.util.SystemProps$Raw.(java.base@21.0.5/SystemProps.java:263) + at jdk.internal.util.SystemProps.initProperties(java.base@21.0.5/SystemProps.java:67) + at java.lang.System.initPhase1(java.base@21.0.5/System.java:2162) + ``` + +* eclipse points to versionized snap path + +![target platform path](target_platform_path.png) + +* gnome file picker returns difficult path + +![difficult file handle](difficult_file_handle.png) + +instead if within `personal-sourcedir` copy path from picker +![copy location from picker](copy_location_from_picker.png) + +## Disclaimer (for now) + +This won't be published to snap repos, since ment to be used in local build mode only. + +## Shout out + + diff --git a/eclipse-packages.yaml b/eclipse-packages.yaml new file mode 100644 index 0000000..bbb5d28 --- /dev/null +++ b/eclipse-packages.yaml @@ -0,0 +1,17 @@ +# 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" + arm64: + source: https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2024-12/R/eclipse-committers-2024-12-R-linux-gtk-aarch64.tar.gz&r=1 + checksum: "sha512/a1bef6fc804d37e1d3638ffb5d3490b61606cd30977a2918a4f035853a8a241283a68de9cd15bc61e23e95557095f5543e31ca14b2ec2358bdc70d8b9d700dde" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..65eafc2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +yglu +setuptools \ No newline at end of file diff --git a/set-eclipse-package.sh b/set-eclipse-package.sh new file mode 100755 index 0000000..44676fd --- /dev/null +++ b/set-eclipse-package.sh @@ -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 diff --git a/snap/gui/eclipse.desktop b/snap/gui/eclipse.desktop index 07ee9dd..723f714 100644 --- a/snap/gui/eclipse.desktop +++ b/snap/gui/eclipse.desktop @@ -2,8 +2,8 @@ Version=1.0 Type=Application Name=Eclipse -Icon=${SNAP}/usr/lib/eclipse/icon.xpm -Exec=eclipse %f +Icon=/usr/lib/eclipse/icon.xpm +Exec=bin/eclipse-wrapper %f Comment=Eclipse IDE Categories=Development;IDE; Terminal=false diff --git a/snap/local/wrappers/eclipse_confined b/snap/local/wrappers/eclipse_confined new file mode 100755 index 0000000..267ca73 --- /dev/null +++ b/snap/local/wrappers/eclipse_confined @@ -0,0 +1,26 @@ +#!/bin/bash + +# will update eclipse.home.location and eclipse.p2.data.area towards $SNAP_USER_DATA +## will update on every execution to go along latest revision x1, x2, ... +ECLIPSE_INI=$SNAP_USER_DATA/eclipse.ini + +cp $SNAP/usr/lib/eclipse/eclipse.ini $ECLIPSE_INI +chmod 666 $ECLIPSE_INI + +mkdir -p $SNAP_USER_DATA/eclipse_home +echo -Declipse.home.location=file:$SNAP_USER_DATA/eclipse_home | tee -a $ECLIPSE_INI +mkdir -p $SNAP_USER_DATA/p2_data +echo -Declipse.p2.data.area=te$SNAP_USER_DATA/p2_data | tee -a $ECLIPSE_INI + +EXTRA_ARGS+=("--launcher.ini" "$ECLIPSE_INI") + +# get .gitconfig mapped +ln -sf $SNAP_REAL_HOME/.gitconfig ~/.gitconfig +ln -sf $SNAP_REAL_HOME/.ssh ~/.ssh + + +# see snap plug personal-workspace +ECLIPSE_WORKSPACE=/home/$USER/eclipse-workspace +echo Using workspace at $ECLIPSE_WORKSPACE. + +exec "$SNAP/eclipse" -configuration "${SNAP_USER_DATA}/${SNAP_ARCH}/configuration" -data "$ECLIPSE_WORKSPACE" "${EXTRA_ARGS[@]}" "$@" diff --git a/snap/snapcraft.yaml b/snapcraft.yaml.template similarity index 81% rename from snap/snapcraft.yaml rename to snapcraft.yaml.template index 5907fbf..faadebc 100644 --- a/snap/snapcraft.yaml +++ b/snapcraft.yaml.template @@ -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: @@ -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' @@ -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* diff --git a/snapcraft.yaml.template_confined b/snapcraft.yaml.template_confined new file mode 100644 index 0000000..4b210f9 --- /dev/null +++ b/snapcraft.yaml.template_confined @@ -0,0 +1,130 @@ +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 + - network-bind + +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 + # TODO use source-checksum once supported in multiarch setting + - on amd64: !? .epackages[$_.version][$_.name].amd64.source + - on arm64: !? .epackages[$_.version][$_.name].arm64.source + build-attributes: + - no-patchelf + 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' + override-prime: | + craftctl default + 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*/ + find $SNAPCRAFT_PRIME/usr/lib/eclipse/ -type d -exec chmod 555 {} \; + find $SNAPCRAFT_PRIME/usr/lib/eclipse/ -type f -exec chmod 444 {} \; + chmod +x $SNAPCRAFT_PRIME/usr/lib/eclipse/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.linux*/jre/bin/java + chmod +x $SNAPCRAFT_PRIME/usr/lib/eclipse/eclipse + wrappers: + plugin: dump + source: snap/local/wrappers + organize: + eclipse_confined: 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 + /usr/lib/eclipse: + bind: $SNAP/usr/lib/eclipse + +lint: + ignore: + - library: + - usr/lib/**/*.so* \ No newline at end of file diff --git a/try-build.sh b/try-build.sh new file mode 100755 index 0000000..3472f0e --- /dev/null +++ b/try-build.sh @@ -0,0 +1,37 @@ +#!/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 + +if $ECLIPSE_CONFINED; then + sudo snap install ./$(echo $ECLIPSE_PACKAGE)_*_$(dpkg --print-architecture).snap --dangerous + sudo snap connect $ECLIPSE_PACKAGE:personal-sourcedir + sudo snap connect $ECLIPSE_PACKAGE:personal-workspace + sudo snap connect $ECLIPSE_PACKAGE:personal-gitconfig + sudo snap connect $ECLIPSE_PACKAGE:personal-sshid + sudo snap connect $ECLIPSE_PACKAGE:personal-maven-cache +else + sudo snap install ./$(echo $ECLIPSE_PACKAGE)_*_$(dpkg --print-architecture).snap --dangerous --classic +fi + +AUTORUN=${AUTORUN:=false} +if $AUTORUN; then + snap run $ECLIPSE_PACKAGE & +fi