-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
328 lines (278 loc) · 10.6 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/*
* 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 "apk":
logger.info("Configuring ${project} (${POM_PACKAGING}) as Android application project")
apply plugin: "com.android.application"
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
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 "apk":
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()
mavenLocal()
jcenter()
google()
}
configurations {
dependencyAndroidMaterial
dependencyAndroidSupportTestRules
dependencyAndroidSupportTestRunner
dependencyAndroidTestOrchestrator
dependencyAndroidXActivity
dependencyAndroidXAppCompat
dependencyAndroidXCore
dependencyGoogleGuava
dependencyIrradiaHTTPAPI
dependencyIrradiaHTTPImpl
dependencyIrradiaMimeAPI
dependencyIrradiaMimeImpl
dependencyIrradiaOPDS12API
dependencyIrradiaOPDS12Dublin
dependencyIrradiaOPDS12NYPL
dependencyIrradiaOPDS12ParserAPI
dependencyIrradiaOPDS12ParserImpl
dependencyIrradiaServiceDirectoryAPI
dependencyIrradiaServiceDirectoryImpl
dependencyJUnit
dependencyJackson
dependencyJodaTime
dependencyKotlinReflect
dependencyKotlinStdlib
dependencyLogback
dependencyOkHttp
dependencyRXJava
dependencySLF4J
}
dependencies {
def irradiaOPDS12Version = "0.0.4"
def irradiaMIMEVersion = "0.0.6"
def irradiaHTTPVersion = "0.0.1"
def irradiaServiceDirectoryVersion = "0.0.1"
dependencyAndroidMaterial "com.google.android.material:material:1.0.0"
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"
dependencyAndroidXActivity "androidx.activity:activity-ktx:1.0.0-alpha06"
dependencyAndroidXAppCompat "androidx.appcompat:appcompat:1.1.0-alpha04"
dependencyAndroidXCore "androidx.core:core-ktx:1.0.1"
dependencyGoogleGuava "com.google.guava:guava:27.1-android"
dependencyIrradiaHTTPAPI "one.irradia.http:one.irradia.http.api:${irradiaHTTPVersion}"
dependencyIrradiaHTTPImpl "one.irradia.http:one.irradia.http.vanilla:${irradiaHTTPVersion}"
dependencyIrradiaMimeAPI "one.irradia.mime:one.irradia.mime.api:${irradiaMIMEVersion}"
dependencyIrradiaMimeImpl "one.irradia.mime:one.irradia.mime.vanilla:${irradiaMIMEVersion}"
dependencyIrradiaOPDS12API "one.irradia.opds1_2:one.irradia.opds1_2.api:${irradiaOPDS12Version}"
dependencyIrradiaOPDS12Dublin "one.irradia.opds1_2:one.irradia.opds1_2.dublin:${irradiaOPDS12Version}"
dependencyIrradiaOPDS12NYPL "one.irradia.opds1_2:one.irradia.opds1_2.nypl:${irradiaOPDS12Version}"
dependencyIrradiaOPDS12ParserAPI "one.irradia.opds1_2:one.irradia.opds1_2.parser.api:${irradiaOPDS12Version}"
dependencyIrradiaOPDS12ParserImpl "one.irradia.opds1_2:one.irradia.opds1_2.vanilla:${irradiaOPDS12Version}"
dependencyIrradiaServiceDirectoryAPI "one.irradia.servicedirectory:one.irradia.servicedirectory.api:${irradiaServiceDirectoryVersion}"
dependencyIrradiaServiceDirectoryImpl "one.irradia.servicedirectory:one.irradia.servicedirectory.vanilla:${irradiaServiceDirectoryVersion}"
dependencyJUnit "junit:junit:4.12"
dependencyJackson "com.fasterxml.jackson.core:jackson-core:2.9.8"
dependencyJodaTime "joda-time:joda-time:2.10.1"
dependencyKotlinReflect "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
dependencyKotlinStdlib "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
dependencyLogback "ch.qos.logback:logback-classic:1.3.0-alpha4"
dependencyOkHttp "com.squareup.okhttp3:okhttp:3.14.1"
dependencyRXJava "io.reactivex.rxjava2:rxjava:2.2.8"
dependencySLF4J "org.slf4j:slf4j-api:1.8.0-beta4"
}
}