forked from groovyfx-project/groovyfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·103 lines (92 loc) · 3.35 KB
/
build.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'idea'
apply plugin: 'eclipse'
sourceCompatibility = 1.6
targetCompatibility = 1.6
buildscript {
final javafxHome = System.env['JAVAFX_HOME']
if (javafxHome) {
ext.javafxJar = "${javafxHome}/rt/lib/jfxrt.jar"
if (!(new File(ext.javafxJar).exists())) {
// If JAVAFX_HOME/rt/lib/jfxrt.jar doesn't exist, maybe the user
// is pointing at the directory containing jfxrt.jar itself?
ext.javafxJar = "${javafxHome}/jfxrt.jar"
}
} else {
final javaHome = System.env['JAVA_HOME']
if (javaHome) {
File jfxrt7Jar = new File("${javaHome}/jre/lib/jfxrt.jar")
File jfxrt8Jar = new File("${javaHome}/jre/lib/ext/jfxrt.jar")
if (jfxrt8Jar.exists()) {
ext.javafxJar = jfxrt8Jar.canonicalPath
} else if (jfxrt7Jar.exists()) {
ext.javafxJar = jfxrt7Jar.canonicalPath
}
}
}
try {
println "JavaFX runtime jar: ${ext.javafxJar}"
dependencies {
classpath files(ext.javafxJar)
}
} catch (MissingPropertyException mpe) {
println """|
| Please set the environment variable JAVAFX_HOME
| to the directory that contains rt/lib/jfxrt.jar
| of JavaFX version ${groovyfx_requiredJavaFxVersion}.\n""".stripMargin('|')
System.exit 1
}
}
ext.actualJavaFXVersion = com.sun.javafx.runtime.VersionInfo.runtimeVersion
if (! ext.actualJavaFXVersion =~ groovyfx_requiredJavaFxVersion) {
println " Required JavaFX version is '${groovyfx_requiredJavaFxVersion}' but actual version is '${ext.actualJavaFXVersion}'"
System.exit 1
}
repositories {
if (project.hasProperty('groovyfx_useMavenLocal') && Boolean.valueOf(project.groovyfx_useMavenLocal)) { mavenLocal() }
mavenCentral()
}
dependencies {
compile "org.codehaus.groovy:groovy-all:${groovyfx_groovyVersion}"
compile "asm:asm:${groovyfx_asmVersion}"
compile files(ext.javafxJar)
testCompile "junit:junit:${groovyfx_junitVersion}"
}
jar.baseName = 'groovyfx'
task wrap(type:Wrapper, description:"create a gradlew") {
gradleVersion = '1.10'
}
apply {
from 'buildSrc/scripts/demo.gradle'
from 'buildSrc/scripts/mavenCentralDeploy.gradle'
from 'buildSrc/scripts/docsDependencies.gradle'
from 'buildSrc/scripts/docs.gradle'
}
signArchives.onlyIf {
project.hasProperty('signing.keyId')
}
uploadArchives.onlyIf {
project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
}
idea {
module {
excludeDirs += file('gradle/') // Gradle directory including the wrapper subdirectory.
excludeDirs += file('.settings/') // Eclipse settings directory.
excludeDirs += file('bin') // Eclipse compilation directory.
excludeDirs += file('out') // IDEA compilation directory.
excludeDirs += file('build') // Gradle compilation directory.
}
project {
ipr {
withXml { provider ->
final node =provider.asNode()
final component = provider.asNode().component
node.component.find { it.'@name' == 'VcsDirectoryMappings' }.mapping[0].'@vcs' = 'Git'
final gradleSettings = node.appendNode('component' , [name: 'GradleSettings'])
gradleSettings.appendNode('option', [name: 'linkedProjectPath', value: '$PROJECT_DIR$/build.gradle'])
}
}
}
}