Skip to content

Commit

Permalink
Merge pull request #221 from itsallcode/add-plugins-to-native-packages
Browse files Browse the repository at this point in the history
Add plugins to native packages
  • Loading branch information
kaklakariada authored Nov 7, 2021
2 parents ffecf73 + 5bdf6db commit a6b1e02
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* [#216](https://github.com/itsallcode/white-rabbit/pull/216): Add support for macOS.
* [#219](https://github.com/itsallcode/white-rabbit/pull/219): Configure installer for Windows.
* [#221](https://github.com/itsallcode/white-rabbit/issues/221): Add plugins to native packages.

### Bugfix

Expand Down
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,30 @@ A time recording tool
java -jar whiterabbitfx-signed.jar
```

### Install Native Package

Follow the [instructions](#build_native_package) to build a native package for your platform. The package will be built in `jfxui/build/jpackage-dist/`. Install it as usual for your platform.

#### Ubuntu

Install the `.deb` file like this:

```shell
sudo dpkg --install jfxui/build/jpackage-dist/whiterabbit_${version}_amd64.deb
```

This will install WhiteRabbit to `/opt/whiterabbit/`. You can launch it by running

```shell
/opt/whiterabbit/bin/WhiteRabbit &
```

To remove WhiteRabbit, run

```shell
sudo dpkg --remove whiterabbit
```

### Install WhiteRabbit via WebStart

1. Install [OpenWebStart](https://openwebstart.com).
Expand Down Expand Up @@ -341,7 +365,7 @@ java -jar jfxui/build/libs/white-rabbit-fx-<version>[-SNAPSHOT].jar
./gradlew dependencyUpdates
```
### Build Native Packages
### <a name="build_native_package"></a>Build Native Packages
Precondition for Windows: Install the [WiX Toolset](https://wixtoolset.org) and add it to the `PATH`.
Expand Down
33 changes: 24 additions & 9 deletions jfxui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jar {

build.dependsOn shadowJar

def jPackageDir = "$buildDir/jpackage-jars"

project(':plugins').afterEvaluate {
List<Task> pluginJarTasks = project(':plugins').ext.pluginBuildTasks

Expand All @@ -64,6 +66,28 @@ project(':plugins').afterEvaluate {
task runJfxuiWithPlugins(dependsOn: runWithPlugins, group: 'run') {
// deprecated
}

def getUnwantedPlatforms = {
OperatingSystem os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem
if(os.isLinux()) {
return ["mac", "win"]
}
if(os.isWindows()) {
return ["mac", "linux"]
}
if(os.isMacOs()) {
return ["linux", "win"]
}
}

task copyJPackageDependencies(type: Copy, dependsOn: ["jar"]) {
def unwantedPlatforms = getUnwantedPlatforms()
from(configurations.runtimeClasspath.filter { file ->
unwantedPlatforms.every { platform -> !file.name.endsWith("-${platform}.jar") }
}).into jPackageDir
from(tasks.jar.outputs.files).into jPackageDir
from(pluginJarTasks).into jPackageDir
}
}

task run(type: JavaExec, dependsOn: shadowJar, group: 'run') {
Expand Down Expand Up @@ -120,15 +144,6 @@ check.dependsOn uiTest

tasks["jacocoTestReport"].executionData fileTree(project.buildDir).include("jacoco/*.exec")


def jPackageDir = "$buildDir/jpackage-jars"

task copyJPackageDependencies(type: Copy, dependsOn: ["jar"]) {
from(configurations.runtimeClasspath).into jPackageDir
from(tasks.jar.outputs.files).into jPackageDir
}


tasks.jpackage {
dependsOn("copyJPackageDependencies")

Expand Down

0 comments on commit a6b1e02

Please sign in to comment.