forked from cuppa-framework/cuppa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
184 lines (153 loc) · 4.61 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
plugins {
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.6.3'
}
allprojects {
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'jacoco'
group = 'org.forgerock.cuppa'
version = '1.3.1'
repositories {
mavenLocal()
mavenCentral()
}
ext {
coverageProjects = [':cuppa', ':cuppa-junit'].collect { project(it) }
}
}
if (!project.hasProperty("sonatypeUsername") || !project.hasProperty("sonatypePassword")) {
ext.sonatypeUsername = ""
ext.sonatypePassword = ""
}
subprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
provided
}
sourceSets {
main {
compileClasspath += configurations.provided
}
test {
compileClasspath += configurations.provided
}
}
javadoc {
options.stylesheetFile = new File(rootDir, "docs/css/javadoc.css")
classpath += configurations.provided
}
dependencies {
testCompile (group: 'org.testng', name: 'testng', version:'6.9.9') {
exclude module: 'junit'
}
testCompile group: 'org.assertj', name: 'assertj-core', version:'3.2.0'
testCompile group: 'org.mockito', name: 'mockito-all', version:'1.10.19'
checkstyle 'com.puppycrawl.tools:checkstyle:6.15'
}
checkstyle {
configFile = new File(rootDir, "config/checkstyle/checkstyle.xml")
configProperties['samedir'] = new File(rootDir, "config/checkstyle")
}
test {
classpath += configurations.provided
useTestNG()
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from 'build/docs/javadoc'
classifier = 'javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'Cuppa'
packaging 'jar'
description 'Cuppa - A testing framework for Java 8'
url 'http://cuppa.forgerock.org'
scm {
url 'https://github.com/cuppa-framework/cuppa'
connection 'scm:git@github.com:cuppa-framework/cuppa.git'
developerConnection 'scm:git@github.com:cuppa-framework/cuppa.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'phillcunnington'
name 'Phill Cunnington'
}
developer {
id 'joebandenburg'
name 'Joe Bandenburg'
}
}
}
}
}
}
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(uploadArchives)) {
// Use Java 6's console to read from the console (no good for
// a CI environment)
Console console = System.console()
if (!console) {
logger.error "Could not get console. Are you running in daemon mode? Use --no-daemon"
}
console.printf "\n\nWe have to sign some things in this build." +
"\n\nPlease enter your signing details.\n\n"
def id = console.readLine("PGP Key Id: ")
def file = console.readLine("PGP Secret Key Ring File (absolute path): ")
def password = console.readPassword("PGP Private Key Password: ")
allprojects { ext."signing.keyId" = id }
allprojects { ext."signing.secretKeyRingFile" = file }
allprojects { ext."signing.password" = password }
console.printf "\nThanks.\n\n"
}
}
coveralls {
sourceDirs = files(coverageProjects.sourceSets.main.allSource.srcDirs).files.absolutePath
}
task jacocoRootReport(type: JacocoReport) {
dependsOn = coverageProjects.jacocoTestReport
sourceDirectories = files(coverageProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(coverageProjects.sourceSets.main.output)
executionData = files(coverageProjects.jacocoTestReport.executionData)
reports {
xml.enabled = true
xml.destination = "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}