@@ -19,6 +19,7 @@ plugins {
19
19
20
20
val repoRootPath = rootProject.projectDir.absoluteFile.parentFile.absolutePath
21
21
val extraAssetsDirectory = " ${project.buildDir} /extraAssets"
22
+ val relayListPath = " $extraAssetsDirectory /relays.json"
22
23
val defaultChangelogAssetsDirectory = " $repoRootPath /android/src/main/play/release-notes/"
23
24
val extraJniDirectory = " ${project.buildDir} /extraJni"
24
25
@@ -146,10 +147,6 @@ android {
146
147
)
147
148
}
148
149
149
- tasks.withType<MergeSourceSetFolders > { dependsOn(getTasksByName(" copyExtraAssets" , true )) }
150
-
151
- tasks.withType<LintModelWriterTask > { dependsOn(getTasksByName(" copyExtraAssets" , true )) }
152
-
153
150
// Suppressing since we don't seem have much of an option than using this api. The impact should
154
151
// also be limited to tests.
155
152
@Suppress(" UnstableApiUsage" )
@@ -238,10 +235,14 @@ android {
238
235
}
239
236
240
237
createDistBundle.dependsOn(" bundle$capitalizedVariantName " )
241
- }
242
238
243
- project.tasks.assemble.dependsOn(" ensureJniDirectoryExist" )
244
- project.tasks.assemble.dependsOn(" ensureValidVersionCode" )
239
+ // Ensure all relevant assemble tasks depend on our ensure tasks.
240
+ tasks.get(" assemble$capitalizedVariantName " ).apply {
241
+ dependsOn(tasks.get(" ensureRelayListExist" ))
242
+ dependsOn(tasks.get(" ensureJniDirectoryExist" ))
243
+ dependsOn(tasks.get(" ensureValidVersionCode" ))
244
+ }
245
+ }
245
246
}
246
247
247
248
junitPlatform {
@@ -274,14 +275,16 @@ configure<org.owasp.dependencycheck.gradle.extension.DependencyCheckExtension> {
274
275
skipConfigurations = listOf (" lintClassPath" )
275
276
}
276
277
277
- tasks.register(" copyExtraAssets" , Copy ::class ) {
278
- from(" $repoRootPath /build" )
279
- include(" relays.json" )
280
- into(extraAssetsDirectory)
278
+ tasks.register(" ensureRelayListExist" ) {
279
+ doLast {
280
+ if (! file(relayListPath).exists()) {
281
+ throw GradleException (" Missing relay list: $relayListPath " )
282
+ }
283
+ }
281
284
}
282
285
283
286
tasks.register(" ensureJniDirectoryExist" ) {
284
- doFirst {
287
+ doLast {
285
288
if (! file(extraJniDirectory).exists()) {
286
289
throw GradleException (" Missing JNI directory: $extraJniDirectory " )
287
290
}
@@ -306,12 +309,6 @@ tasks.create("printVersion") {
306
309
}
307
310
}
308
311
309
- afterEvaluate {
310
- tasks.withType(com.android.build.gradle.internal.lint.AndroidLintAnalysisTask ::class .java) {
311
- mustRunAfter(tasks.getByName(" copyExtraAssets" ))
312
- }
313
- }
314
-
315
312
play { serviceAccountCredentials.set(file(" play-api-key.json" )) }
316
313
317
314
dependencies {
0 commit comments