-
Notifications
You must be signed in to change notification settings - Fork 160
/
build.gradle
178 lines (146 loc) · 4.48 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 'java-library'
id 'wrapper'
id 'com.jfrog.bintray' version '1.7.3'
id 'maven-publish'
id 'com.github.sherter.google-java-format' version '0.3.2'
id 'net.ltgt.errorprone' version '0.0.11'
// code coverage support
id 'net.saliman.cobertura' version '2.5.4'
id 'com.github.kt3k.coveralls' version '2.8.2'
}
cobertura.coverageFormats = ['html', 'xml']
// The name of the release we're working on. See RELEASING.md for details.
def versionName = '1.2'
wrapper {
gradleVersion '4.6'
}
sourceCompatibility = 1.6
targetCompatibility = 1.6
repositories {
mavenCentral()
}
sourceSets {
main {
java {
srcDir 'java'
}
}
test {
java {
srcDir 'javatests'
}
resources {
srcDir 'testdata'
}
}
// Having a separate source set for benchmarks allows us to declare benchmark dependencies
// separately from the rest of the project. This is useful because as of today (May 2018),
// Caliper (which runs our benchmarks) has a very old Guava dependency which causes problems
// for the rest of our test code.
benchmarks {
java {
srcDir 'benchmarks'
}
}
}
configurations.benchmarksCompile {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.google.guava' && details.requested.name == 'guava') {
// Force guava 18.0, caliper:1.0-beta-2 requires it but truth:0.36 brings
// in a later version. This override can be removed when caliper is
// updated to a newer version.
details.useVersion '18.0'
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'com.google.gwt:gwt-dev:2.8.2'
testCompile 'com.google.gwt:gwt-user:2.8.2'
testCompile 'com.google.truth:truth:0.36'
// Cobertura requires slf4j at runtime
testRuntime "org.slf4j:slf4j-api:1.7.10"
benchmarksCompile project
benchmarksCompile 'junit:junit:4.12'
benchmarksCompile 'com.google.caliper:caliper:1.0-beta-2'
}
// Use error_prone_core 2.0.5, later versions require Java 8 to build and we'd
// like to support building on Java 7.
configurations.errorprone {
resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.0.5'
}
task benchmarks(type: JavaExec) {
classpath = configurations.benchmarksRuntime + sourceSets.benchmarks.output
main = 'com.google.re2j.Benchmarks'
args = []
}
def releaseVersion = '1.2'
task sourceJar(type: Jar) {
baseName 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc) {
baseName 'javadoc'
from javadoc.destinationDir
}
def appendMavenCentralMetadata(Node node) {
node.appendNode('name', 'RE2/J')
node.appendNode('description', 'Linear time regular expressions for Java')
node.appendNode('url', 'http://github.com/google/re2j')
def license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', 'Go License')
license.appendNode('url', 'https://golang.org/LICENSE')
license.appendNode('distribution', 'repo')
node.appendNode('scm').appendNode('url', 'https://github.com/google/re2j.git')
def developerInfo = node.appendNode('developers').appendNode('developer')
developerInfo.appendNode('id', 'dev')
developerInfo.appendNode('name', 'The RE2/J Contributors')
developerInfo.appendNode('email', 're2j-discuss@googlegroups.com')
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar {
classifier 'sources'
}
artifact javadocJar {
classifier 'javadoc'
}
groupId 'com.google.re2j'
artifactId 're2j'
version releaseVersion
pom.withXml {
appendMavenCentralMetadata(asNode())
}
}
}
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
pkg {
repo = 'maven'
name = 're2j'
userOrg = 're2j'
licenses = ['Go']
vcsUrl = 'https://github.com/google/re2j.git'
version {
name = versionName
desc = "RE2/J ${versionName}"
released = new Date()
vcsTag = "re2j-${versionName}"
}
}
publications = ['mavenJava']
}
// If Java formatter checks fail, tell the user how to fix them.
task printFormatHelperMessage {
doLast {
throw new GradleException('google-java-format is required.\n' +
'Use ./gradlew googleJavaFormat to reformat the broken files')
}
}
verifyGoogleJavaFormat.finalizedBy printFormatHelperMessage
printFormatHelperMessage.onlyIf { verifyGoogleJavaFormat.state.failure != null }