-
Notifications
You must be signed in to change notification settings - Fork 59
/
build.gradle
191 lines (170 loc) · 6.41 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
* Copyright 2016 Danny Althoff
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.gradle.plugins.signing.Sign
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'checkstyle'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile gradleApi()
testCompile gradleTestKit()
testCompile group: 'org.testng', name: 'testng', version: '6.10'
// java 8
if( file("${System.properties['java.home']}/../lib/ant-javafx.jar").exists() ){
compile files("${System.properties['java.home']}/../lib/ant-javafx.jar")
}
// java 9
if( file("${System.properties['java.home']}/lib/ant-javafx.jar").exists() ){
compile files("${System.properties['java.home']}/lib/ant-javafx.jar")
}
compile 'org.ow2.asm:asm-all:5.1'
runtime 'org.ow2.asm:asm-all:5.1'
}
group = 'de.dynamicfiles.projects.gradle.plugins'
archivesBaseName = 'javafx-gradle-plugin'
version = gradle.javafxGradlePluginVersion
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
// http://stackoverflow.com/a/22991189/1961102
compileJava.dependsOn 'checkstyle'
task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
configProperties.checkstyleConfigDir = file("${project.rootDir}/config/checkstyle")
source 'src'
include '**/*.java'
classpath = files()
}
test {
useTestNG()
testLogging.showStandardStreams = true
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
signing {
required { isReleaseVersion }
sign configurations.archives
}
// read some information when required
// https://docs.gradle.org/current/userguide/signing_plugin.html
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign } && isReleaseVersion ) {
// Use Java 6's console to read from the console (no good for
// a CI environment)
Console console = System.console()
console.printf "\n\nWe have to sign some things in this build." +
"\n\nPlease enter your signing details.\n\n"
def password = console.readPassword("PGP Private Key Password: ")
allprojects { ext."signing.password" = password }
console.printf "\nThanks.\n\n"
}
}
// http://stackoverflow.com/a/27741137/1961102
if(!hasProperty('ossrhUsername')) {
ext.ossrhUsername = ''
}
if(!hasProperty('ossrhPassword')) {
ext.ossrhPassword = ''
}
uploadArchives {
repositories {
mavenDeployer {
if(isReleaseVersion) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name 'javafx-gradle-plugin'
packaging 'jar'
description 'The JavaFX Gradle Plugin provides a way to to assemble distributable bundles for JavaFX applications from within Gradle. It provides a wrapper around the JavaFX packaging tools which are provided as part of the JavaFX installation.'
url 'https://github.com/FibreFoX/javafx-gradle-plugin'
scm {
connection 'scm:git:git://github.com/FibreFoX/javafx-gradle-plugin.git'
developerConnection 'scm:git:[email protected]:FibreFoX/javafx-gradle-plugin.git'
url 'https://github.com/FibreFoX/javafx-gradle-plugin'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'FibreFoX'
name 'Danny Althoff'
email '[email protected]'
}
}
profiles {
profile {
id 'java9-dependencies'
activation {
file {
exists '${java.home}/lib/ant-javafx.jar'
}
}
dependencies {
dependency {
groupId 'javafx-packager'
artifactId 'javafx-packager'
version '9'
scope 'system'
systemPath '${java.home}/lib/ant-javafx.jar'
}
}
}
profile {
id 'java8-dependencies'
activation {
file {
exists '${java.home}/../lib/ant-javafx.jar'
}
}
dependencies {
dependency {
groupId 'javafx-packager'
artifactId 'javafx-packager'
version '1.8'
scope 'system'
systemPath '${java.home}/../lib/ant-javafx.jar'
}
}
}
}
}
}
}
}