-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
164 lines (139 loc) · 5.19 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
/*
* 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 {
kotlinVersion = '1.2.51'
multidexVersion = '1.0.3'
// needs to match version in provider-admob/gradle.properties
playServicesVersion = '15.0.1'
supportVersion = '26.1.0'
logTagName = 'LOG_TAG'
logTagValue = 'deltaDNA Ads'
}
repositories {
jcenter()
google()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-beta04'
classpath('com.dicedmelon.gradle:jacoco-android:0.1.2') {
// https://github.com/arturdm/jacoco-android-gradle-plugin/issues/42
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
classpath 'org.jacoco:org.jacoco.core:0.8.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
allprojects {
repositories {
jcenter()
google()
maven { url 'https://deltadna.bintray.com/android' }
maven { url 'https://dl.bintray.com/ironsource-mobile/android-sdk' }
maven { url 'https://raw.githubusercontent.com/HyprMXMobile/Android-SDKs/master' }
maven { url 'https://s3.amazonaws.com/moat-sdk-builds' }
maven { url 'https://tapjoy.bintray.com/maven' }
}
}
subprojects {
def isProvider = it.name.startsWith('provider')
def isLibrary = it.name.startsWith('library') || isProvider
if (isLibrary) {
apply plugin: 'com.android.library'
apply plugin: 'jacoco-android'
} else {
apply plugin: 'com.android.application'
}
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 26
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName VERSION_NAME
if (isProvider) {
def logTagValue = "$logTagValue $PROVIDER_NAME".take(23)
buildConfigField('String', logTagName, "\"$logTagValue\"")
buildConfigField('String', 'PROVIDER_NAME', "\"${PROVIDER_NAME.toUpperCase()}\"")
buildConfigField('String', 'PROVIDER_VERSION', "\"$PROVIDER_VERSION\"")
} else {
buildConfigField('String', logTagName, "\"$logTagValue\"")
}
if (isLibrary) {
archivesBaseName = "${POM_ARTIFACT_ID}-${versionName}.${System.getenv("BUILD_NUMBER") ?: getSha()}"
consumerProguardFiles 'proguard.cfg'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
if (isLibrary) {
sourceSets {
test.java.srcDirs += 'src/test/kotlin'
}
testOptions {
unitTests {
returnDefaultValues = true
includeAndroidResources = true
}
}
buildTypes {
debug {
testCoverageEnabled true
}
}
}
}
if (isLibrary) {
dependencies {
testImplementation 'com.github.salomonbrys.kotson:kotson:2.5.0'
testImplementation 'com.google.truth:truth:0.37'
testImplementation 'com.nhaarman:mockito-kotlin:1.5.0'
testImplementation 'junit:junit:4.12'
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:20171018'
testImplementation 'org.mockito:mockito-core:2.16.0'
testImplementation 'org.robolectric:robolectric:3.8'
}
}
if (isLibrary) {
apply from: "$rootProject.projectDir/gradle/mvn-push.gradle"
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.6'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
static def getSha() {
return 'git rev-parse --short HEAD'.execute().text.trim()
}