-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
316 lines (265 loc) · 12.8 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
/*
* @Copyright 2018-2022 HardBackNutter
* @License GNU General Public License
*
* This file is part of NeverTooManyBooks.
*
* NeverTooManyBooks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NeverTooManyBooks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NeverTooManyBooks. If not, see <http://www.gnu.org/licenses/>.
*/
//file:noinspection LongLine
import java.time.LocalDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("de.mannodermaus.android-junit5")
}
/*
$HOME/.gradle/gradle.properties:
NeverTooManyBooks.properties=$HOME/blah/blah/NeverTooManyBooks.properties
$HOME/blah/blah/NeverTooManyBooks.properties:
sign.storeFile=$HOME/blah/blah/keystore.jks
sign.storePassword=MyStorePassword
sign.keyAlias=MyKeyAlias
sign.keyPassword=MyKeyPassword
*/
final def props = new Properties()
if (project.hasProperty("NeverTooManyBooks.properties")) {
final def file = new File(project.property("NeverTooManyBooks.properties"))
if (file.exists()) {
props.load(new FileInputStream(file))
}
}
android {
namespace = "com.hardbacknutter.nevertoomanybooks"
compileSdk = rootProject.ext.compileSdkVersion
signingConfigs {
release {
storeFile file(props["sign.storeFile"])
storePassword props["sign.storePassword"]
keyAlias props["sign.keyAlias"]
keyPassword props["sign.keyPassword"]
}
}
defaultConfig {
applicationId = rootProject.ext.applicationId
versionCode = rootProject.ext.applicationVersionCode
versionName = rootProject.ext.applicationVersionName
minSdk = rootProject.ext.minSdkVersion
targetSdk = rootProject.ext.targetSdkVersion
signingConfig(signingConfigs.release)
resourceConfigurations += ["de", "en", "en_GB", "es", "fr", "it", "nl", "pt", "vi",
"cs", "el", "pl", "ru", "tr"]
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["runnerBuilder"] =
"de.mannodermaus.junit5.AndroidJUnit5Builder"
// Add the build UTC DateTime; ISO formatted
buildConfigField("String", "TIMESTAMP", "\"x\"")
buildConfigField("boolean", "ENABLE_AMAZON", "true")
buildConfigField("boolean", "ENABLE_BEDETHEQUE", "true")
buildConfigField("boolean", "ENABLE_BOL", "true")
buildConfigField("boolean", "ENABLE_GOOGLE_BOOKS", "true")
buildConfigField("boolean", "ENABLE_ISFDB", "true")
buildConfigField("boolean", "ENABLE_KB_NL", "true")
buildConfigField("boolean", "ENABLE_LAST_DODO", "true")
buildConfigField("boolean", "ENABLE_OPEN_LIBRARY", "true")
buildConfigField("boolean", "ENABLE_STRIP_INFO", "true")
buildConfigField("boolean", "ENABLE_GOODREADS_BY_EXT_ID", "true")
buildConfigField("boolean", "ENABLE_LIBRARY_THING_ALT_ED", "true")
}
buildTypes {
release {
minifyEnabled = true
shrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro")
resValue("string", "searchSuggestAuthority",
"${applicationId}.SearchSuggestionProvider")
resValue("string", "fileProviderAuthority",
"${applicationId}.GenericFileProvider")
// Add the build UTC DateTime; ISO formatted
buildConfigField("String", "TIMESTAMP",
"\"" + LocalDateTime.now(ZoneOffset.UTC)
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + "\"")
// under development
buildConfigField("boolean", "ENABLE_BOOKFINDER", "false")
// under development
buildConfigField("boolean", "ENABLE_STRIP_INFO_LOGIN", "false")
// under development
buildConfigField("boolean", "EMBEDDED_BARCODE_SCANNER", "false")
}
beta {
initWith(release)
versionNameSuffix = "-beta"
// applicationIdSuffix: same as release to be able to update rel->beta
// Add the build UTC DateTime; ISO formatted
buildConfigField("String", "TIMESTAMP",
"\"" + LocalDateTime.now(ZoneOffset.UTC)
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + "\"")
resValue("string", "searchSuggestAuthority",
"${applicationId}.SearchSuggestionProvider.beta")
resValue("string", "fileProviderAuthority",
"${applicationId}.GenericFileProvider.beta")
// under development
buildConfigField("boolean", "ENABLE_BOOKFINDER", "true")
}
debug {
debuggable = true
versionNameSuffix = "-debug"
applicationIdSuffix = ".debug"
resValue("string", "searchSuggestAuthority",
"${applicationId}.SearchSuggestionProvider.debug")
resValue("string", "fileProviderAuthority",
"${applicationId}.GenericFileProvider.debug")
// under development
buildConfigField("boolean", "ENABLE_BOOKFINDER", "true")
// under development
buildConfigField("boolean", "ENABLE_STRIP_INFO_LOGIN", "true")
// under development
buildConfigField("boolean", "EMBEDDED_BARCODE_SCANNER", "false")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
// https://developer.android.com/studio/releases/#4-0-0-desugar
coreLibraryDesugaringEnabled = true
}
kotlinOptions {
jvmTarget = 11
}
buildFeatures {
viewBinding = true
buildConfig = true
}
testOptions {
unitTests {
includeAndroidResources = true
// Can be enabled to make Log.x work. OR, use Logger.x
returnDefaultValues = false
all {
reports {
junitXml.getRequired().set(true)
html.getRequired().set(false)
}
}
}
}
packagingOptions {
resources {
excludes += ["META-INF/LICENSE",
"META-INF/LICENSE.md",
"META-INF/LICENSE.txt",
"META-INF/license.txt",
"META-INF/LICENSE-notice.md",
"META-INF/NOTICE",
"META-INF/NOTICE.txt",
"META-INF/notice.txt",
"META-INF/ASL2.0",
"META-INF/DEPENDENCIES",
"META-INF/README.md",
"META-INF/CHANGES"]
}
}
lint {
// allow command line builds to complete
abortOnError = false
}
applicationVariants.all {
final variant ->
variant.outputs.all {
outputFileName = "${rootProject.name}-${rootProject.ext.applicationVersionName}-${variant.name}.apk"
}
}
// This configuration specifies how an app bundle should be split
// in terms of language, density and cpu architecture (abi).
// The default values are true. This means a split will be generated.
bundle {
language {
enableSplit = false
}
// density {
// enableSplit = true
// }
// abi {
// enableSplit = true
// }
}
}
dependencies {
implementation project(path: ":core")
implementation project(path: ":fastscroller")
// We are using an updated/repacked org.json, version 20230227
// https://github.com/stleary/JSON-java
implementation project(path: ":repacked-org-json")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs_nio:${desugarVersion}")
implementation("androidx.activity:activity:${androidxActivityVersion}")
implementation("androidx.annotation:annotation:${androidxAnnotationVersion}")
implementation("androidx.appcompat:appcompat:${androidxAppcompatVersion}")
implementation("androidx.cardview:cardview:${androidxCardviewVersion}")
implementation("androidx.collection:collection:${androidxCollectionVersion}")
// core is only needed for custom constraint helpers
implementation("androidx.constraintlayout:constraintlayout-core:${androidxConstraintlayoutCoreVersion}")
implementation("androidx.constraintlayout:constraintlayout:${androidxConstraintlayoutVersion}")
implementation("androidx.coordinatorlayout:coordinatorlayout:${androidxCoordinatorlayoutVersion}")
implementation("androidx.core:core:${androidxCoreVersion}")
implementation("androidx.customview:customview:${androidxCustomviewVersion}")
implementation("androidx.documentfile:documentfile:${androidxDocumentfileVersion}")
implementation("androidx.drawerlayout:drawerlayout:${androidxDrawerlayoutVersion}")
implementation("androidx.exifinterface:exifinterface:${androidxExifinterfaceVersion}")
implementation("androidx.fragment:fragment:${androidxFragmentVersion}")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${androidxLifecycleVersion}")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:${androidxLifecycleVersion}")
implementation("androidx.preference:preference:${androidxPreferenceVersion}")
implementation("androidx.recyclerview:recyclerview:${androidxRecyclerviewVersion}")
// implementation("androidx.slidingpanelayout:slidingpanelayout:${androidxSlidingpanelayoutVersion}")
implementation("androidx.viewpager2:viewpager2:${androidxViewpager2Version}")
implementation("androidx.window:window:${androidxWindowVersion}")
// https://github.com/material-components/material-components-android/releases
implementation("com.google.android.material:material:${googleMaterialVersion}")
// jsoup HTML parser library @ https://jsoup.org/
implementation("org.jsoup:jsoup:${jsoupVersion}")
// CameraX based scanner code from "TinyZXingWrapper"
releaseImplementation("com.hardbacknutter.tinyzxingwrapper:TinyZXingWrapper:${tinyZxingWrapperVersion}:release@aar")
betaImplementation("com.hardbacknutter.tinyzxingwrapper:TinyZXingWrapper:${tinyZxingWrapperVersion}:release@aar")
debugImplementation("com.hardbacknutter.tinyzxingwrapper:TinyZXingWrapper:${tinyZxingWrapperVersion}:debug@aar")
implementation "com.google.zxing:core:${zxingCoreVersion}"
implementation("androidx.camera:camera-core:${androidxCameraxVersion}")
implementation("androidx.camera:camera-camera2:${androidxCameraxVersion}")
implementation("androidx.camera:camera-lifecycle:${androidxCameraxVersion}")
implementation("androidx.camera:camera-view:${androidxCameraxVersion}")
// https://www.acra.ch/docs/Setup/
implementation("ch.acra:acra-core:${acraVersion}")
implementation("ch.acra:acra-dialog:${acraVersion}")
// local tests use JUnit5
testImplementation("org.mockito:mockito-core:${mockitoVersion}")
testImplementation("org.mockito:mockito-junit-jupiter:${mockitoVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${jupiterVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${jupiterVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-params:${jupiterVersion}")
androidTestImplementation("de.mannodermaus.junit5:android-test-core:${mannodermausVersion}")
androidTestRuntimeOnly("de.mannodermaus.junit5:android-test-runner:${mannodermausVersion}")
// device tests use JUnit4
androidTestImplementation("androidx.test:core:${androidxTestCoreVersion}")
androidTestImplementation("androidx.test:runner:${androidxTestRunnerVersion}")
androidTestImplementation("androidx.test:rules:${androidxTestRulesVersion}")
// device tests with LiveData must add this class variable:
// @Rule
// public TestRule rule = new InstantTaskExecutorRule();
androidTestImplementation("androidx.arch.core:core-testing:${androidxArchCoreTestingVersion}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${kotlinxCoroutinesCoreVersion}")
// testImplementation("org.robolectric:robolectric:4.4")
// androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
}