-
Notifications
You must be signed in to change notification settings - Fork 379
/
build.gradle
178 lines (153 loc) · 5.03 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
plugins {
id "signing"
id "maven-publish"
}
apply from: "gradle/versioning.gradle"
group = "org.hamcrest"
version = getMavenVersion()
tasks.register("showVersion") {
group = "Build"
description = "Show the version, as derived from git tags"
doLast {
println("git version: " + getGitVersion())
println("mvn version: " + getMavenVersion())
}
}
subprojects {
apply plugin: 'checkstyle'
apply plugin: 'java-library'
group = rootProject.group
version = rootProject.version
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
checkstyle {
project.ext.checkstyleVersion = '9.3'
//works with a JDK 7 version which is supposed to be supported although
//deprecated, see https://github.com/hamcrest/JavaHamcrest/pull/211 for
//the discussion about the support
sourceSets = [ project.sourceSets.main, project.sourceSets.test ]
ignoreFailures = false
configFile = file("${project.rootDir}/checkstyle.xml")
configurations {
checkstyle
}
dependencies{
assert project.hasProperty("checkstyleVersion")
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
}
}
test {
testLogging {
exceptionFormat = 'full'
}
}
jar {
metaInf {
from rootProject.file('LICENSE')
}
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
}
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:-options'
}
}
def pomConfigurationFor(String pomName, String pomDescription) {
return {
name = pomName
description = pomDescription
url = 'http://hamcrest.org/JavaHamcrest/'
scm {
connection = 'scm:git:https://github.com/hamcrest/JavaHamcrest.git'
developerConnection = 'scm:git:ssh://github.com/hamcrest/JavaHamcrest.git'
url = 'https://github.com/hamcrest/JavaHamcrest'
}
licenses {
license {
name = 'BSD-3-Clause'
url = 'https://raw.githubusercontent.com/hamcrest/JavaHamcrest/master/LICENSE'
}
}
developers {
developer {
id = 'joewalnes'
name = 'Joe Walnes'
}
developer {
id = 'npryce'
name = 'Nat Pryce'
}
developer {
id = 'sf105'
name = 'Steve Freeman'
}
}
}
}
def publishToOssrh = project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')
publishing {
publications {
def hamcrestProject = project(':hamcrest')
hamcrest(MavenPublication) {
from hamcrestProject.components.java
artifactId hamcrestProject.name
artifact hamcrestProject.sourcesJar
artifact hamcrestProject.javadocJar
pom pomConfigurationFor(
'Hamcrest',
'Core API and libraries of hamcrest matcher framework.')
}
def hamcrestCoreProject = project(':hamcrest-core')
hamcrestCore(MavenPublication) {
from hamcrestCoreProject.components.java
artifactId hamcrestCoreProject.name
artifact hamcrestCoreProject.sourcesJar
artifact hamcrestCoreProject.javadocJar
pom pomConfigurationFor(
'Hamcrest Core',
'Core Hamcrest API - deprecated, please use "hamcrest" instead')
}
def hamcrestLibraryProject = project(':hamcrest-library')
hamcrestLibrary(MavenPublication) {
from hamcrestLibraryProject.components.java
artifactId hamcrestLibraryProject.name
artifact hamcrestLibraryProject.sourcesJar
artifact hamcrestLibraryProject.javadocJar
pom pomConfigurationFor(
'Hamcrest Library',
'A library of Hamcrest matchers - deprecated, please use "hamcrest" instead')
}
}
repositories {
if (publishToOssrh) {
maven {
def snapshotRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
def stagingRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
url = version.contains('SNAPSHOT') ? snapshotRepoUrl : stagingRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
}
signing {
required { publishToOssrh }
sign publishing.publications.hamcrest
sign publishing.publications.hamcrestCore
sign publishing.publications.hamcrestLibrary
}