-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
143 lines (122 loc) · 4.49 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
/*
* Copyright (c) 2016 deltaDNA Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
ext {
firebaseVersion = '20.2.0'
kotlinVersion = '1.6.10'
kotlinxCoroutinesVersion = '1.3.9'
kotsonVersion = '2.5.0'
mockWebServerVersion = '2.7.5'
supportVersion = '1.0.0-beta01'
logTagName = 'LOG_TAG'
logTagValue = 'deltaDNA'
}
repositories {
google()
maven { url 'https://plugins.gradle.org/m2/' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.2'
classpath "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion"
classpath "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinxCoroutinesVersion"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
def isLibrary = it.name.startsWith('library')
if (isLibrary) {
apply plugin: 'maven-publish'
}
}
subprojects {
def isLibrary = it.name.startsWith('library')
if (isLibrary) {
apply plugin: 'com.android.library'
} else {
apply plugin: 'com.android.application'
}
apply plugin: 'com.google.android.gms.strict-version-matcher-plugin'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
if (isLibrary) {
// workaround for group/version not picked up through project() dependency
group = GROUP
version = VERSION_NAME
}
android {
compileSdkVersion 31
buildToolsVersion '28.0.3'
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 16
targetSdkVersion 31
versionCode 1
versionName VERSION_NAME
buildConfigField('String', logTagName, "\"$logTagValue\"")
buildConfigField('String', "VERSION_NAME", "\"$VERSION_NAME\"")
if (isLibrary) {
archivesBaseName = "${POM_ARTIFACT_ID}-${versionName}.${System.getenv("BUILD_NUMBER") ?: getSha()}"
consumerProguardFiles 'proguard.cfg'
}
}
if (isLibrary) {
sourceSets {
test.java.srcDirs += 'src/test/kotlin'
}
testOptions {
unitTests {
returnDefaultValues = true
includeAndroidResources = true
}
}
}
}
if (isLibrary) {
dependencies {
testImplementation "com.github.salomonbrys.kotson:kotson:$kotsonVersion"
testImplementation 'com.google.truth:truth:0.42'
testImplementation 'com.nhaarman:mockito-kotlin:1.5.0'
testImplementation "com.squareup.okhttp:mockwebserver:$mockWebServerVersion"
testImplementation 'junit:junit:4.13.2'
testImplementation 'nl.jqno.equalsverifier:equalsverifier:2.3.3'
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"
testImplementation 'org.json:json:20180813'
testImplementation 'org.mockito:mockito-core:4.2.0'
testImplementation 'org.robolectric:robolectric:4.7.3'
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion"
}
} else {
dependencies {
api "androidx.appcompat:appcompat:$supportVersion"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
static def getSha() {
return 'git rev-parse --short HEAD'.execute().text.trim()
}