This repository has been archived by the owner on Apr 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
254 lines (211 loc) · 7.08 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
/*
* Copyright © 2019 <[email protected]> http://www.irradia.one
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
buildscript {
if ("$gradle.gradleVersion" != "5.2.1") {
throw new GradleException("Gradle version 5.2.1 is required (received $gradle.gradleVersion)")
}
ext.kotlin_version = "1.3.30"
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.4.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "digital.wup:android-maven-publish:3.6.2"
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.20.0"
classpath "com.vanniktech:gradle-android-junit-jacoco-plugin:0.13.0"
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0"
}
}
plugins {
id "ru.vyarus.animalsniffer" version "1.5.0"
id "io.codearte.nexus-staging" version "0.20.0"
id "com.vanniktech.android.junit.jacoco" version "0.13.0"
id "digital.wup.android-maven-publish" version "3.6.2"
}
ext {
androidBuildToolsVersion = "28.0.3"
androidCompileSDKVersion = 28
androidMinimumSDKVersion = 21
androidTargetSDKVersion = 28
if (!project.hasProperty("nexusUsername")) {
logger.warn("No nexusUsername property specified: Using an empty value")
nexusUsername = ""
}
if (!project.hasProperty("nexusPassword")) {
logger.warn("No nexusPassword property specified: Using an empty value")
nexusPassword = ""
}
}
apply plugin: "io.codearte.nexus-staging"
apply plugin: "com.vanniktech.android.junit.jacoco"
nexusStaging {
packageGroup = "one.irradia"
numberOfRetries = 32
delayBetweenRetriesInMillis = 2000
}
allprojects {
group = project.ext["GROUP"]
version = project.ext["VERSION_NAME"]
}
subprojects { project ->
switch (POM_PACKAGING) {
case "jar":
logger.info("Configuring ${project} (${POM_PACKAGING}) as jar project")
apply plugin: "java"
apply plugin: "java-library"
apply plugin: "kotlin"
/*
* Apply the Animal Sniffer plugin to check that code is Android compatible.
*/
apply plugin: "ru.vyarus.animalsniffer"
dependencies {
signature "org.codehaus.mojo.signature:java16:1.1@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
}
/*
* Build an OSGi bundle.
*/
apply plugin: "biz.aQute.bnd.builder"
jar {
bnd """
Automatic-Module-Name: ${POM_AUTOMATIC_MODULE_NAME}
-removeheaders: Bnd-LastModified, Tool, Private-Package
"""
}
break
case "aar":
logger.info("Configuring ${project} (${POM_PACKAGING}) as Android library project")
apply plugin: "com.android.library"
apply plugin: "kotlin-android"
android {
compileSdkVersion androidCompileSDKVersion
buildToolsVersion androidBuildToolsVersion
defaultConfig {
minSdkVersion androidMinimumSDKVersion
targetSdkVersion androidTargetSDKVersion
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
execution "ANDROID_TEST_ORCHESTRATOR"
animationsDisabled = true
}
}
break
default:
throw new IllegalStateException(
"Unrecognized packaging type ${POM_PACKAGING} for ${project}")
}
task javadocsJar(type: Jar) {
classifier = "javadoc"
}
task sourcesJar(type: Jar) {
classifier = "sources"
from "src/main/java", "src/main/resources"
}
apply plugin: "digital.wup.android-maven-publish"
apply plugin: "signing"
publishing {
publications {
basicJar(MavenPublication) {
switch (POM_PACKAGING) {
case "jar":
from components.java
break
case "aar":
from components.android
break
}
artifact sourcesJar
artifact javadocsJar
pom {
artifactId = POM_ARTIFACT_ID
name = POM_NAME
packaging = POM_PACKAGING
description = POM_DESCRIPTION
url = POM_URL
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
url = POM_DEVELOPER_URL
}
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
credentials(PasswordCredentials) {
username nexusUsername
password nexusPassword
}
}
}
}
signing {
useGpgCmd()
sign publishing.publications.basicJar
}
repositories {
mavenCentral()
jcenter()
google()
}
configurations {
dependencyOSGiBundleAnnotation
dependencyGoogleGuava
dependencyKotlinReflect
dependencyKotlinStdlib
dependencyJUnit
dependencyAndroidSupportTestRules
dependencyAndroidSupportTestRunner
dependencyAndroidTestOrchestrator
dependencySLF4J
}
dependencies {
dependencyOSGiBundleAnnotation "org.osgi:org.osgi.annotation.bundle:1.0.0"
dependencyKotlinReflect "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
dependencyKotlinStdlib "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
dependencyGoogleGuava "com.google.guava:guava:27.1-android"
dependencyJUnit "junit:junit:4.12"
dependencyAndroidSupportTestRules "com.android.support.test:rules:1.0.2"
dependencyAndroidSupportTestRunner "com.android.support.test:runner:1.0.2"
dependencyAndroidTestOrchestrator "com.android.support.test:orchestrator:1.0.2"
dependencySLF4J "org.slf4j:slf4j-api:1.8.0-beta4"
}
}