2017-11-16 05:00:11 +00:00
# Developer Notes
AppleCommander has switched to using [Gradle ](https://gradle.org/ ) for build and build dependencies.
2018-03-02 19:32:36 +00:00
There is still a bunch of ANT related build information around. They no longer apply and "should" get cleaned up over time.
2022-01-09 03:26:03 +00:00
## Structure
The project is structured as a Gradle multi-project. Independent components have been broken out and each of the SWT targets are independent.
| Path | Note |
| ---- | ---- |
| `lib/ac-api` | The AppleCommander APIs. These are released via Maven and resused in several projects. |
| `lib/ac-swt-common` | The SWT GUI application. Since SWT targets specific environments with native libraries, the actual applications are in the `app` directories. |
| `app/cli-ac` | The `ac` CLI utility. |
| `app/cli-acx` | The `acx` CLI utility. |
| `app/gui-swt-<os>-<arch>` | The indepent SWT GUI applications; one project per combination. |
## Requirements
With the introduction of the Apple Silicon, AppleCommander switched over to the (relatively new) SWT libraries. With that switch, the SWT libraries now require Java 11.
2017-11-16 05:00:11 +00:00
## Tests
```
2022-01-09 03:26:03 +00:00
./gradlew test
BUILD SUCCESSFUL in 554ms
19 actionable tasks: 19 up-to-date
2017-11-16 05:00:11 +00:00
```
## Building
```
2022-01-09 03:26:03 +00:00
./gradlew clean build
BUILD SUCCESSFUL in 7s
104 actionable tasks: 104 executed
```
2017-11-16 05:00:11 +00:00
2022-01-09 03:26:03 +00:00
## Older notes..
2020-01-20 22:18:37 +00:00
2022-01-09 03:26:03 +00:00
Just keeping these for the short-term...
```
2020-01-20 22:18:37 +00:00
$ tools/retrolambda.sh build/libs/AppleCommander-ac-< version > .jar
Converting...
Retrolambda 2.5.6
Repackaging to build/libs/AppleCommander-ac-< version > -java5.jar
2017-11-16 05:00:11 +00:00
```
2020-01-20 22:18:37 +00:00
This will:
1. Create the `build` directory and populate with uber-jars in `build/libs` .
2. Create a Java 5 variant of the `ac` tool in `AppleCommander-ac-<version>-java5.jar` . (Replace `<version>` with version.)
2017-11-16 05:00:11 +00:00
2018-03-02 19:32:36 +00:00
To run the command-line version of AppleCommander, use the following:
2017-11-16 05:00:11 +00:00
2018-03-02 19:32:36 +00:00
* All platforms:
2019-10-01 00:58:02 +00:00
`java -jar build/libs/AppleCommander-ac-VERSION.jar`
2020-01-20 22:18:37 +00:00
* Java 5:
`java -jar build/libs/AppleCommander-ac-VERSION-java5.jar`
2017-11-16 05:00:11 +00:00
2018-03-02 19:32:36 +00:00
To launch the GUI version of AppleCommander, use the following:
* Linux:
2019-10-01 00:58:02 +00:00
`java -jar build/libs/AppleCommander-linux64-gtk-VERSION.jar`
2018-03-02 19:32:36 +00:00
* Windows:
2019-10-01 00:58:02 +00:00
`java -jar build/libs/AppleCommander-win64-VERSION.jar`
2018-03-02 19:32:36 +00:00
* Mac OS X:
`java -XstartOnFirstThread -jar build/libs/AppleCommander-macosx-VERSION.jar`
2020-10-07 21:13:13 +00:00
## Raspberry Pi Notes
Available versions found are: `3.8` and `4.6` . `4.6` failed with a JNI issue.
Retrieve libraries:
```
$ sudo apt install libswt-gtk-3-java libswt-gtk-3-jni
```
Combine into one JAR (`-j` drops the directories from `*.so` files in the zip file):
```
$ cp /usr/lib/java/swt-gtk-3.8.2.jar org.eclipse.swt.gtk.linux.arm-3.8.2.jar
$ zip -j org.eclipse.swt.gtk.linux.arm-3.8.2.jar /usr/lib/jni/libswt-*3836*.so
```
Preserve JAR file in `rpi-lib` ! If the file name is incorrect, the build process will show the expected filename in the error message...
Error for 4.6:
```
** (SWT:12220): CRITICAL ** : 15:12:55.506: JNI method ID pointer is NULL for method atkObject_get_role
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.webcodepro.applecommander.ui.AppleCommander.launchSwtAppleCommander(AppleCommander.java:103)
at com.webcodepro.applecommander.ui.AppleCommander.main(AppleCommander.java:57)
Caused by: java.lang.NoSuchMethodError: atkObject_get_role
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1581)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4470)
at com.webcodepro.applecommander.ui.swt.SwtAppleCommander.launch(SwtAppleCommander.java:93)
at com.webcodepro.applecommander.ui.swt.SwtAppleCommander.launch(SwtAppleCommander.java:79)
... 6 more
```