-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
212 lines (197 loc) · 7.1 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
buildscript {
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
plugins {
id 'com.gradle.build-scan' version '2.0.2' // declare before any other plugin
id 'com.google.osdetector' version '1.4.0'
id "com.github.hierynomus.license" version '0.15.0'
id 'com.github.sherter.google-java-format' version '0.8' apply false
id 'me.champeau.gradle.jmh' version '0.4.7' apply false
id 'io.morethan.jmhreport' version '0.6.2.1' apply false
id 'io.spring.dependency-management' version '1.0.7.RELEASE' apply false
id 'com.google.protobuf' version '0.8.8' apply false
id 'com.palantir.git-version' version '0.12.0-rc2'
}
//buildScan { licenseAgreementUrl = 'https://gradle.com/terms-of-service'; licenseAgree = 'yes' }
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
// TODO: make this a Gradle plugin someday
def details = versionDetails()
def versionSuffix = ""
def buildNumber = "${System.getenv("BUILD_NUMBER") ?: "dev"}"
def tmpUniqueVersion = "${project.version}"
if (details.branchName != null) {
if (details.branchName == "master") {
// Master should never have a suffix
} else if (details.branchName == "develop") {
versionSuffix = "-SNAPSHOT"
tmpUniqueVersion += "-${buildNumber}-SNAPSHOT"
} else if (details.branchName.startsWith("release")) {
versionSuffix = "-${buildNumber}-RC"
tmpUniqueVersion += "-${buildNumber}-RC"
} else {
versionSuffix = "-${details.branchName.replace("/", "-")}-SNAPSHOT"
tmpUniqueVersion += "-${details.branchName.replace("/", "-")}-${buildNumber}-SNAPSHOT"
}
}
allprojects {
dependencyLocking {
lockAllConfigurations()
}
project.version += versionSuffix
ext {
uniqueVersion = "${tmpUniqueVersion}"
}
}
subprojects {
apply from: "../dependency-management.gradle"
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'com.github.sherter.google-java-format'
apply plugin: 'maven-publish'
apply plugin: 'license'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
maven {
url 'https://nexus.netifi.com/repository/jcenter/'
credentials {
username = "${netifiReadOnlyUsername}"
password = "${netifiReadOnlyPassword}"
}
}
maven {
url 'https://nexus.netifi.com/repository/maven-central/'
credentials {
username = "${netifiReadOnlyUsername}"
password = "${netifiReadOnlyPassword}"
}
}
// maven {
// url 'https://nexus.netifi.com/repository/netifi-oss/'
// credentials {
// username = "${netifiReadOnlyUsername}"
// password = "${netifiReadOnlyPassword}"
// }
// }
maven {
url 'https://nexus.netifi.com/repository/maven-releases/'
credentials {
username = "${netifiReadOnlyUsername}"
password = "${netifiReadOnlyPassword}"
}
}
maven {
url 'https://nexus.netifi.com/repository/maven-snapshots/'
credentials {
username = "${netifiReadOnlyUsername}"
password = "${netifiReadOnlyPassword}"
}
}
maven {
url 'https://nexus.netifi.com/repository/spring-libs-snapshot/'
credentials {
username = "${netifiReadOnlyUsername}"
password = "${netifiReadOnlyPassword}"
}
}
maven {
url 'https://nexus.netifi.com/repository/jcenter-oss-snapshot/'
credentials {
username = "${netifiReadOnlyUsername}"
password = "${netifiReadOnlyPassword}"
}
}
maven {
url 'https://nexus.netifi.com/repository/jcenter-oss-release/'
credentials {
username = "${netifiReadOnlyUsername}"
password = "${netifiReadOnlyPassword}"
}
}
}
googleJavaFormat {
toolVersion = '1.6'
exclude '**/generated'
}
// Build Source Jars
def sourcesJarMap = [name: 'sourcesJar', type: Jar, dependsOn: classes]
project.tasks.create(sourcesJarMap, {
classifier = 'sources'
from sourceSets.main.allSource
version = "${project.version}"
})
// Build Javadoc Jars
def javadocJarMap = [name: 'javadocJar', type: Jar, dependsOn: javadoc]
project.tasks.create(javadocJarMap, {
classifier = 'javadoc'
from javadoc.destinationDir
version = "${project.version}"
})
artifacts {
archives sourcesJar
archives javadocJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = 'Netifi Java'
description = 'A collection of java libraries for Netifi'
url = 'https://www.netifi.com/'
organization {
name = 'Netifi, Inc.'
url = 'https://www.netifi.com'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'Support'
name = 'Netifi Engineering'
email = 'support@netifi.com'
}
}
scm {
connection = 'scm:git:git://github.com/netifi/netifi-java.git'
developerConnection = 'scm:git:ssh://github.com/netifi/netifi-java.git'
url = 'http://github.com/netifi/netifi-java/'
}
issueManagement {
system = "GitHub Issues"
url = "https://github.com/netifi/netifi-java/issues"
}
}
}
}
repositories {
maven {
def releasesRepoUrl = 'https://nexus.netifi.com/repository/maven-releases/'
def snapshotsRepoUrl = 'https://nexus.netifi.com/repository/maven-snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = "${netifiPublishUsername}"
password = "${netifiPublishPassword}"
}
}
}
}
license {
header rootProject.file('resources/HEADER')
strictCheck true
excludes(["**/*.xml", "**/*.json", "**/*.properties"])
}
license.mapping('java', 'SLASHSTAR_STYLE')
task allDeps(type: DependencyReportTask) {}
}