Fix project reference in task

This commit is contained in:
andrew 2023-08-15 18:42:49 +09:30
parent b09b6836d4
commit 7c8882e1f3
2 changed files with 4 additions and 3 deletions

View File

@ -42,8 +42,9 @@ def abiPostFix = ['armeabi-v7a' : 1,
'universal' : 5] 'universal' : 5]
tasks.register('checkHuaweiEnabled') { tasks.register('checkHuaweiEnabled') {
ext.huaweiEnabled = project.hasProperty('huawei')
doFirst { doFirst {
if (!project.hasProperty('huawei')) { if (!huaweiEnabled) {
def message = 'Huawei is not enabled. Please add -Phuawei command line arg. See README.' def message = 'Huawei is not enabled. Please add -Phuawei command line arg. See README.'
logger.error(message) logger.error(message)
throw new GradleException(message) throw new GradleException(message)
@ -194,7 +195,7 @@ android {
applicationVariants.all { variant -> applicationVariants.all { variant ->
if (variant.flavorName == 'huawei') { if (variant.flavorName == 'huawei') {
variant.preBuild.dependsOn checkHuaweiEnabled variant.getPreBuildProvider().get().dependsOn checkHuaweiEnabled
} }
} }
} }

View File

@ -14,7 +14,7 @@ buildscript {
classpath files('libs/gradle-witness.jar') classpath files('libs/gradle-witness.jar')
classpath "com.squareup:javapoet:1.13.0" classpath "com.squareup:javapoet:1.13.0"
classpath "com.google.dagger:hilt-android-gradle-plugin:$daggerVersion" classpath "com.google.dagger:hilt-android-gradle-plugin:$daggerVersion"
if (project.hasProperty('huawei')) classpath 'com.huawei.agconnect:agcp:1.6.0.300' if (project.hasProperty('huawei')) classpath 'com.huawei.agconnect:agcp:1.9.1.300'
} }
} }