-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.gradle
246 lines (201 loc) 路 8.63 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
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-parcelize'
id 'kotlin-kapt'
id 'com.jaredsburrows.license'
}
def keystorePropertiesFile = rootProject.file("app/keystore.properties")
def keystoreProperties = new Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
def fileProviderAuthority = ""
android {
namespace "ua.com.radiokot.photoprism"
compileSdk 34
defaultConfig {
minSdk 21
targetSdk 34
applicationId "ua.com.radiokot.photoprism"
versionCode 40
versionName "1.26.0"
// Must be aligned with @xml/locale_config and values-*.
resConfigs "en", "cs", "de", "el", "es", "fr", "it", "ru", "tr", "uk", "zh", "zh-rTW"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
fileProviderAuthority = applicationId + ".files"
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"room.schemaLocation": "$projectDir/db-schema".toString(),
"room.incremental" : "true"
]
}
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
manifestPlaceholders.fileProviderAuthority = fileProviderAuthority + ".debug"
buildConfigField 'String', 'FILE_PROVIDER_AUTHORITY', "\"" + fileProviderAuthority + ".debug" + "\""
}
release {
minifyEnabled false
shrinkResources false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
manifestPlaceholders.fileProviderAuthority = fileProviderAuthority
buildConfigField 'String', 'FILE_PROVIDER_AUTHORITY', "\"" + fileProviderAuthority + "\""
}
releaseClone {
minifyEnabled false
shrinkResources false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
applicationIdSuffix ".clone"
versionNameSuffix "-clone"
manifestPlaceholders.fileProviderAuthority = fileProviderAuthority + ".clone"
buildConfigField 'String', 'FILE_PROVIDER_AUTHORITY', "\"" + fileProviderAuthority + ".clone" + "\""
matchingFallbacks = ["release"]
}
}
bundle {
language {
// Prevent Google Play from erasing string resources for languages
// different from the current. Allows setting any of available languages
// after installation.
enableSplit = false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
packagingOptions {
doNotStrip '**/*.so'
}
licenseReport {
generateHtmlReport = true
generateJsonReport = false
generateCsvReport = false
copyHtmlReportToAssets = true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.work:work-runtime:2.9.0'
implementation 'androidx.work:work-rxjava3:2.9.0'
// If there is a need to update the preferences library,
// the Material- overrides in androidx.preference and MaterialPreferenceDialogDisplay
// must be updated accordingly.
implementation 'androidx.preference:preference:1.2.1'
implementation('com.fasterxml.jackson.core:jackson-databind') {
version {
strictly jackson_version
}
}
implementation('com.fasterxml.jackson.module:jackson-module-kotlin') {
version {
strictly jackson_version
}
}
implementation "io.insert-koin:koin-core:$koin_version"
implementation "io.insert-koin:koin-android:$koin_android_version"
implementation 'io.reactivex.rxjava3:rxjava:3.1.6'
implementation 'io.reactivex.rxjava3:rxkotlin:3.0.1'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
implementation 'io.github.microutils:kotlin-logging:2.1.23'
implementation 'com.gitlab.mvysny.slf4j:slf4j-handroid:2.0.4'
implementation 'com.squareup.okhttp3:okhttp:4.9.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
implementation 'com.mikepenz:fastadapter:5.7.0'
implementation 'com.mikepenz:fastadapter-extensions-scroll:5.7.0'
implementation 'com.mikepenz:fastadapter-extensions-diff:5.7.0'
implementation 'com.squareup.picasso:picasso:2.8'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation 'androidx.security:security-crypto:1.1.0-alpha05'
implementation 'androidx.browser:browser:1.5.0'
implementation 'me.zhanghai.android.fastscroll:library:1.2.0'
implementation 'ua.com.radiokot:offline-license-key:1.0.0'
// Must be 4.3 for Java 8 compatibility.
implementation 'com.tbuonomo:dotsindicator:4.3'
implementation 'androidx.media3:media3-exoplayer:1.3.1'
implementation 'androidx.media3:media3-ui:1.3.1'
implementation 'androidx.media3:media3-datasource-okhttp:1.3.1'
testImplementation 'junit:junit:4.13.2'
testImplementation "io.insert-koin:koin-test:$koin_version"
testImplementation "io.insert-koin:koin-test-junit4:$koin_version"
testImplementation 'org.slf4j:slf4j-simple:2.0.7'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
// Make the built APKs have a release-style name.
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "${variant.applicationId}-${variant.versionName}.apk"
}
}
// F-Droid reproducible builds fix: https://gist.github.com/obfusk/61046e09cee352ae6dd109911534b12e
// Android Studio can't find the imports; this does not affect the actual build
// since Gradle can find them just fine.
import com.android.tools.profgen.ArtProfileKt
import com.android.tools.profgen.ArtProfileSerializer
import com.android.tools.profgen.DexFile
import java.nio.charset.StandardCharsets
import java.nio.file.Files
project.afterEvaluate {
tasks.each { task ->
if (task.name.startsWith("compile") && task.name.endsWith("ReleaseArtProfile")) {
task.doLast {
outputs.files.each { file ->
if (file.name.endsWith(".profm")) {
println("Sorting ${file} ...")
def version = ArtProfileSerializer.valueOf("METADATA_0_0_2")
def profile = ArtProfileKt.ArtProfile(file)
def keys = new ArrayList(profile.profileData.keySet())
def sortedData = new LinkedHashMap()
Collections.sort keys, new DexFile.Companion()
keys.each { key -> sortedData[key] = profile.profileData[key] }
new FileOutputStream(file).with {
write(version.magicBytes$profgen)
write(version.versionBytes$profgen)
version.write$profgen(it, sortedData, "")
}
}
}
}
}
}
}
// Pretty license report.
project.afterEvaluate {
Task licenseReportTask = tasks.findByName("licenseReleaseReport")
licenseReportTask.outputs.upToDateWhen { false }
licenseReportTask.doLast {
def report = file("src/main/assets/open_source_licenses.html")
List<String> lines = Files.readAllLines(report.toPath(), StandardCharsets.UTF_8)
// Remove the "Notice for packages" header.
lines[6] = ""
// Reduce the font size.
lines[2] = lines[2].replace("body {", "body { font-size: 75%;")
Files.write(report.toPath(), lines, StandardCharsets.UTF_8)
}
}