forked from mendhak/gpslogger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
336 lines (257 loc) · 9.18 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
classpath 'org.jacoco:org.jacoco.core:0.8.7'
classpath "com.moowork.gradle:gradle-node-plugin:0.13"
}
}
//Android
apply plugin: 'com.android.application'
//Generating PGP
apply plugin: 'signing'
//Generating colorful output
apply from: 'buildtools/ColoredOutput.gradle'
project.ext.set("GHACTIONS_FOLDING", true)
//Generate help pages
apply plugin: 'com.moowork.node'
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
google()
}
android {
compileSdkVersion 34
defaultConfig {
applicationId "com.mendhak.gpslogger"
minSdkVersion 16
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 30
compileSdk 34
versionCode 131
versionName "131-rc2"
// Used by AppAuth-Android
manifestPlaceholders = [
appAuthRedirectScheme: 'com.mendhak.gpslogger'
]
}
buildTypes {
debug {
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable true
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable false
}
}
testOptions {
unitTests.returnDefaultValues = true
}
lint {
abortOnError false
}
namespace 'com.mendhak.gpslogger'
//Release signing key
if (project.hasProperty("RELEASE_STORE_FILE")) {
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
else if (System.getenv("SIGNING_STORE_PASSWORD") != null) {
signingConfigs {
release {
storeFile = file("${projectDir}/keystore/your_signing_keystore.jks")
storePassword System.getenv("SIGNING_STORE_PASSWORD")
keyAlias System.getenv("SIGNING_KEY_ALIAS")
keyPassword System.getenv("SIGNING_KEY_PASSWORD")
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
}
dependencies {
// implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.activity:activity:1.8.2"
implementation "androidx.fragment:fragment:1.6.2"
implementation "androidx.preference:preference:1.2.1"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
//Google Drive Oauth
implementation 'net.openid:appauth:0.9.1'
//FTP operations
implementation('commons-net:commons-net:3.4')
//Debug Logging
implementation('org.slf4j:slf4j-api:1.7.30')
implementation('com.github.tony19:logback-android-classic:1.1.1-2'){
exclude group: 'com.google.android', module: 'android'
}
implementation('com.github.tony19:logback-android-core:1.1.1-2')
//Android lollipop/material features including the Toolbar
implementation 'androidx.appcompat:appcompat:1.6.1'
//Cardviews
implementation 'androidx.cardview:cardview:1.0.0'
// Simple Dialog Fragments, replacing Material Dialogs.
// implementation 'io.github.eltos:simpledialogfragments:3.4'
implementation 'com.github.eltos:SimpleDialogFragments:v3.5'
//The material drawer
implementation('com.mikepenz:materialdrawer:4.6.4@aar') {
transitive = true
}
//Progress button
implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
//Android's WorkManager
implementation 'androidx.work:work-runtime:2.9.0'
// We need to use Gson to help with WorkManager limitations
implementation 'com.google.code.gson:gson:2.10.1'
//Event bus
implementation 'de.greenrobot:eventbus:2.4.0'
//JARs which aren't on maven
//compile 'com.mendhak.gpsloggersupportfiles:owncloud-android-library:0.0.3@aar'
implementation 'com.github.owncloud:android-library:oc-android-library-0.9.14'
//Required by owncloud library
implementation ('commons-httpclient:commons-httpclient:3.1') {
exclude module: 'commons-logging'
}
implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.12.2'
//Expandable textview in the FAQ
implementation 'com.ms-square:expandableTextView:0.1.4'
//The single letter text icons
implementation 'com.github.amulyakhare:TextDrawable:558677ea31'
//OKHTTP client
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
//Dropbox API 3
implementation 'com.dropbox.core:dropbox-core-sdk:5.1.1'
//Markdown to HTML library
implementation 'com.github.commonsguy:cwac-anddown:dedb48ec0f'
// A fork of JSCH used in SFTPJob. It specifically requires bouncycastle to use modern algorithms.
implementation 'com.github.mwiede:jsch:0.1.67'
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.68'
implementation 'org.bouncycastle:bcprov-jdk15to18:1.68'
//File Picker, but a patched version
//https://github.com/codekidX/storage-chooser/issues/127
//https://github.com/codekidX/storage-chooser/issues/134
implementation 'com.github.mendhak:storage-chooser:2.0.4.4b'
//CSV library
implementation('org.apache.commons:commons-csv:1.9.0')
//Libraries required for unit testing
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:3.10.0'
testImplementation 'org.json:json:20180813'
testImplementation 'androidx.test:runner:1.5.2'
testImplementation 'androidx.test:rules:1.5.0'
}
tasks.withType(Test) {
//Tell Gradle to always run the tests even if build is up to date
outputs.upToDateWhen { false }
//Tell Gradle to show test output in the console
testLogging {
events "failed"
exceptionFormat = 'full'
showStandardStreams true
}
}
tasks.configureEach { task ->
//Don't run lint. Takes too long.
if (task.name.contains("lint")) {
task.enabled = false
}
}
task buildTranslationArray {
def foundLocales = new StringBuilder()
foundLocales.append("new String[]{")
fileTree("src/main/res").visit { FileVisitDetails details ->
if(details.file.path.endsWith("strings.xml")){
def languageCode = details.file.parent.tokenize(File.separator).last().replaceAll('values-','').replaceAll('-r','-')
languageCode = (languageCode == "values") ? "en" : languageCode;
foundLocales.append("\"").append(languageCode).append("\"").append(",")
}
}
foundLocales.append("}")
//Don't forget to remove the trailing comma
def foundLocalesString = foundLocales.toString().replaceAll(',}','}')
android.defaultConfig.buildConfigField "String[]", "TRANSLATION_ARRAY", foundLocalesString
}
preBuild.dependsOn buildTranslationArray
tasks.configureEach { task ->
if (task.name == 'preDebugBuild' || task.name == 'preReleaseBuild') {
task.dependsOn buildTranslationArray
}
}
task buildDocs(group: "docs", type: NodeTask, dependsOn:"installNodeModules") {
script = file('../assets/generate-pages/index.js')
execOverrides {
it.workingDir = '../assets/generate-pages'
}
}
task installNodeModules(group:"docs", type:NpmTask){
args = ['install']
execOverrides {
it.workingDir = '../assets/generate-pages'
}
}
task copyFAQsIntoAssets(group:"docs", type:Copy){
from '../assets/text/faq'
into 'src/main/assets/faq/'
include('*.md')
}
task deleteFAQsAssets(group:"docs", type:Delete){
def dirName = 'src/main/assets/faq'
fileTree( dirName ).include('**/*.md').each{
f -> delete f
}
}
task copyFinalAPK(group:'build') {
//Copies final APK to this directory
def finalApkName = "gpslogger-"+android.defaultConfig.versionName+".apk"
copy{
from "build/outputs/apk/release/gpslogger-release.apk"
into "./"
// Use a closure to map the file name
rename { String fileName ->
fileName.replace("gpslogger-release.apk", finalApkName)
}
}
//PGP Sign
//Verify with gpg --verify ~/Downloads/gpslogger-71.apk.asc
if(file(finalApkName).isFile()){
signing {
useGpgCmd()
sign file(finalApkName)
}
//SHA256 Checksum
//Verify with sha256sum -c ~/Downloads/gpslogger-71.apk.SHA256
ant.checksum(file: finalApkName, fileext: '.SHA256', algorithm: "SHA-256", pattern: "{0} {1}")
}
}
preBuild.dependsOn copyFAQsIntoAssets
clean.dependsOn deleteFAQsAssets
task deleteReleaseAPKs(group:"build", type:Delete){
delete fileTree(dir:'./', include:'*.apk*')
}
clean.dependsOn deleteReleaseAPKs