From 5751822e310e469dbafc46b038789cf97a7ce4d9 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sun, 11 Jun 2023 19:26:36 -0400 Subject: [PATCH] android: Use autoVersion when gradle property is set --- src/android/app/build.gradle.kts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts index d4698ae1c5..fe613d339b 100644 --- a/src/android/app/build.gradle.kts +++ b/src/android/app/build.gradle.kts @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later import android.annotation.SuppressLint +import org.jetbrains.kotlin.konan.properties.Properties plugins { id("com.android.application") @@ -57,9 +58,22 @@ android { applicationId = "org.yuzu.yuzu_emu" minSdk = 30 targetSdk = 33 - versionCode = 1 versionName = getGitVersion() + // If you want to use autoVersion for the versionCode, create a property in local.properties + // named "autoVersioned" and set it to "true" + val properties = Properties() + val versionProperty = try { + properties.load(project.rootProject.file("local.properties").inputStream()) + properties.getProperty("autoVersioned") ?: "" + } catch (e: Exception) { "" } + + versionCode = if (versionProperty == "true") { + autoVersion + } else { + 1 + } + ndk { @SuppressLint("ChromeOsAbiSupport") abiFilters += listOf("arm64-v8a")