-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjavafx.gradle
81 lines (59 loc) · 1.88 KB
/
javafx.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// source: http://ryansblog.jptech.ca/2012/12/javafx-and-gradle.html
import groovy.xml.NamespaceBuilder
assert project.plugins.findPlugin(JavaPlugin):
"The Java plugin must be applied before using javafx7.gradle."
assert project.plugins.findPlugin(ApplicationPlugin):
"The Application plugin must be applied before using javafx7.gradle."
def javaHome = System.properties['java.home']
logger.warn("Project '$project.name' is using fx:jar. " +
"Disabling startScripts, installApp.")
configurations {
jfxrt
jfxant
sourceSets {
main {
compileClasspath += configurations.jfxrt
}
}
}
dependencies {
println("dependendcies: ")
ext.jfxrt_temp="$javaHome" + "/lib/jfxrt.jar"
jfxrt files(ext.jfxrt_temp)
println(ext.jfxrt_temp)
ext.jfxant_temp="$javaHome" + "/../lib/ant-javafx.jar"
jfxant files(ext.jfxant_temp)
println(ext.jfxant_temp)
}
run.classpath.add(configurations.jfxrt)
jar {
//destinationDir=file("$buildDir")
actions = []
def appId = project.name
def fallbackClassName = 'com.javafx.main.NoJavaFXFallback'
def antfx = NamespaceBuilder.newInstance(
ant,
'javafx:com.sun.javafx.tools.ant')
ant.taskdef(
resource: 'com/sun/javafx/tools/ant/antlib.xml',
uri: 'javafx:com.sun.javafx.tools.ant',
classpath: configurations.jfxant.asPath)
doLast {
antfx.application(
id: appId,
name: project.name,
mainClass: mainClassName,
fallbackClass: fallbackClassName)
antfx.jar(destfile: archivePath) {
application(refid: appId)
fileset(dir: sourceSets.main.output.classesDir)
fileset(dir: sourceSets.main.output.resourcesDir)
}
}
}
startScripts {
enabled = true
}
installApp {
enabled = false
}