-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
164 lines (135 loc) · 4.7 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
plugins {
// https://github.com/researchgate/gradle-release
id 'net.researchgate.release' version '2.3.5'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: 'maven'
apply plugin: 'signing'
sourceCompatibility = 1.7
group = "org.dstadler"
archivesBaseName = "commons-test"
repositories {
mavenCentral()
}
eclipse {
project {
name = "commons-test.git"
}
}
dependencies {
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.dstadler:commons-dost:1.0.0.14'
// dumbster is somewhat broken, but we use it in SafeCloseSmtpServer...
compile 'javax.activation:activation:1.1.1' // dumbster includes 1.0.2, but this has no jar?!
compile 'javax.mail:javax.mail-api:1.5.4' // dumbster includes 1.3.2, but this has no jar?!
compile 'javax.mail:mail:1.4.7' // dumbster includes 1.3.2, but this has no jar?!
compile 'dumbster:dumbster:1.6'
// for TestHelpers we need junit during normal compile...
compile "junit:junit:[4.12,)"
testCompile 'org.apache.commons:commons-email:1.4'
}
// work around unnecessary timestamp in generated file which always causes dirty files in version control
// https://issues.gradle.org/browse/GRADLE-2293
task adjustEclipseSettingsFile << {
ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
fileset(dir: project.projectDir, includes: '.settings/org.eclipse.jdt.core.prefs,.settings/com.google.gdt.eclipse.core.prefs')
}
}
task sortEclipseSettingsFile << {
new File(project.projectDir, '.settings/org.eclipse.jdt.core.prefs').with { it.text = it.readLines().findAll { it }.sort().join('\n') }
new File(project.projectDir, '.classpath').with { it.text = it.readLines().findAll { it }.unique().join('\n') }
File file = new File(project.projectDir, '.settings/com.google.gdt.eclipse.core.prefs');
if(file.exists()) {
file.with { it.text = it.readLines().findAll { it }.sort().join('\n') }
}
ant.fixcrlf(srcDir: '.settings', eol: 'lf')
}
eclipseJdt.finalizedBy adjustEclipseSettingsFile
eclipseJdt.finalizedBy sortEclipseSettingsFile
task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}
task adjustWrapperPropertiesFile << {
ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
fileset(dir: project.projectDir, includes: 'gradle/wrapper/gradle-wrapper.properties')
}
new File(project.projectDir, 'gradle/wrapper/gradle-wrapper.properties').with { it.text = it.readLines().findAll { it }.sort().join('\n') }
ant.fixcrlf(file: 'gradle/wrapper/gradle-wrapper.properties', eol: 'lf')
}
wrapper.finalizedBy adjustWrapperPropertiesFile
test {
systemProperties = System.properties
// enable to show standard out and standard error of the test JVM(s) on the console
// testLogging.showStandardStreams = true
// http://forums.gradle.org/gradle/topics/jacoco_related_failure_in_multiproject_build
systemProperties['user.dir'] = workingDir
}
jacoco {
toolVersion = '0.7.6.201602180812'
}
jacocoTestReport {
reports {
xml.enabled true
}
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
artifacts {
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
}
//provide defaults so we do not need to specify them always
if (!project.hasProperty("ossrhUsername")) {
ext.ossrhUsername = ""
}
if (!project.hasProperty("ossrhPassword")) {
ext.ossrhPassword = ""
}
uploadArchives {
repositories {
mavenDeployer {
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 'Common Test Utilities'
packaging 'jar'
// optionally artifactId can be defined here
description 'Common testing utilities I find useful in many of my projects.'
url 'https://github.com/centic9/commons-test'
scm {
connection 'scm:[email protected]:centic9/commons-test.git'
developerConnection 'scm:[email protected]:centic9/commons-test.git'
url 'https://github.com/centic9/commons-test'
}
licenses {
license {
name 'BSD 2-Clause License'
url 'http://www.opensource.org/licenses/bsd-license.php'
}
}
developers {
developer {
id 'centic9 '
name 'Dominik Stadler'
}
}
}
}
}
}
afterReleaseBuild.dependsOn uploadArchives