Support generation of native installer binaries

Use `./gradlew run` to build and run Bitsquare directly.

Use `./gradlew shadowJar` to generate a portable, executable jar.

Use `./gradlew packageNative` to generate an installer binary specific
to the platform you are running on.

In the case of Windows, it is necessary to copy the two .dll files in
the `package/` directory to the directory where Bitsquare.exe is
ultimately installed.

Resolves #243
This commit is contained in:
Chris Beams 2014-10-28 14:46:53 +01:00
parent 9c8b76d2b6
commit 1323e77608
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
6 changed files with 67 additions and 0 deletions

View File

@ -1,3 +1,9 @@
import org.apache.tools.ant.taskdefs.condition.Os
plugins {
id "com.github.johnrengelman.shadow" version "1.1.2"
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
@ -41,4 +47,17 @@ dependencies {
testCompile 'org.mockito:mockito-all:1.9.5'
}
task packageNative(type:Exec, dependsOn:shadowJar) {
if (Os.isFamily(Os.FAMILY_MAC))
executable "${project.rootDir}/package/mac.sh"
else if (Os.isFamily(Os.FAMILY_UNIX))
executable "${project.rootDir}/package/linux.sh"
else if (Os.isFamily(Os.FAMILY_WINDOWS))
executable "${project.rootDir}/package/windows.bat"
else
throw new GradleException("Unsupported OS: " + System.properties['os.name'])
args project.version, shadowJar.archivePath, mainClassName
}
wrapper.gradleVersion = '2.1'

23
package/linux.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
version=$1
jar=$2
mainClass=$3
javapackager -deploy \
-BappVersion=$version \
-Bcategory=Finance \
-BlicenseType=GPLv3 \
-Bemail=info@bitsquare.io \
-native deb \
-name Bitsquare \
-title Bitsquare \
-vendor Bitsquare \
-outdir build \
-appclass $mainClass \
-srcfiles $jar \
-outfile Bitsquare
# -Bicon=client/icons/icon.png \

24
package/mac.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
version=$1
jar=$2
mainClass=$3
javapackager \
-deploy \
-BappVersion=$version \
-Bmac.CFBundleIdentifier=bitsquare \
-Bmac.CFBundleName=Bitsquare \
-Bruntime="$JAVA_HOME/../../" \
-native dmg \
-name Bitsquare \
-title Bitsquare \
-vendor Bitsquare \
-outdir build \
-srcfiles $jar \
-appclass $mainClass \
-outfile Bitsquare
#-Bicon=client/icons/mac.icns \

BIN
package/msvcp100.dll Normal file

Binary file not shown.

BIN
package/msvcr100.dll Normal file

Binary file not shown.

1
package/windows.bat Normal file
View File

@ -0,0 +1 @@
C:\Progra~1\Java\jdk1.8.0_20\bin\javapackager.exe -deploy -BappVersion=0.1.0 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir build -appclass io.bitsquare.BitSquare -srcfiles .\build\libs\bitsquare-0.1.0-SNAPSHOT-all.jar -outfile Bitsquare -Bruntime="c:\Program Files\Java\jdk1.8.0_20\jre"