forked from Devskiller/jfairy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
209 lines (188 loc) · 5.34 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'uploadAuth'
apply plugin: "sonar-runner"
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'pitest'
apply plugin: 'idea'
apply plugin: 'axion-release'
project.version = scmVersion.version
ext.isReleaseVersion = !project.version.endsWith("SNAPSHOT")
ext.shouldJacocoBeEnabled = determineIfJacocoShouldBeEnabled()
sourceCompatibility = 1.6
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.0.0'
classpath 'org.hibernate.build.gradle:gradle-upload-auth-plugin:1.1.1'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
classpath 'pl.allegro.tech.build:axion-release-plugin:0.9.3'
}
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compile 'org.yaml:snakeyaml:[1.9,2.0)'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'com.google.guava:guava:[15.0,)'
compile 'org.slf4j:slf4j-api:1.7.7'
compile 'joda-time:joda-time:2.3'
compile 'com.google.inject:guice:3.0'
compile 'com.google.inject.extensions:guice-assistedinject:3.0'
compile 'org.iban4j:iban4j:2.1.1'
testCompile 'commons-validator:commons-validator:1.4.0'
testCompile 'ch.qos.logback:logback-classic:1.1.2'
testCompile 'org.codehaus.groovy:groovy-all:2.3.4'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
testCompile 'cglib:cglib-nodep:2.2.2'
testCompile 'org.objenesis:objenesis:2.1'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourceJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives jar
archives sourceJar
archives javadocJar
}
jar {
manifest {
attributes(
"Application-Name": "jFairy",
"Implementation-Title": "jFairy",
"Implementation-Version": version,
"Implementation-Vendor": 'Codearte',
'Built-Date': new Date(),
'Built-JDK': System.properties['java.version'],
'Built-Gradle': gradle.gradleVersion,
"Built-By": System.properties['user.name'])
}
}
if (isReleaseVersion) {
//activate signing only for release versions (it is not needed for 'gradle install')
apply plugin: 'signing'
signing {
sign configurations.archives
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof org.gradle.plugins.signing.Sign }) {
if (!project.hasProperty("signing.keyId") || !project.hasProperty("signing.secretKeyRingFile")) {
throw new GradleException("signing.keyId and signing.secretKeyRingFile has to be configured (e.g. in ~/.gradle/gradle.properties)")
}
Console console = System.console()
if (console && !project.hasProperty("signing.password")) {
def keyPassword = console.readPassword("\nEnter a private key password: ")
ext."signing.password" = keyPassword
} else if (!project.hasProperty("signing.password")) {
throw new GradleException("No signing.password configured (e.g. in ~/.gradle/gradle.properties). Also unable to get console. Make sure to not running a signing task in a daemon mode (e.g. use --no-daemon).")
}
}
}
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
name = 'Sonatype OSS'
beforeDeployment {
if (isReleaseVersion) {
signing.signPom it
}
}
pom.project {
name 'jFairy'
description 'jFairy - Java fake data generator'
packaging 'jar'
url 'http://www.jfairy.org'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0'
distribution 'repo'
}
}
developers {
developer {
id 'jkubrynski'
name 'Jakub Kubryński'
email 'jkubrynski ATT gmail DOTT com'
roles {
role 'despot'
role 'developer'
}
}
developer {
id 'mariuszs'
name 'Mariusz Smykuła'
email 'mariuszs ATT gmail DOTT com'
roles {
role 'despot'
role 'developer'
}
}
developer {
id 'szpak'
name 'Marcin Zajączkowski'
email 'mszpak ATT wp DOTT pl'
roles {
role 'despot'
role 'developer'
}
}
}
scm {
connection 'scm:git:[email protected]:Codearte/jfairy.git'
developerConnection 'scm:git:[email protected]:Codearte/jfairy.git'
url 'https://github.com/Codearte/jfairy'
}
}
}
}
}
sonarRunner {
sonarProperties {
property "sonar.host.url", "http://localhost:9000"
property "sonar.jdbc.url", "jdbc:mysql://mysql/sonar"
property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
property "sonar.jdbc.username", "sonar"
}
}
pitest {
threads = 4
}
test {
ignoreFailures = true
jacoco {
//Required to not measure code coverage in normal builds
enabled = shouldJacocoBeEnabled
}
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled true
}
}
wrapper {
gradleVersion '2.2'
}
boolean determineIfJacocoShouldBeEnabled() {
//MZA: A little bit fragile, Better ideas are welcome.
def shouldBeEnabled = gradle.startParameter.taskNames.contains("sonarRunner") || gradle.startParameter.taskNames.contains("jacocoTestReport")
logger.debug "Is JaCoCo enabled: $shouldBeEnabled"
shouldBeEnabled
}