forked from groovyfx-project/groovyfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·128 lines (114 loc) · 4.11 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'org.asciidoctor.convert'
sourceCompatibility = 1.8
targetCompatibility = 1.8
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
}
final javafxHome = System.env['JAVAFX_HOME']
if (javafxHome) {
project.ext.javafxJar = "${javafxHome}/rt/lib/jfxrt.jar"
if (!(new File(project.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?
project.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()) {
project.ext.javafxJar = jfxrt8Jar.canonicalPath
} else if (jfxrt7Jar.exists()) {
project.ext.javafxJar = jfxrt7Jar.canonicalPath
}
}
}
try {
println "JavaFX runtime jar: ${project.ext.javafxJar}"
dependencies {
classpath files(project.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
}
}
project.ext.actualJavaFXVersion = com.sun.javafx.runtime.VersionInfo.runtimeVersion
if (! project.ext.actualJavaFXVersion =~ groovyfx_requiredJavaFxVersion) {
println " Required JavaFX version is '${groovyfx_requiredJavaFxVersion}' but actual version is '${project.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 "org.ow2.asm:asm:${groovyfx_asmVersion}"
compile files(project.ext.javafxJar)
testCompile "junit:junit:${groovyfx_junitVersion}"
println "Groovy: ${groovyfx_groovyVersion}; ASM: ${groovyfx_asmVersion}; JUnit: ${groovyfx_junitVersion}"
}
jar.baseName = 'groovyfx'
task wrap(type:Wrapper, description:"create a gradlew") {
gradleVersion = '2.6'
}
apply {
from 'buildSrc/scripts/demo.gradle'
from 'buildSrc/scripts/mavenCentralDeploy.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'])
}
}
}
}
asciidoctor {
//sources { include 'index.adoc' }
attributes toc: 'left',
doctype: 'book',
icons: 'font',
encoding: 'utf-8',
sectlink: true,
sectanchors: true,
numbered: true,
linkattrs: true,
imagesdir: 'images',
stylesheet: 'css/style.css',
'source-highlighter': 'coderay',
'groovyfx-version': project.version
}