forked from KDE/kdeconnect-android
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
205 lines (184 loc) · 7.23 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
200
201
202
203
204
205
import com.android.build.gradle.AppExtension
import com.android.build.gradle.api.ApkVariantOutput
import com.android.build.gradle.api.ApplicationVariant
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
buildscript {
ext.kotlin_version = '1.4.10'
repositories {
jcenter()
google()
}
dependencies {
// Pinned 4.0.2 due to this bug on 4.1: https://issuetracker.google.com/issues/172096891
//noinspection GradleDependency
classpath 'com.android.tools.build:gradle:4.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 14
targetSdkVersion 29
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
multiDexEnabled true
}
buildFeatures {
viewBinding true
}
dexOptions {
javaMaxHeapSize "2g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['resources']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
test {
java.srcDirs = ['tests']
}
}
packagingOptions {
merge "META-INF/DEPENDENCIES"
merge "META-INF/LICENSE"
merge "META-INF/NOTICE"
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
signingConfigs {
debug {
storeFile file("debug.keystore")
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.debug
}
// keep minifyEnabled false above for faster builds; set to 'true'
// when testing to make sure ProGuard/R8 is not deleting important stuff
release {
minifyEnabled true
shrinkResources true
}
}
}
/**
* This is a special on-demand Gradle object.
*
* Its value will not be determined until someone calls one of the gitHashProvider.getXXX() methods.
*
* If it does not encounter an explicit 'return' statement, getHashProvider.isPresent() will return false.
*/
Provider<String> gitHashProvider = project.provider {
Process gitCommand = null
try {
// This invokes 'git' immediately, but does not wait for it to finish
gitCommand = 'git rev-parse --short HEAD'.execute([], project.rootDir)
} catch (IOException ignored) {
}
if (gitCommand == null) {
logger.log(LogLevel.WARN, "Could not make use of the 'git' command-line tool. Output filenames will not be customized.")
} else if (gitCommand.waitFor() == 0) {
// This call to '::getText' (using the 'text' Groovy accessor syntax) collects the
// output stream
return '-' + gitCommand.text.trim()
} else {
logger.log(
LogLevel.WARN,
"Could not determine which commit is currently checked out -" +
" did you download this code without the .git directory?"
)
}
}
// We know we can safely cast the 'android' type to the 'AppExtension' class because
// we used the 'com.android.application' plugin at the top of the file.
//
// Note the use of the '::all' extension method; unlike '::each', it can detect every
// object added to the collection, no matter in which build phase that happens.
(android as AppExtension).applicationVariants.all { ApplicationVariant v ->
logger.log(LogLevel.INFO, "Found a variant called '${v.name}'.")
if (v.buildType.debuggable) {
// We're looking at variants made from android.buildTypes.debug! This one
// might have multiple outputs, but only one output will be an APK file.
v.outputs.matching { it instanceof ApkVariantOutput }.all {
// Default output filename is "${project.name}-${v.name}.apk". We want
// the Git commit short-hash to be added onto that default filename.
(it as ApkVariantOutput).outputFileName = "${project.name}-${v.name}${gitHashProvider.getOrElse("")}.apk"
}
}
}
ext {
coroutines_version = '1.3.8'
}
dependencies {
repositories {
jcenter()
google()
/* Needed for org.apache.sshd debugging
maven {
url "https://jitpack.io"
}
*/
}
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.media:media:1.2.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0'
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.jakewharton:disklrucache:2.0.2' //For caching album art bitmaps
implementation 'com.jaredrummler:android-device-names:1.1.9' //To get a human-friendly device name
implementation 'org.apache.sshd:sshd-core:0.14.0'
implementation 'org.apache.mina:mina-core:2.0.19' //For some reason, makes sshd-core:0.14.0 work without NIO, which isn't available until Android 8 (api 26)
//implementation('com.github.bright:slf4android:0.1.6') { transitive = true } // For org.apache.sshd debugging
implementation 'com.madgag.spongycastle:bcpkix-jdk15on:1.58.0.0' //For SSL certificate generation
implementation 'org.atteo.classindex:classindex:3.6'
annotationProcessor 'org.atteo.classindex:classindex:3.6'
implementation 'com.klinkerapps:android-smsmms:5.2.6' //For SMS and MMS purposes
implementation 'commons-io:commons-io:2.7'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'org.apache.commons:commons-lang3:3.10'
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
// Testing
testImplementation 'junit:junit:4.12'
testImplementation 'org.powermock:powermock-core:2.0.0'
testImplementation 'org.powermock:powermock-module-junit4:2.0.0'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.0'
testImplementation 'org.mockito:mockito-core:2.23.0'
testImplementation 'org.skyscreamer:jsonassert:1.3.0'
}
repositories {
google()
mavenCentral()
}