diff --git a/app/gui-swt-linux-arm/build.gradle b/app/gui-swt-linux-arm/build.gradle index e31c5d8..519eb87 100644 --- a/app/gui-swt-linux-arm/build.gradle +++ b/app/gui-swt-linux-arm/build.gradle @@ -17,8 +17,7 @@ repositories { dependencies { implementation project(':lib:ac-swt-common') - // This is a special case until 32-bit SWT libraries become available. - implementation("org.eclipse.platform:org.eclipse.swt.gtk.linux.arm:3.8.2") { + implementation("org.eclipse.platform:org.eclipse.swt.gtk.linux.arm:$piSwtVersion") { exclude group: "org.eclipse.platform", module: "org.eclipse.swt" } } diff --git a/gradle.properties b/gradle.properties index b5afa32..321b4a2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,7 @@ shkVersion=1.2.2 asVersion=1.2.1 btVersion=0.3.1 swtVersion=3.118.0 +piSwtVersion=3.8.2 junitVersion=4.12 antVersion=1.8.2 commonsLang3Version=3.7 diff --git a/lib/ac-swt-common/build.gradle b/lib/ac-swt-common/build.gradle index d92b185..9841d14 100644 --- a/lib/ac-swt-common/build.gradle +++ b/lib/ac-swt-common/build.gradle @@ -25,8 +25,13 @@ dependencies { test { String osName = System.getProperty('os.name').toLowerCase().split()[0] String osArch = System.getProperty('os.arch').toLowerCase().split()[0] - if ("amd64".equals(osArch)) { - osArch = "x86_64" + switch (osArch) { + case 'amd64': + osArch = "x86_64" + break + case 'arm': + swtVersion = "$piSwtVersion" + break } String swtDependency switch (osName) { @@ -43,7 +48,10 @@ test { throw new Exception('Unknown OS') } dependencies { - implementation("$swtDependency") { + compileOnly("$swtDependency") { + exclude group: "org.eclipse.platform", module: "org.eclipse.swt" + } + testImplementation("$swtDependency") { exclude group: "org.eclipse.platform", module: "org.eclipse.swt" } } diff --git a/lib/ac-swt-common/src/test/java/com/webcodepro/applecommander/ui/swt/SwtImageTest.java b/lib/ac-swt-common/src/test/java/com/webcodepro/applecommander/ui/swt/SwtImageTest.java index 255c274..a0d2df9 100644 --- a/lib/ac-swt-common/src/test/java/com/webcodepro/applecommander/ui/swt/SwtImageTest.java +++ b/lib/ac-swt-common/src/test/java/com/webcodepro/applecommander/ui/swt/SwtImageTest.java @@ -18,6 +18,10 @@ public class SwtImageTest { public void testPNG() throws Exception { // SwtImage unit test fails on Mac, appears to be the thread deal. Disabling for now. assumeThat(SystemUtils.IS_OS_MAC, is(false)); + // ... and on Rasbian 32-bit; disabling. + if (SystemUtils.IS_OS_LINUX) { + assumeThat(SystemUtils.OS_ARCH.equals("arm"), is(false)); + } performTest("PNG"); //$NON-NLS-1$ } @@ -25,6 +29,10 @@ public class SwtImageTest { public void testJPEG() throws Exception { // SwtImage unit test fails on Mac, appears to be the thread deal. Disabling for now. assumeThat(SystemUtils.IS_OS_MAC, is(false)); + // ... and on Rasbian 32-bit; disabling. + if (SystemUtils.IS_OS_LINUX) { + assumeThat(SystemUtils.OS_ARCH.equals("arm"), is(false)); + } performTest("JPEG"); //$NON-NLS-1$ } @@ -32,6 +40,10 @@ public class SwtImageTest { public void testBMP() throws Exception { // SwtImage unit test fails on Mac, appears to be the thread deal. Disabling for now. assumeThat(SystemUtils.IS_OS_MAC, is(false)); + // ... and on Rasbian 32-bit; disabling. + if (SystemUtils.IS_OS_LINUX) { + assumeThat(SystemUtils.OS_ARCH.equals("arm"), is(false)); + } performTest("BMP"); //$NON-NLS-1$ } @@ -39,6 +51,10 @@ public class SwtImageTest { public void testBMP_RLE() throws Exception { // SwtImage unit test fails on Mac, appears to be the thread deal. Disabling for now. assumeThat(SystemUtils.IS_OS_MAC, is(false)); + // ... and on Rasbian 32-bit; disabling. + if (SystemUtils.IS_OS_LINUX) { + assumeThat(SystemUtils.OS_ARCH.equals("arm"), is(false)); + } performTest("RLE"); //$NON-NLS-1$ } @@ -55,6 +71,10 @@ public class SwtImageTest { public void testICO() throws Exception { // SwtImage unit test fails on Mac, appears to be the thread deal. Disabling for now. assumeThat(SystemUtils.IS_OS_MAC, is(false)); + // ... and on Rasbian 32-bit; disabling. + if (SystemUtils.IS_OS_LINUX) { + assumeThat(SystemUtils.OS_ARCH.equals("arm"), is(false)); + } performTest("ICO"); //$NON-NLS-1$ } diff --git a/swt-lib/README.md b/swt-lib/README.md new file mode 100644 index 0000000..7dcb951 --- /dev/null +++ b/swt-lib/README.md @@ -0,0 +1,24 @@ +# Notes for Raspberry Pi + +* Current target is Rasbian; 32-bit Rasbian and the 32-bit Rasberry Pi OS should also be ok. These are not part of the repository and are managed manually for now. +* The Eclipse builds do appear to include a 64-bit version, so expecting that Rasberry Pi OS (64-bit) will be ok. + +# Updates + +Process is manual. + +1. Go to http://raspbian.raspberrypi.org/raspbian/pool/main/s/swt4-gtk/ and grab the latest copy of the `libswt-*` libraries. +2. Versions are super confusing. For instance, the files with `4.13.0` have a `version.txt` that suggests `4.924` as the version. None of these match what Eclipse is publishing. However, the Java manifest (`META-INF/MANIFEST.MF`) has a `Bundle-Version` entry that indicates `3.104.0`. Knowing that the Eclipse published version is `3.118.0` and that `version.txt` indicates `4.948` suggests the bundle version is the correct version entry to use. +3. See https://unix.stackexchange.com/questions/138188/easily-unpack-deb-edit-postinst-and-repack-deb regarding unpacking of the deb files. + ``` + mkdir tmp + dpkg-deb -R libswt-gtk-4-java_4.13.0-1+b2_armhf.deb tmp + mkdir tmp2 + dpkg-deb -R libswt-gtk-4-jni_4.13.0-1+b2_armhf.deb tmp2 + ``` +4. Look for the JAR files. We need the ones with `.class` files and some set of the `.so` files that are created. These need to be combined. Launching AppleCommander with the JAR should be sufficient to verify all code is in place. Probably. +5. Name the file according to pattern and place in `swt-lib`. + + +NOTE: SWT4 seems to be 64-bit only? May need to pull earlier versions. +These are at http://raspbian.raspberrypi.org/raspbian/pool/main/s/swt-gtk/ diff --git a/swt-lib/org.eclipse.swt.gtk.linux.arm-3.104.0.jar b/swt-lib/org.eclipse.swt.gtk.linux.arm-3.104.0.jar new file mode 100644 index 0000000..8c98bfa Binary files /dev/null and b/swt-lib/org.eclipse.swt.gtk.linux.arm-3.104.0.jar differ