From 1b6bc71e51b552dee1473c07a962c006331bfde4 Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Fri, 29 Dec 2023 00:13:09 +0800 Subject: [PATCH] chore: some tweaks in build.gradle.kts --- demo-app/build.gradle.kts | 8 +++++++- module-app/build.gradle.kts | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/demo-app/build.gradle.kts b/demo-app/build.gradle.kts index af7410d..e04f38a 100644 --- a/demo-app/build.gradle.kts +++ b/demo-app/build.gradle.kts @@ -63,7 +63,13 @@ androidComponents { onVariants(selector().all()) { it.outputs.forEach { output -> val currentType = it.buildType - val currentSuffix = property.github.ci.commit.id.let { suffix -> if (suffix.isNotBlank()) "-$suffix" else "" } + + // Workaround for GitHub Actions. + // Why? I don't know, but it works. + // Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: + // public inline fun CharSequence.isNotBlank(): Boolean defined in kotlin.text. + @Suppress("UNNECESSARY_SAFE_CALL") + val currentSuffix = property.github.ci.commit.id?.let { suffix -> if (suffix.isNotBlank()) "-$suffix" else "" } val currentVersion = "${output.versionName.get()}$currentSuffix(${output.versionCode.get()})" if (output is com.android.build.api.variant.impl.VariantOutputImpl) output.outputFileName.set("${property.project.name}-demo-v$currentVersion-$currentType.apk") diff --git a/module-app/build.gradle.kts b/module-app/build.gradle.kts index f09350f..b445dc2 100644 --- a/module-app/build.gradle.kts +++ b/module-app/build.gradle.kts @@ -59,7 +59,13 @@ androidComponents { onVariants(selector().all()) { it.outputs.forEach { output -> val currentType = it.buildType - val currentSuffix = property.github.ci.commit.id.let { suffix -> if (suffix.isNotBlank()) "-$suffix" else "" } + + // Workaround for GitHub Actions. + // Why? I don't know, but it works. + // Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: + // public inline fun CharSequence.isNotBlank(): Boolean defined in kotlin.text. + @Suppress("UNNECESSARY_SAFE_CALL") + val currentSuffix = property.github.ci.commit.id?.let { suffix -> if (suffix.isNotBlank()) "-$suffix" else "" } val currentVersion = "${output.versionName.get()}$currentSuffix(${output.versionCode.get()})" if (output is com.android.build.api.variant.impl.VariantOutputImpl) output.outputFileName.set("${property.project.name}-module-v$currentVersion-$currentType.apk")