forked from TwidereProject/TwidereX-Android
/
build.gradle.kts
129 lines (121 loc) · 3.72 KB
/
build.gradle.kts
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
import java.util.Properties
buildscript {
repositories {
google()
}
dependencies {
if (file("google-services.json").exists()) {
// START Non-FOSS component
classpath("com.google.gms:google-services:4.3.14")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.2")
// END Non-FOSS component
}
}
}
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("twiderex.android.application")
}
if (file("google-services.json").exists()) {
// START Non-FOSS component
apply(plugin = "com.google.gms.google-services")
apply(plugin = "com.google.firebase.crashlytics")
// END Non-FOSS component
}
android {
lint {
disable.add("MissingTranslation")
}
flavorDimensions.add("channel")
productFlavors {
if (file("google-services.json").exists()) {
// START Non-FOSS component
create("google") {
dimension = "channel"
}
// END Non-FOSS component
}
create("fdroid") {
dimension = "channel"
}
}
val file = rootProject.file("signing.properties")
val hasSigningProps = file.exists()
signingConfigs {
if (hasSigningProps) {
create("twidere") {
val signingProp = Properties()
signingProp.load(file.inputStream())
storeFile = rootProject.file(signingProp.getProperty("storeFile"))
storePassword = signingProp.getProperty("storePassword")
keyAlias = signingProp.getProperty("keyAlias")
keyPassword = signingProp.getProperty("keyPassword")
}
}
}
buildTypes {
debug {
if (hasSigningProps) {
signingConfig = signingConfigs.getByName("twidere")
}
manifestPlaceholders.apply {
put("appIcon", "@mipmap/ic_launcher")
put("appIconRound", "@mipmap/ic_launcher_round")
}
}
release {
if (hasSigningProps) {
signingConfig = signingConfigs.getByName("twidere")
}
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
manifestPlaceholders.apply {
put("appIcon", "@mipmap/ic_launcher")
put("appIconRound", "@mipmap/ic_launcher_round")
}
}
}
sourceSets.forEach {
it.res {
srcDirs(project.files("src/${it.name}/res-localized"))
}
it.java {
srcDirs("src/${it.name}/kotlin")
}
}
sourceSets {
findByName("androidTest")?.let {
it.assets {
srcDirs(files("$projectDir/schemas"))
}
}
}
packagingOptions {
resources {
excludes.addAll(
listOf(
"META-INF/AL2.0",
"META-INF/LGPL2.1",
"DebugProbesKt.bin"
)
)
}
}
}
dependencies {
implementation(projects.common)
implementation(libs.androidx.startup)
if (file("google-services.json").exists()) {
// START Non-FOSS component
val googleImplementation by configurations
googleImplementation(platform("com.google.firebase:firebase-bom:31.1.1"))
googleImplementation("com.google.firebase:firebase-analytics-ktx")
googleImplementation("com.google.firebase:firebase-crashlytics-ktx")
googleImplementation("com.google.android.play:core-ktx:1.8.1")
// END Non-FOSS component
}
}