https://github.com/sshtools/jaul
JAdaptive Application Update Library
https://github.com/sshtools/jaul
Last synced: over 1 year ago
JSON representation
JAdaptive Application Update Library
- Host: GitHub
- URL: https://github.com/sshtools/jaul
- Owner: sshtools
- Created: 2023-02-25T21:22:24.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T08:46:29.000Z (about 2 years ago)
- Last Synced: 2024-04-24T06:38:51.929Z (about 2 years ago)
- Language: Java
- Size: 135 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JADAPTIVE Application Update Library
Adds update features to several Jadaptive projects via the Install4J runtime. Install4J itself is optional and only available in the EJ Technologies repository.
## Add Update Support To An Application
There are 4 main areas that will need changing to add multi-channel update support to an application.
* Maven
* Java (ie. the Application itself)
* Install4J Project
* Jenkins Build
### Maven
First add some `` tags.
```xml
continuous
windows,unixInstaller,macos,macosFolder,windowsArchive,unixArchive,linuxRPM,linuxDeb,macosArchive,macosFolderArchive
${project.basedir}/installer.install4j
${basedir}/jadaptive.build.properties
${user.home}/.jadaptive.build.properties
```
Now you'll need a ``.
```xml
com.install4j
install4j-runtime
10.0.4
provided
```
You'll also need *jaul* itself. If this is a JavaFX application, hopefully you are already using `jajafx`, or if this is a command line tool hopefully you are already using `command-utils`. Either of these handle the bulk of the integration, you just need to provide some details and initiate the update or update check according to your user interface needs.
So, if you are not already using either of the framework libraries, add another dependency.
```xml
com.sshtools
jaul
0.0.2-SNAPSHOT
```
Now you'll need to add some plugins. First off, copy and paste the following into a `` / `` section.
```xml
org.codehaus.mojo
properties-maven-plugin
org.codehaus.mojo
build-helper-maven-plugin
```
And then the following into `` / `` / ``.
```xml
org.codehaus.mojo
versions-maven-plugin
2.15.0
org.codehaus.mojo
properties-maven-plugin
1.0.0
initialize
read-project-properties
true
${build.projectProperties}
${build.userProperties}
org.codehaus.mojo
build-helper-maven-plugin
3.3.0
build-number-property
regex-property
initialize
product.version
${project.version}
^([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9A-Za-z]+)$
$1.$2.$3
false
product-version-property
regex-property
initialize
build.number
0${env.BUILD_NUMBER}
^(?:0?)([0-9]+)(?:\$\{env\.BUILD_NUMBER\})?$
$1
false
com.install4j
install4j-maven
10.0.4
org.apache.maven.plugins
maven-antrun-plugin
1.8
```
You'll also need some `` and ``.
```xml
oss-snapshots
https://oss.sonatype.org/content/repositories/snapshots
false
ej-technologies
https://maven.ej-technologies.com/repository
ej-technologies
https://maven.ej-technologies.com/repository
false
```
Now add a new `` that is activated by the `buildInstaller` system property.
```xml
install4j-installers
buildInstaller
true
org.apache.maven.plugins
maven-antrun-plugin
package
run
org.apache.maven.plugins
maven-dependency-plugin
${project.build.directory}/dependencies
copy-dependencies
package
copy-dependencies
true
${project.build.directory}/dependencies/common
true
com.install4j
install4j-maven
compile-installers
package
compile
${build.phase}
${product.version}-${build.number}
${build.mediaTypes}
${build.install4j.project}
```
### Java (ie. the Application itself)
How to do this will depend on the type of application. There are currently 3 major classes of application that can be integrated.
* Command Line Application
* JavaFX GUI Application
* Everything else (e.g. SWT application).
** Note, you will find the property `install4j.runtimeDir` useful. In a development environment (e.g. Eclipse), you can set this
property on a launcher to test update functionality. It must be the path to a real installation of the app, suffixed by `.install4j`, e.g.
`/opt/push-sftp/.install4j`. **
#### Command Line Application
Assuming you are using the `command-utils` module, you will be provide t
#### JavaFX GUI Application
TODO
#### Everything else
TODO
## Install4J Project
The Install4J project should be setup in the normal way, with the following additions.
1. Create a *Compiler Variable* named `build.phase`. Give it a default value of `continuous`.
1. You will need a launcher that can accept `--jaul-register` or `--jaul-deregister` arguments. You should have a `main()` class that can do this if you followed the above integration instructions. It is usually fine to re-use the launcher for the application, but some circumstances may require a dedicated lancher (e.g. service without a console mode).
1. The launcher should also have a *VM Parameter* configured. Add `-Dinstall4j.installationDir=${installer:sys.installationDir}`.
1. In *Screens and Actions* add a new *Run executable or batch file* **Action** at the very *end* of the *Installer*. Have it call the above the launcher, and pass the `--jaul-register` as an argument.
1. In *Screens and Actions* add a new *Run executable or batch file* **Action** at the very *start* of the *Uninstaller*. Have it call the above the launcher, and pass the `--jaul-deregister` as an argument.
1. In *Screens and Actions* add a new *Application*, and choose **Standalond update donwloader**.
1. Configure this application to have an *Executable Name* of `updater`. Change *Default execution mode* to *Unattended with progress dialog* and the title for the progress dialog to suit your needs.
1. Take a note of the *ID* of the Standalone update download (you can turn on showing IDs in the *Project* menubar menu.
1. Go to *Auto-Update Options* and add the *URL for updates XML*. This is the final public location where the `updates.xml` will be uploaded to and made available. It will contain the `build.phase variable. For example, https://sshtools-public.s3.eu-west-1.amazonaws.com/push-sftp-gui/${compiler:build.phase}/updates.xml
1. Select *Base URL for installers* and add the same URL, but without the `update.xml` and phase parts on the end, but instead the full version. For example, https://sshtools-public.s3.eu-west-1.amazonaws.com/push-sftp-gui/${compiler:sys,version}/. This URL *must* have a trailing `/`.
Save the project. Now add the ID you noted to the Java application's `@JaulApp` annotation.
You can now test a build locally.
```
mvn clean package -DbuildInstaller=true
```
## Jenkins Build
TODO