forked from mauron85/background-geolocation-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
145 lines (127 loc) · 4.99 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
apply plugin: 'com.android.library'
apply from: './VERSIONS.gradle'
def applicationId = getApplicationId()
def hasGradle3Support = getGradle3Support()
def resourcePrefix = getResourcePrefix()
// https://hackernoon.com/android-how-to-add-gradle-dependencies-using-foreach-c4cbcc070458
def oreoDependencies = [
[configuration: "androidTestImplementation", dependency: androidLibs.supportAnnotations],
[configuration: "androidTestImplementation", dependency: testLibs.testRunner],
[configuration: "androidTestImplementation", dependency: testLibs.testRules],
[configuration: "testImplementation", dependency: testLibs.junit],
[configuration: "testImplementation", dependency: testLibs.json],
[configuration: "testImplementation", dependency: testLibs.robolectric],
[configuration: "testImplementation", dependency: testLibs.mockitoCore],
[configuration: "implementation", dependency: androidLibs.playServicesLocation],
[configuration: "implementation", dependency: androidLibs.supportCompat],
[configuration: "implementation", dependency: androidLibs.appcompat],
[configuration: "implementation", dependency: libs.permissions,
options: { exclude group: 'com.android.support', module: 'appcompat-v7'}],
[configuration: "implementation", dependency: libs.logback],
[configuration: "implementation", dependency: libs.slf4j],
[configuration: "implementation", dependency: libs.promise],
]
def preoreoDependencies = [
[configuration: "androidTestCompile", dependency: androidLibs.supportAnnotations],
[configuration: "androidTestCompile", dependency: testLibs.testRunner],
[configuration: "androidTestCompile", dependency: testLibs.testRules],
[configuration: "testCompile", dependency: testLibs.junit],
[configuration: "testCompile", dependency: testLibs.json],
[configuration: "testCompile", dependency: testLibs.robolectric],
[configuration: "testCompile", dependency: testLibs.mockitoCore],
[configuration: "compile", dependency: androidLibs.playServicesLocation],
[configuration: "oreoCompile", dependency: androidLibs.supportCompat],
[configuration: "compile", dependency: androidLibs.appcompat],
[configuration: "compile", dependency: libs.permissions,
options: { exclude group: 'com.android.support', module: 'appcompat-v7'}],
[configuration: "compile", dependency: libs.logback],
[configuration: "compile", dependency: libs.slf4j],
[configuration: "compile", dependency: libs.promise],
]
buildscript {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com'
}
jcenter()
}
}
android {
compileSdkVersion project.ext.getCompileSdkVersion()
buildToolsVersion project.ext.getBuildToolsVersion()
publishNonDefault true
defaultConfig {
resValue "string", resourcePrefix + "account_name", 'Locations'
resValue "string", resourcePrefix + "account_type", applicationId + '.mauron85.bgloc.account'
resValue "string", resourcePrefix + "content_authority", applicationId + '.mauron85.bgloc.provider'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
minSdkVersion project.ext.getMinSdkVersion()
versionCode 1
versionName "1.0"
}
sourceSets {
main {
if (hasGradle3Support) {
java.srcDirs = ['src/main/java', 'src/oreo/java']
}
}
}
flavorDimensions 'default'
productFlavors {
if (!hasGradle3Support) {
preoreo {
targetSdkVersion project.ext.getTargetSdkVersion()
dimension 'default'
}
oreo {
versionNameSuffix 'oreo'
targetSdkVersion project.ext.getTargetSdkVersion()
dimension 'default'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
testOptions {
//unitTests.includeAndroidResources = true
unitTests.returnDefaultValues = true
}
lintOptions {
abortOnError false
}
}
dependencies {
if (hasGradle3Support) {
oreoDependencies.each {
add(it.configuration, it.dependency)
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
} else {
preoreoDependencies.each {
add(it.configuration, it.dependency)
}
compile fileTree(include: ['*.jar'], dir: 'libs')
}
}