-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle
144 lines (118 loc) · 5.06 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
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
id 'com.getkeepsafe.dexcount'
}
apply from: "../gradle/ktlint.gradle"
apply from: "../gradle/dexcount.gradle"
apply from: "../gradle/versions.gradle"
apply from: "../gradle/pitest.gradle"
def mapboxApiToken = project.properties['MAPBOX_ACCESS_TOKEN'] ?: System.getenv('MAPBOX_ACCESS_TOKEN')
if (mapboxApiToken == null) {
throw new Exception("API token is not specified.")
}
def apiType = null
def apiTypeString = null
if (project.hasProperty('API_TYPE')) {
apiTypeString = String.valueOf(project.property('API_TYPE'))
} else if (System.getenv('API_TYPE') != null) {
apiTypeString = String.valueOf(System.getenv('API_TYPE'))
}
if (apiTypeString == "SEARCH_BOX") {
apiType = "com.mapbox.search.ApiType.SEARCH_BOX"
} else if (apiTypeString == "SBS") {
apiType = "com.mapbox.search.ApiType.SBS"
} else if (apiTypeString == "GEOCODING") {
apiType = "com.mapbox.search.ApiType.GEOCODING"
} else {
def enableSBS = false
if (project.hasProperty('ENABLE_SBS')) {
enableSBS = Boolean.valueOf(project.property('ENABLE_SBS'))
} else if (System.getenv('ENABLE_SBS') != null) {
enableSBS = Boolean.valueOf(System.getenv('ENABLE_SBS'))
}
if (enableSBS) {
apiType = "com.mapbox.search.ApiType.SBS"
} else {
apiType = "com.mapbox.search.ApiType.SEARCH_BOX"
}
}
android {
compileSdkVersion compile_sdk_version
defaultConfig {
buildConfigField "boolean", "COVERAGE_ENABLED", "${project.hasProperty('coverage')}"
buildConfigField "com.mapbox.search.ApiType", "API_TYPE", apiType
resValue "string", "mapbox_access_token", mapboxApiToken
applicationId "com.mapbox.search.sample"
minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version
versionCode 1
versionName "0.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
applicationIdSuffix ".debug"
manifestPlaceholders = [appName: "Debug MapboxSearchSample"]
multiDexEnabled true
multiDexKeepProguard file('proguard-multidex-rules.pro')
}
release {
manifestPlaceholders = [appName: "MapboxSearchSample"]
multiDexEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}
buildFeatures {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
allWarningsAsErrors = !project.hasProperty('android.injected.invoked.from.ide')
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += [
'-Xopt-in=com.mapbox.search.common.RestrictedMapboxSearchAPI'
]
}
lint {
abortOnError true
disable 'ParcelCreator'
}
}
dependencies {
implementation project(':sdk')
implementation project(':ui')
implementation project(':base')
implementation project(':offline')
implementation project(':autofill')
implementation project(':discover')
implementation project(':place-autocomplete')
debugImplementation "androidx.multidex:multidex:$multidex_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "androidx.appcompat:appcompat:$androidx_appcompat_version"
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$androidx_lifecycle_runtime_ktx_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$androidx_lifecycle_runtime_ktx_version"
implementation "androidx.core:core-ktx:$androidx_core_version"
implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version"
implementation "com.mapbox.maps:android:$mapbox_maps_version"
implementation "com.mapbox.mapboxsdk:mapbox-sdk-turf:$mapbox_turf_version"
ktlint "com.pinterest:ktlint:$ktlint_version"
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
androidTestImplementation project(":common-tests")
androidTestImplementation "androidx.test.uiautomator:uiautomator:$ui_automator_version"
androidTestImplementation "androidx.test.espresso:espresso-contrib:$espresso_core_version"
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_core_version"
androidTestImplementation "androidx.test:runner:$androidx_test_runner_version"
androidTestImplementation "androidx.test:rules:$androidx_test_rules_version"
androidTestImplementation "androidx.test.ext:junit:$androidx_junit_version"
androidTestImplementation "com.adevinta.android:barista:$barista_version"
androidTestImplementation "com.squareup.okhttp3:mockwebserver:$okhttp3_version"
androidTestImplementation "junit:junit:$junit_version"
}