-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
199 lines (163 loc) · 5.76 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
buildscript {
if ("$gradle.gradleVersion" != "6.5") {
throw new GradleException("Gradle version 6.5 is required (received $gradle.gradleVersion)")
}
ext.kotlin_version = "1.4.20"
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "digital.wup:android-maven-publish:3.6.3"
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:5.2.0"
}
}
plugins {
id "ru.vyarus.animalsniffer" version "1.5.0"
id "digital.wup.android-maven-publish" version "3.6.3"
}
ext {
androidBuildToolsVersion = "29.0.2"
androidCompileSDKVersion = 28
androidMinimumSDKVersion = 21
androidTargetSDKVersion = 28
}
ext.libraries = [
androidMaterial : "com.google.android.material:material:1.0.0",
androidSupportTestRules : "com.android.support.test:rules:1.0.2",
androidSupportTestRunner: "com.android.support.test:runner:1.0.2",
androidTestOrchestrator : "com.android.support.test:orchestrator:1.0.2",
androidXActivity : "androidx.activity:activity-ktx:1.0.0-alpha05",
androidXAppCompat : "androidx.appcompat:appcompat:1.1.0-alpha03",
androidXCore : "androidx.core:core-ktx:1.0.1",
androidXConstraintLayout: "androidx.constraintlayout:constraintlayout:1.1.3",
conductor : "com.bluelinelabs:conductor:3.0.0-rc1",
googleGuava : "com.google.guava:guava:27.1-android",
picasso : "com.squareup.picasso:picasso:2.71828",
jUnit : "junit:junit:4.12",
jackson : "com.fasterxml.jackson.core:jackson-core:2.9.8",
jodaTime : "joda-time:joda-time:2.10.1",
kotlinReflect : "org.jetbrains.kotlin:kotlin-reflect:1.3.21",
kotlinStdlib : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version",
logback : "ch.qos.logback:logback-classic:1.3.0-alpha4",
rXJava : "io.reactivex.rxjava2:rxjava:2.2.8",
slf4j : "org.slf4j:slf4j-api:1.8.0-beta4",
]
allprojects {
group = project.ext["GROUP"]
version = project.ext["VERSION_NAME"]
}
def buildVersion(project) {
def propsFile = file("${project}/version.properties")
def Properties props = new Properties()
def code
if (propsFile.canRead()) {
props.load(new FileInputStream(propsFile))
code = props['VERSION_CODE'].toInteger()
} else {
throw new FileNotFoundException("Could not read ${propsFile}")
}
props['VERSION_CODE'] = (code + 1).toString()
props.store(new FileOutputStream(propsFile), "")
logger.info("incrementing build version ${code} -> ${code + 1}")
return code
}
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
versionName = VERSION_NAME
versionCode = buildVersion(project.name)
setProperty("archivesBaseName", "${project.name}-${VERSION_NAME}-${versionCode}")
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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
versionName = VERSION_NAME
versionCode = buildVersion(project.name)
setProperty("archivesBaseName", "${project.name}-${VERSION_NAME}-${versionCode}")
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"
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
google()
}
}
/**
* Empty tasks called by CI. We don't do semantic versioning analysis or linting here yet.
*/
task verifySemanticVersioning {
}
task ktlint {
}