@@ -14,6 +14,7 @@ plugins {
14
14
alias(libs.plugins.kotlin.parcelize)
15
15
alias(libs.plugins.kotlin.ksp)
16
16
alias(libs.plugins.compose)
17
+ alias(libs.plugins.protobuf.core)
17
18
alias(libs.plugins.rust.android.gradle)
18
19
19
20
id(Dependencies .junit5AndroidPluginId) version Versions .junit5Plugin
@@ -240,16 +241,14 @@ android {
240
241
241
242
createDistBundle.dependsOn(" bundle$capitalizedVariantName " )
242
243
244
+ // Ensure we have relay list ready before merging assets.
245
+ tasks[" merge${capitalizedVariantName} Assets" ].dependsOn(tasks[" generateRelayList" ])
246
+
243
247
// Ensure that we have all the JNI libs before merging them.
244
- tasks[" merge${capitalizedVariantName} JniLibFolders" ].apply {
245
- dependsOn(tasks[" generateRelayList" ])
246
- dependsOn(" cargoBuild" )
247
- }
248
+ tasks[" merge${capitalizedVariantName} JniLibFolders" ].dependsOn(" cargoBuild" )
248
249
249
250
// Ensure all relevant assemble tasks depend on our ensure task.
250
- tasks[" assemble$capitalizedVariantName " ].apply {
251
- dependsOn(tasks[" ensureValidVersionCode" ])
252
- }
251
+ tasks[" assemble$capitalizedVariantName " ].dependsOn(tasks[" ensureValidVersionCode" ])
253
252
}
254
253
}
255
254
@@ -291,7 +290,6 @@ cargo {
291
290
add(" --locked" )
292
291
}
293
292
}
294
- exec = { spec, _ -> println (spec.commandLine) }
295
293
}
296
294
297
295
tasks.register<Exec >(" generateRelayList" ) {
@@ -308,25 +306,34 @@ tasks.register<Exec>("generateRelayList") {
308
306
doLast {
309
307
val output = standardOutput as ByteArrayOutputStream
310
308
// Create file if needed
311
- File (" $extraAssetsDirectory " ).mkdirs()
312
- File (" $extraAssetsDirectory /relays.json" ).createNewFile()
313
- FileOutputStream (" $extraAssetsDirectory /relays.json" ).use { it.write(output.toByteArray()) }
314
-
315
- // Old ensure exists tasks
316
- if (! relayListPath.exists()) {
317
- throw GradleException (" Failed to generate relay list" )
318
- }
309
+ relayListPath.parentFile.mkdirs()
310
+ relayListPath.createNewFile()
311
+ FileOutputStream (relayListPath).use { it.write(output.toByteArray()) }
319
312
}
320
313
}
321
314
315
+ tasks.register<Exec >(" cargoClean" ) {
316
+ workingDir = File (repoRootPath)
317
+ commandLine(" cargo" , " clean" )
318
+ }
319
+
320
+ if (
321
+ gradleLocalProperties(rootProject.projectDir, providers)
322
+ .getProperty(" CLEAN_CARGO_BUILD" )
323
+ ?.toBoolean() != false
324
+ ) {
325
+ tasks[" clean" ].dependsOn(" cargoClean" )
326
+ }
327
+
328
+ // This is a hack and will not work correctly under all scenarios.
329
+ // See DROID-1696 for how we can improve this.
322
330
fun isReleaseBuild () =
323
331
gradle.startParameter.getTaskNames().any { it.contains(" release" , ignoreCase = true ) }
324
332
325
- fun isAlphaOrDevBuild () : Boolean {
333
+ fun isAlphaOrDevBuild (): Boolean {
326
334
val localProperties = gradleLocalProperties(rootProject.projectDir, providers)
327
335
val versionName = generateVersionName(localProperties)
328
- return versionName.contains(" dev" , ignoreCase = true ) ||
329
- versionName.contains(" alpha" , ignoreCase = true )
336
+ return versionName.contains(" dev" ) || versionName.contains(" alpha" )
330
337
}
331
338
332
339
androidComponents {
0 commit comments