-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathbuild.gradle.kts
185 lines (153 loc) · 5.35 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
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
import com.google.protobuf.gradle.id
import com.google.protobuf.gradle.protobuf
import java.io.File
import java.io.FileInputStream
import java.time.Instant
import java.util.Properties
plugins {
id("com.android.application")
id("com.autonomousapps.dependency-analysis")
kotlin("android")
id("org.jetbrains.kotlin.plugin.compose")
id("com.google.protobuf")
id("com.github.triplet.play") version "3.12.1"
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
id("com.android.compose.screenshot")
}
android {
compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig {
// NOTE: This must be the same in the phone app and the wear app for the capabilities API
applicationId = "ru.beryukhov.coffeegram"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = (100000000 + Instant.now().toEpochMilli() / 1000).toInt()
versionName = "1.6"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
create("release") {
storeFile = rootProject.file("download.jks")
storePassword = KeyHelper.getValue(KeyHelper.KEY_STORE_PASS)
keyAlias = KeyHelper.getValue(KeyHelper.KEY_ALIAS)
keyPassword = KeyHelper.getValue(KeyHelper.KEY_PASS)
}
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
}
compileOptions {
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
if (project.findProperty("myapp.enableComposeCompilerReports") == "true") {
freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
)
freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
)
}
}
buildFeatures {
compose = true
buildConfig = true
}
packaging {
resources.excludes.add("META-INF/AL2.0")
resources.excludes.add("META-INF/LGPL2.1")
}
namespace = "ru.beryukhov.coffeegram"
experimentalProperties["android.experimental.enableScreenshotTest"] = true
}
dependencies {
implementation(projects.repository)
implementation(projects.appWearCommon)
implementation(libs.core.coreKtx)
implementation(libs.material)
implementation(libs.compose.ui)
implementation(libs.compose.material3)
debugImplementation(libs.compose.uiTooling)
screenshotTestImplementation(libs.compose.uiTooling)
implementation(libs.compose.preview)
implementation(libs.compose.activity)
implementation(libs.glance.appwidget)
implementation(libs.glance.preview)
implementation(libs.glance.appwidget.preview)
implementation(libs.google.maps.compose)
implementation(libs.ktor.client.okhttp)
implementation(libs.ktor.logging)
implementation(libs.kotlinx.immutableCollections)
testRuntimeOnly(libs.kotlin.test.junit)
implementation(projects.dateTimeUtils)
implementation(libs.coroutines.core)
runtimeOnly(libs.coroutines.android)
implementation(libs.datastore.preferences)
implementation(libs.datastore.datastore)
implementation(libs.protobuf.javalite)
implementation(libs.koin.android)
implementation(libs.koin.compose) // lifecycleScope
// Wearable
implementation(libs.playServices.wearable)
// for connectedNodes.await()
implementation(libs.coroutines.play)
implementation(libs.lottie.compose)
androidTestImplementation(libs.compose.uiTestJunit4)
androidTestImplementation(libs.kakao.compose)
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${libs.versions.protobuf.get()}"
}
generateProtoTasks {
all().forEach { task ->
task.builtins {
id("java") {
option("lite")
}
}
}
}
}
object KeyHelper {
const val KEY_STORE_FILE = "storeFile"
const val KEY_STORE_PASS = "storePassword"
const val KEY_ALIAS = "keyAlias"
const val KEY_PASS = "keyPassword"
private val properties by lazy {
try {
Properties().apply { load(FileInputStream(File("key.properties"))) }
} catch (e: Exception) {
Properties().apply {
setProperty("storePassword", "")
setProperty("keyAlias", "")
setProperty("keyPassword", "")
}
}
}
fun getValue(key: String): String {
return properties.getProperty(key)
}
}
play {
serviceAccountCredentials.set(file("../play_config.json"))
track.set("alpha")
defaultToAppBundles.set(true)
}
secrets {
propertiesFileName = "secrets.properties"
defaultPropertiesFileName = "local.defaults.properties"
}