-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
217 lines (179 loc) · 5.4 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
210
211
212
213
214
215
216
217
plugins {
id 'com.diffplug.spotless' version "5.17.1" apply false
id "com.palantir.consistent-versions" version "2.5.0"
}
apply from: file('gradle/min-gradle-version.gradle')
apply from: file('gradle/gitinfo.gradle')
apply from: file('gradle/buildinfo.gradle')
apply plugin: 'base'
def currentVersion = '1.0.7-SNAPSHOT'
ext {
gitRev = gitStatus.id
licenseHeader = file('etc/license-header.txt')
replaceTokens = [
'version': currentVersion,
'gitRev': gitRev,
'buildDate': buildDate,
'buildDateTrimmed': buildDateTrimmed
]
isIdea = System.getProperty("idea.active") != null || gradle.startParameter.taskNames.contains('idea') || gradle.startParameter.taskNames.contains('cleanIdea')
}
allprojects {
apply plugin: 'idea'
group "com.carrotsearch"
version = currentVersion
repositories {
mavenCentral()
}
idea {
module {
outputDir file('build/idea/classes/main')
testOutputDir file('build/idea/classes/test')
downloadSources = true
}
project {
jdkName = '9'
languageLevel = '1.9'
}
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'com.diffplug.spotless'
sourceCompatibility = 1.9
targetCompatibility = 1.9
dependencies {
testImplementation "com.carrotsearch.randomizedtesting:randomizedtesting-runner"
testImplementation "org.assertj:assertj-core"
testImplementation "com.google.guava:guava"
}
spotless {
java {
licenseHeaderFile licenseHeader
lineEndings 'UNIX'
endWithNewline()
googleJavaFormat('1.13.0')
}
}
test {
maxParallelForks = (int) Math.max(Runtime.runtime.availableProcessors() / 2.0, 4.0)
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
options.encoding = "UTF-8"
}
tasks.withType(Jar) {
manifest {
attributes("Implementation-Title": project.name,
"Implementation-Version": "${project.version} (${gitRev}, ${buildDateTrimmed})")
}
}
javadoc {
title = "${project.name} ${project.version} API Documentation"
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
options.addStringOption('Xdoclint:all,-missing', '-noindex')
}
options.encoding = 'UTF-8'
}
afterEvaluate {
check.dependsOn(spotlessCheck)
precommit.dependsOn(spotlessCheck)
tasks.withType(AbstractArchiveTask) {
duplicatesStrategy = 'fail'
}
}
}
task precommit {
description "Runs code quality and other precommit checks"
group "Verification"
}
configure(project) {
apply plugin: 'maven-publish'
apply plugin: 'signing'
def mavenBuildRepo = "${rootProject.buildDir}/maven"
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
repositories {
maven {
name = 'build'
url = mavenBuildRepo
}
maven {
name = 'sonatype'
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
credentials {
if (project.hasProperty('nexusUsername')) {
username project.nexusUsername
}
if (project.hasProperty('nexusPassword')) {
password project.nexusPassword
}
}
}
}
publications {
maven(MavenPublication) {
afterEvaluate {
from components.java
artifactId = project.archivesBaseName
artifact sourcesJar
artifact javadocJar
}
pom {
name = "${project.name}"
description = "${project.name}"
url = 'https://github.com/carrotsearch/procfork'
inceptionYear = "2019"
licenses {
license {
name = 'BSD License'
url = 'https://github.com/carrotsearch/procfork/blob/master/LICENSE.txt'
}
}
organization {
name = "Carrot Search s.c."
url = "https://www.carrotsearch.com"
}
developers {
developer {
id = 'stanislaw.osinski'
name = 'Stanisław Osiński'
email = '[email protected]'
}
developer {
id = 'dawid.weiss'
name = 'Dawid Weiss'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:[email protected]:carrotsearch/procfork.git'
developerConnection = 'scm:git:[email protected]:carrotsearch/procfork.git'
url = 'https://github.com/carrotsearch/procfork'
}
}
}
}
}
signing {
sign publishing.publications.maven
}
afterEvaluate {
task mavenLocal(dependsOn: publishMavenPublicationToBuildRepository) {
group "Publishing"
description "Publish Maven artifacts locally to " + file(mavenBuildRepo)
}
task mavenSonatype(dependsOn: publishMavenPublicationToSonatypeRepository) {
group "Publishing"
description "Publish Maven artifacts to Sonatype OSS Nexus"
}
}
}