forked from hamcrest/JavaHamcrest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
153 lines (131 loc) · 4.52 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
apply plugin: 'signing'
apply plugin: 'osgi'
apply plugin: 'maven-publish'
group = "org.hamcrest"
version = "2.3-SNAPSHOT"
subprojects {
apply plugin: 'checkstyle'
apply plugin: 'java-library'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
}
checkstyle {
project.ext.checkstyleVersion = '6.18'
//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'
}
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
}
def pomConfigurationFor(String pomName, String pomDescription) {
return {
name = pomName
description = pomDescription
url = 'http://hamcrest.org/JavaHamcrest/'
scm {
connection = 'scm:git:git://github.com:hamcrest/JavaHamcrest.git'
developerConnection = 'scm:git:ssh://github.com:hamcrest/JavaHamcrest.git'
url = 'https://github.com/hamcrest/JavaHamcrest'
}
licenses {
license {
name = 'BSD License 3'
url = 'http://opensource.org/licenses/BSD-3-Clause'
}
}
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
}