-
Notifications
You must be signed in to change notification settings - Fork 323
/
Copy pathbuild.gradle
460 lines (381 loc) · 15.5 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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
plugins {
id 'com.android.application'
}
def taskName = getGradle().getStartParameter().getTaskRequests().toString()
ext {
FDroidCodeNumber = 6202
FDroidVersionNumber = "8.9.182"
}
println " --------------------"
println " taskName: " + taskName
println " --------------------"
ext {
if (!taskName.contains("Fdroid")) {
codeNumber = Integer.parseInt(appCodeNumber)
versionNumber = appVersionNumberBase + "." + appVersionNumberIndex
} else {
codeNumber = FDroidCodeNumber
versionNumber = FDroidVersionNumber
}
println ""
println "Version: [" + versionNumber + " - " + codeNumber + "]"
}
android {
compileSdk project.compileSdk
namespace "com.foobnix.pdf.info"
defaultConfig {
namespace "com.foobnix.pdf.info"
minSdk project.minSdk
targetSdk project.targetSdk
versionCode codeNumber
versionName versionNumber
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
configurations {
all {
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
}
lint {
abortOnError true
ignoreWarnings true
checkReleaseBuilds taskName.contains("Pro")
}
testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
}
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.release
debuggable false
}
debug {
debuggable true
}
}
compileOptions {
//coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
splits {
abi {
enable true
reset()
include "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
universalApk true
}
}
flavorDimensions.add("version")
productFlavors {
fdroid {
minSdk 16
dimension "version"
applicationId "com.foobnix.pro.pdf.reader"
manifestPlaceholders = [
appName : "Librera FD",
appIcon : "@mipmap/icon_pdf_pro",
appRoundIcon : "@mipmap/icon_pdf_pro",
appGdriveKey : "",
admobAppId : "",
admobBannerId: "",
admobFullId : "",
appSafeMode : "true"
]
versionNameSuffix '-fdroid'
}
librera {
dimension "version"
applicationId "com.foobnix.pdf.reader"
manifestPlaceholders = [
appName : "Librera",
appIcon : "@mipmap/icon_pdf_reader",
appRoundIcon : "@mipmap/icon_pdf_reader",
appGdriveKey : librera_appGdriveKey,
admobAppId : librera_admobAppId,
admobBannerId: librera_admobBannerId,
admobFullId : librera_admobFullId,
appSafeMode : "false"
]
}
pro {
dimension "version"
applicationId "com.foobnix.pro.pdf.reader"
manifestPlaceholders = [
appName : "Librera",
appIcon : "@mipmap/icon_pdf_pro",
appRoundIcon : "@mipmap/icon_pdf_pro",
appGdriveKey : pro_appGdriveKey,
admobAppId : "",
admobBannerId: "",
admobFullId : "",
appSafeMode : "false"
]
}
pdf_classic {
dimension "version"
applicationId "classic.pdf.reader.viewer.djvu.epub.fb2.txt.mobi.book.reader.lirbi.libri"
manifestPlaceholders = [
appName : "PDF Reader",
appIcon : "@mipmap/icon_pdf_classic",
appRoundIcon : "@mipmap/launcher_classic",
appGdriveKey : pdf_classic_appGdriveKey,
admobAppId : pdf_classic_admobAppId,
admobBannerId: pdf_classic_admobBannerId,
admobFullId : pdf_classic_admobFullId,
appSafeMode : "true"
]
}
ebooka {
dimension "version"
applicationId "droid.reader.book.epub.mobi.pdf.djvu.fb2.txt.azw.azw3"
manifestPlaceholders = [
appName : "Book Reader",
appIcon : "@mipmap/icon_pdf_droid",
appRoundIcon : "@mipmap/launcher_droid",
appGdriveKey : ebooka_appGdriveKey,
admobAppId : ebooka_admobAppId,
admobBannerId: ebooka_admobBannerId,
admobFullId : ebooka_admobFullId,
appSafeMode : "false"
]
}
pdf_v2 {
dimension "version"
applicationId "pdf.pdf.reader"
manifestPlaceholders = [
appName : "PDF Reader",
appIcon : "@mipmap/icon_pdf_2",
appRoundIcon : "@mipmap/launcher_pdf_v2",
appGdriveKey : pdf_v2_appGdriveKey,
admobAppId : pdf_v2_admobAppId,
admobBannerId: pdf_v2_admobBannerId,
admobFullId : pdf_v2_admobFullId,
appSafeMode : "false"
]
}
tts_reader {
dimension "version"
applicationId "tts.reader"
manifestPlaceholders = [
appName : "TTS Reader",
appIcon : "@mipmap/icon_tts_reader_app",
appRoundIcon : "@mipmap/launcher_tts_reader_app",
appGdriveKey : tts_reader_appGdriveKey,
admobAppId : tts_reader_admobAppId,
admobBannerId: tts_reader_admobBannerId,
admobFullId : tts_reader_admobFullId,
appSafeMode : "false"
]
}
epub_reader {
dimension "version"
applicationId "epub.reader"
manifestPlaceholders = [
appName : "Epub Reader",
appIcon : "@mipmap/icon_epub_reader",
appRoundIcon : "@mipmap/launcher_epub_reader",
appGdriveKey : epub_reader_appGdriveKey,
admobAppId : epub_reader_admobAppId,
admobBannerId: epub_reader_admobBannerId,
admobFullId : epub_reader_admobFullId,
appSafeMode : "false"
]
}
}
def abiCodes = ['armeabi-v7a': 0, 'arm64-v8a': 1, 'x86': 2, 'x86_64': 3]
applicationVariants.all { variant ->
variant.outputs.all { output ->
def flavor = variant.productFlavors[0].name.capitalize()
def abiName = getFilter("ABI")
/* if (abiName == "armeabi-v7a") {
variant.mergedFlavor.manifestPlaceholders.appSafeMode = "true"
//variant.resValue "string", "[appSafeMode]", "true"
println abiName + " : appSafeMode true "
} else {
variant.mergedFlavor.manifestPlaceholders.appSafeMode = "true"
//variant.resValue "string", "[appSafeMode]", "false"
println abiName + " : appSafeMode false"
}
*/
if (abiName != null) {
def code = abiCodes.get(abiName, 0) + variant.versionCode
abiName = abiName.replace("arm64-v8a", "arm64").replace("armeabi-v7a", "arm")
output.versionCodeOverride = code
//def fullName = "Librera ${flavor}-${versionNumber}-c${code}-d${db}-${abiName}.apk"
def fullName = "Librera ${flavor}-${versionNumber}-${abiName}.apk"
output.outputFileName = fullName
} else {
//def fullName = "Librera ${flavor}-${versionNumber}-c${codeNumber}-d${db}-universal.apk"
//def fullName = "Librera ${flavor}-${versionNumber}-universal.apk"
def fullName = "Librera ${flavor}-${versionNumber}-uni.apk"
output.versionCodeOverride = codeNumber
output.outputFileName = fullName
}
}
}
sourceSets {
fdroid { assets.srcDirs = ['src/fdroid/assets', 'src/fdroid/assets/'] }
}
packagingOptions {
resources {
excludes.addAll(
'META-INF/DEPENDENCIES',
'META-INF/NOTICE',
'META-INF/LICENSE',
'META-INF/LICENSE.txt',
'META-INF/NOTICE.txt',
)
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
proImplementation project(':pro')
fdroidImplementation project(':pro')
implementation project(':smartreflow')
/** AndroidX **/
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.work:work-runtime:2.10.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
/** Third-party **/
implementation 'com.github.axet:lame:1.0.9'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation('org.greenrobot:greendao:3.3.0') {
exclude group: 'org.greenrobot.greendao.rx'
}
implementation 'org.greenrobot:greendao-api:3.3.0'
implementation 'org.jsoup:jsoup:1.18.1'
implementation 'com.github.albfernandez:juniversalchardet:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.6'
implementation 'io.github.rburgst:okhttp-digest:1.21'
implementation 'com.squareup.okio:okio-parent:1.17.6'
implementation 'com.github.joniles:rtfparserkit:1.16.0'
implementation 'org.zwobble.mammoth:mammoth:1.5.0'
implementation 'javax.xml.stream:stax-api:1.0-2'
implementation 'net.lingala.zip4j:zip4j:2.11.5'
implementation 'com.github.bumptech.glide:glide:4.16.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
//implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
//conflict with worker
implementation "commons-logging:commons-logging-api:1.1"
implementation 'androidx.work:work-runtime:2.10.0'
implementation 'com.google.guava:guava:33.3.1-android'
//implementation "it.unimi.dsi:fastutil-core:8.5.12"
//implementation "androidx.car.app:app:1.4.0-rc01"
//implementation("androidx.media3:media3-ui:1.1.1")
//implementation('androidx.media3:media3-session:1.3.0')
//implementation "org.nanohttpd:nanohttpd:2.3.1"
/** Ads **/
def google_ads = "com.google.android.gms:play-services-ads:23.5.0"
libreraImplementation google_ads
pdf_v2Implementation google_ads
ebookaImplementation google_ads
tts_readerImplementation google_ads
pdf_classicImplementation google_ads
epub_readerImplementation google_ads
def messaging_ads = "com.google.android.ump:user-messaging-platform:3.1.0"
libreraImplementation messaging_ads
pdf_v2Implementation messaging_ads
ebookaImplementation messaging_ads
tts_readerImplementation messaging_ads
pdf_classicImplementation messaging_ads
epub_readerImplementation messaging_ads
/** Testing **/
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.6.2'
//androidTestImplementation 'androidx.test:core:1.5.2'
//androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
task copyApks() {
if (project.hasProperty('beta') || project.hasProperty("release")) {
println "My Task: [copy apks]"
delete fileTree("/home/dev/Dropbox/FREE_PDF_APK/testing").include("*.apk")
delete fileTree("/home/dev/Nextcloud/LibreraBeta").include("*.apk")
delete fileTree("/Users/dev/Library/CloudStorage/Dropbox/FREE_PDF_APK/testing").include("*.apk")
delete fileTree("/Users/dev/Library/CloudStorage/Dropbox/FREE_PDF_APK/$versionNumber").include("*.apk")
delete fileTree("/home/dev/Dropbox/FREE_PDF_APK/testing/$versionNumber").include("*.apk")
android.applicationVariants.all { variant ->
if ("release" == variant.buildType.name) {
def flavor = variant.productFlavors[0].name
//println "==== " + variant.buildType.name + " " + flavor
def list = []
if (project.hasProperty("beta")) {
list.add("/home/dev/Nextcloud/LibreraBeta")
list.add("/Users/dev/Library/CloudStorage/Dropbox/FREE_PDF_APK/testing")
list.add("/home/dev/Dropbox/FREE_PDF_APK/testing")
}
if (project.hasProperty("release")) {
list.add("/home/dev/Dropbox/FREE_PDF_APK/testing/$versionNumber")
list.add("/Users/dev/Library/CloudStorage/Dropbox/FREE_PDF_APK/testing/$versionNumber")
}
list.each { dest ->
copy {
from file(
"build/outputs/apk/${flavor}/release/"
)
include "*.apk"
into file(dest)
println "Copy: '" + flavor + "' to " + dest
eachFile {
project.file(dest).mkdirs()
if (!file(dest).exists()) {
it.exclude()
}
}
}
}
}
}
//File file = new File('/home/data/Dropbox/FREE_PDF_APK/testing/version.txt')
//file.write versionNumber
}
}
task incVersion() {
doLast {
Properties props = new Properties()
File progejectDir = layout.projectDirectory.getAsFile()
println "progejectDir :" + progejectDir
File propsFile = new File(progejectDir, 'gradle.properties')
props.load(propsFile.newDataInputStream())
int appCodeNumber = Integer.parseInt(props.getProperty('appCodeNumber'))
appCodeNumber += 4
int appVersionNumberIndex = Integer.parseInt(props.getProperty('appVersionNumberIndex'))
appVersionNumberIndex += 1
props.setProperty('appCodeNumber', "" + appCodeNumber)
props.setProperty('appVersionNumberIndex', "" + appVersionNumberIndex)
props.store(propsFile.newWriter(), null)
println "My Task: [incVersion]"
}
}
if (!taskName.contains("Fdroid")) {
dependencies {
implementation "com.github.junrar:junrar:4.0.0"
/** Google Drive Sync **/
implementation 'com.google.http-client:google-http-client-gson:1.42.2'
implementation 'com.google.android.gms:play-services-auth:20.3.0'
implementation('com.google.api-client:google-api-client-android:1.30.2') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev173-1.25.0') {
exclude group: 'org.apache.httpcomponents'
}
}
}