mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Generate native installers with Gradle JavaFX plugin
The plugin's jfx* tasks tie into the normal Gradle build lifecycle, such that `gradle build` will now generate executables and installers according to the OS on which the build is being run. These files are output to the `build/distributions` directory. Installers work as expected OS X and Linux at this point. Windows installers do build, but a very particular configuration is necessary on the Windows machine doing the building (this configuration is to be documented in #109). However, even when the configuration is in place and the MSI installer is successfully built, there is still a fatal error at installer execution time relating to a missing msvp100.dll file. See details at https://bitbucket.org/shemnon/javafx-gradle/issue/43. An issue has been created to track this from the Bitsquare side as well--see #108. The changes made in this commit are based on on the samples at http://bitbucket.org/shemnon/javafx-gradle and the article at http://jaxenter.com/tutorial-a-guide-to-the-gradle-javafx-plugin-46270.html The gradle/javafx.gradle file is copied directly from the sources in the bitbucket repository above, as is apparently the convention (not sure why this isn't part of the plugin itself, but that's a question to be addressed later). Resolves #66, #100 See #108, #109
This commit is contained in:
parent
bfd12b4648
commit
d16c2740b6
28
build.gradle
28
build.gradle
@ -1,25 +1,25 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.github.rholder:gradle-one-jar:1.0.4'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'application'
|
||||
apply plugin: 'gradle-one-jar'
|
||||
apply from: 'gradle/javafx.gradle'
|
||||
|
||||
version = '0.1.0-SNAPSHOT'
|
||||
sourceCompatibility = 1.8
|
||||
mainClassName = 'io.bitsquare.BitSquare'
|
||||
|
||||
sourceSets.main.resources.srcDirs += 'src/main/java'
|
||||
|
||||
task executableJar(type: OneJar) {
|
||||
mainClass = project.mainClassName
|
||||
archiveName = 'bitsquare.jar'
|
||||
javafx {
|
||||
appID 'Bitsquare'
|
||||
appName 'Bitsquare'
|
||||
mainClass 'io.bitsquare.BitSquare'
|
||||
|
||||
profiles {
|
||||
windows {
|
||||
javaRuntime = 'C:/Program Files/Java/jdk1.8.0_20/jre'
|
||||
bundleArguments = [
|
||||
'win.msi.productVersion' : '0.1.0'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
95
gradle/javafx.gradle
Normal file
95
gradle/javafx.gradle
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Bootstrap script for the Gradle JavaFX Plugin.
|
||||
* (based on http://plugins.jasoft.fi/vaadin.plugin)
|
||||
*
|
||||
* The script will add the plugin to the build script
|
||||
* dependencies and apply the plugin to the project. If you do not want
|
||||
* this behavior you can copy and paste the below configuration into your
|
||||
* own build script and define your own repository and version for the plugin.
|
||||
*/
|
||||
|
||||
import org.gradle.api.GradleException;
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = 'BinTray'
|
||||
url = 'http://dl.bintray.com/content/shemnon/javafx-gradle/'
|
||||
}
|
||||
maven {
|
||||
name = 'CloudBees Snapshot'
|
||||
url = 'http://repository-javafx-gradle-plugin.forge.cloudbees.com/snapshot'
|
||||
}
|
||||
ivy {
|
||||
url = 'http://repository-javafx-gradle-plugin.forge.cloudbees.com/snapshot'
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
try {
|
||||
assert (jfxrtDir != null)
|
||||
} catch (RuntimeException re) {
|
||||
ext.jfxrtDir = "."
|
||||
}
|
||||
|
||||
ext.searchFile = {Map<String, Closure> places, List<String> searchPaths, String searchID ->
|
||||
File result = null;
|
||||
places.each { k, v ->
|
||||
if (result != null) return;
|
||||
project.logger.debug("Looking for $searchID in $k")
|
||||
def dir = v()
|
||||
if (dir == null) {
|
||||
project.logger.debug("$k not set")
|
||||
} else {
|
||||
project.logger.debug("$k is $dir")
|
||||
searchPaths.each { s ->
|
||||
if (result != null) return;
|
||||
File f = new File(dir, s);
|
||||
project.logger.debug("Trying $f.path")
|
||||
if (f.exists() && f.file) {
|
||||
project.logger.debug("found $searchID as $result")
|
||||
result = f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!result?.file) {
|
||||
throw new GradleException("Could not find $searchID, please set one of ${places.keySet()}");
|
||||
} else {
|
||||
project.logger.info("$searchID: ${result}")
|
||||
return result
|
||||
}
|
||||
}
|
||||
ext.findJFXJar = {
|
||||
return searchFile([
|
||||
'jfxrtDir in Gradle Properties': {jfxrtDir},
|
||||
'JFXRT_HOME in System Environment': {System.env['JFXRT_HOME']},
|
||||
'JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
|
||||
'java.home in JVM properties': {System.properties['java.home']}
|
||||
],
|
||||
['jfxrt.jar', 'lib/jfxrt.jar', 'lib/ext/jfxrt.jar', 'jre/lib/jfxrt.jar', 'jre/lib/ext/jfxrt.jar'],
|
||||
'JavaFX Runtime Jar')
|
||||
}
|
||||
|
||||
ext.findAntJavaFXJar = {
|
||||
return searchFile([
|
||||
'jfxrtDir in Gradle Properties': {jfxrtDir},
|
||||
'JFXRT_HOME in System Environment': {System.env['JFXRT_HOME']},
|
||||
'JAVA_HOME in System Environment': {System.env['JAVA_HOME']},
|
||||
'java.home in JVM properties': {System.properties['java.home']}
|
||||
],
|
||||
['ant-javafx.jar', 'lib/ant-javafx.jar', '../lib/ant-javafx.jar'],
|
||||
'JavaFX Packager Tools')
|
||||
}
|
||||
|
||||
|
||||
classpath 'org.bitbucket.shemnon.javafxplugin:gradle-javafx-plugin:8.1.1'
|
||||
classpath project.files(findAntJavaFXJar())
|
||||
classpath project.files(findJFXJar())
|
||||
}
|
||||
}
|
||||
|
||||
if (!project.plugins.findPlugin(org.bitbucket.shemnon.javafxplugin.JavaFXPlugin)) {
|
||||
project.apply(plugin: org.bitbucket.shemnon.javafxplugin.JavaFXPlugin)
|
||||
}
|
Loading…
Reference in New Issue
Block a user