From bf03f5c9ae287a2245e99189a15e6e8439b6625a Mon Sep 17 00:00:00 2001 From: albexk Date: Tue, 5 Dec 2023 23:53:49 +0300 Subject: [PATCH] Fix for Qt Creator --- client/android/build.gradle.kts | 14 ++++++++++++++ .../plugins/src/main/kotlin/PropertyDelegate.kt | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/android/build.gradle.kts b/client/android/build.gradle.kts index ee6e8e27..cbc2de8d 100644 --- a/client/android/build.gradle.kts +++ b/client/android/build.gradle.kts @@ -1,3 +1,5 @@ +import com.android.build.gradle.internal.api.BaseVariantOutputImpl + plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) @@ -11,6 +13,7 @@ kotlin { // get values from gradle or local properties val qtTargetSdkVersion: String by gradleProperties val qtTargetAbiList: String by gradleProperties +val outputBaseName: String by gradleProperties android { namespace = "org.amnezia.vpn" @@ -76,6 +79,17 @@ android { } } + // fix for Qt Creator to allow deploying the application to a device + // to enable this fix, add the line outputBaseName=android-build to local.properties + if (outputBaseName.isNotEmpty()) { + applicationVariants.all { + outputs.map { it as BaseVariantOutputImpl } + .forEach { output -> + output.outputFileName = "$outputBaseName-${buildType.name}.apk" + } + } + } + lint { disable += "InvalidFragmentVersionForActivityResult" } diff --git a/client/android/gradle/plugins/src/main/kotlin/PropertyDelegate.kt b/client/android/gradle/plugins/src/main/kotlin/PropertyDelegate.kt index c5e721d5..462cc689 100644 --- a/client/android/gradle/plugins/src/main/kotlin/PropertyDelegate.kt +++ b/client/android/gradle/plugins/src/main/kotlin/PropertyDelegate.kt @@ -24,7 +24,7 @@ private class PropertyDelegate( private val localProperties: Properties = localProperties(rootDir) ) : ReadOnlyProperty { override fun getValue(thisRef: Any?, property: KProperty<*>): String = - providers.gradleProperty(property.name).orNull ?: localProperties.getProperty(property.name) + providers.gradleProperty(property.name).orNull ?: localProperties.getProperty(property.name).orEmpty() } private lateinit var settingsPropertyDelegate: ReadOnlyProperty