2021-06-25 13:45:16 +00:00
|
|
|
// Gradle build config for Godot Engine's Android port.
|
2022-05-31 18:10:15 +00:00
|
|
|
plugins {
|
|
|
|
id 'com.android.application'
|
|
|
|
id 'org.jetbrains.kotlin.android'
|
2024-01-17 21:44:11 +00:00
|
|
|
id 'base'
|
2022-05-31 18:10:15 +00:00
|
|
|
}
|
2021-06-25 13:45:16 +00:00
|
|
|
|
2022-09-12 04:33:17 +00:00
|
|
|
ext {
|
2023-03-01 22:09:30 +00:00
|
|
|
// Retrieve the build number from the environment variable; default to 0 if none is specified.
|
|
|
|
// The build number is added as a suffix to the version code for upload to the Google Play store.
|
|
|
|
getEditorBuildNumber = { ->
|
|
|
|
int buildNumber = 0
|
|
|
|
String versionStatus = System.getenv("GODOT_VERSION_STATUS")
|
|
|
|
if (versionStatus != null && !versionStatus.isEmpty()) {
|
|
|
|
try {
|
2024-04-01 20:46:46 +00:00
|
|
|
buildNumber = Integer.parseInt(versionStatus.replaceAll("[^0-9]", ""))
|
2023-03-01 22:09:30 +00:00
|
|
|
} catch (NumberFormatException ignored) {
|
|
|
|
buildNumber = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return buildNumber
|
|
|
|
}
|
2022-09-12 04:33:17 +00:00
|
|
|
// Value by which the Godot version code should be offset by to make room for the build number
|
|
|
|
editorBuildNumberOffset = 100
|
2023-03-01 22:09:30 +00:00
|
|
|
|
|
|
|
// Return the keystore file used for signing the release build.
|
|
|
|
getGodotKeystoreFile = { ->
|
|
|
|
def keyStore = System.getenv("GODOT_ANDROID_SIGN_KEYSTORE")
|
2024-08-28 15:24:54 +00:00
|
|
|
if (keyStore == null || keyStore.isEmpty()) {
|
2023-03-01 22:09:30 +00:00
|
|
|
return null
|
|
|
|
}
|
|
|
|
return file(keyStore)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return the key alias used for signing the release build.
|
|
|
|
getGodotKeyAlias = { ->
|
|
|
|
def kAlias = System.getenv("GODOT_ANDROID_KEYSTORE_ALIAS")
|
|
|
|
return kAlias
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return the password for the key used for signing the release build.
|
|
|
|
getGodotSigningPassword = { ->
|
|
|
|
def signingPassword = System.getenv("GODOT_ANDROID_SIGN_PASSWORD")
|
|
|
|
return signingPassword
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns true if the environment variables contains the configuration for signing the release
|
|
|
|
// build.
|
|
|
|
hasReleaseSigningConfigs = { ->
|
|
|
|
def keystoreFile = getGodotKeystoreFile()
|
|
|
|
def keyAlias = getGodotKeyAlias()
|
|
|
|
def signingPassword = getGodotSigningPassword()
|
|
|
|
|
|
|
|
return keystoreFile != null && keystoreFile.isFile()
|
|
|
|
&& keyAlias != null && !keyAlias.isEmpty()
|
|
|
|
&& signingPassword != null && !signingPassword.isEmpty()
|
|
|
|
}
|
2022-09-12 04:33:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def generateVersionCode() {
|
|
|
|
int libraryVersionCode = getGodotLibraryVersionCode()
|
2023-03-01 22:09:30 +00:00
|
|
|
return (libraryVersionCode * editorBuildNumberOffset) + getEditorBuildNumber()
|
2022-09-12 04:33:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def generateVersionName() {
|
|
|
|
String libraryVersionName = getGodotLibraryVersionName()
|
2023-03-01 22:09:30 +00:00
|
|
|
int buildNumber = getEditorBuildNumber()
|
|
|
|
return buildNumber == 0 ? libraryVersionName : libraryVersionName + ".$buildNumber"
|
2022-09-12 04:33:17 +00:00
|
|
|
}
|
|
|
|
|
2021-06-25 13:45:16 +00:00
|
|
|
android {
|
|
|
|
compileSdkVersion versions.compileSdk
|
|
|
|
buildToolsVersion versions.buildTools
|
|
|
|
ndkVersion versions.ndkVersion
|
|
|
|
|
2024-01-17 21:44:11 +00:00
|
|
|
namespace = "org.godotengine.editor"
|
|
|
|
|
2021-06-25 13:45:16 +00:00
|
|
|
defaultConfig {
|
|
|
|
// The 'applicationId' suffix allows to install Godot 3.x(v3) and 4.x(v4) on the same device
|
|
|
|
applicationId "org.godotengine.editor.v4"
|
2022-09-12 04:33:17 +00:00
|
|
|
versionCode generateVersionCode()
|
|
|
|
versionName generateVersionName()
|
2021-06-25 13:45:16 +00:00
|
|
|
minSdkVersion versions.minSdk
|
2021-07-11 01:39:31 +00:00
|
|
|
targetSdkVersion versions.targetSdk
|
2021-06-25 13:45:16 +00:00
|
|
|
|
|
|
|
missingDimensionStrategy 'products', 'editor'
|
2024-06-09 16:22:45 +00:00
|
|
|
manifestPlaceholders += [
|
|
|
|
editorAppName: "Godot Editor 4",
|
|
|
|
editorBuildSuffix: ""
|
|
|
|
]
|
2024-01-17 21:44:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
base {
|
|
|
|
archivesName = "android_editor"
|
2021-06-25 13:45:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility versions.javaVersion
|
|
|
|
targetCompatibility versions.javaVersion
|
|
|
|
}
|
|
|
|
|
2022-05-31 18:10:15 +00:00
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = versions.javaVersion
|
|
|
|
}
|
|
|
|
|
2023-03-01 22:09:30 +00:00
|
|
|
signingConfigs {
|
|
|
|
release {
|
|
|
|
storeFile getGodotKeystoreFile()
|
|
|
|
storePassword getGodotSigningPassword()
|
|
|
|
keyAlias getGodotKeyAlias()
|
|
|
|
keyPassword getGodotSigningPassword()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-17 21:44:11 +00:00
|
|
|
buildFeatures {
|
|
|
|
buildConfig = true
|
|
|
|
}
|
|
|
|
|
2021-06-25 13:45:16 +00:00
|
|
|
buildTypes {
|
|
|
|
dev {
|
|
|
|
initWith debug
|
|
|
|
applicationIdSuffix ".dev"
|
2024-06-09 16:22:45 +00:00
|
|
|
manifestPlaceholders += [editorBuildSuffix: " (dev)"]
|
2021-06-25 13:45:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
debug {
|
|
|
|
initWith release
|
2023-03-01 22:09:30 +00:00
|
|
|
applicationIdSuffix ".debug"
|
2024-06-09 16:22:45 +00:00
|
|
|
manifestPlaceholders += [editorBuildSuffix: " (debug)"]
|
2021-06-25 13:45:16 +00:00
|
|
|
signingConfig signingConfigs.debug
|
|
|
|
}
|
|
|
|
|
|
|
|
release {
|
2023-03-01 22:09:30 +00:00
|
|
|
if (hasReleaseSigningConfigs()) {
|
|
|
|
signingConfig signingConfigs.release
|
|
|
|
}
|
2021-06-25 13:45:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
packagingOptions {
|
|
|
|
// 'doNotStrip' is enabled for development within Android Studio
|
|
|
|
if (shouldNotStrip()) {
|
|
|
|
doNotStrip '**/*.so'
|
|
|
|
}
|
|
|
|
}
|
2024-04-20 17:24:11 +00:00
|
|
|
|
|
|
|
flavorDimensions = ["vendor"]
|
|
|
|
productFlavors {
|
|
|
|
google {
|
|
|
|
dimension "vendor"
|
|
|
|
missingDimensionStrategy 'products', 'editor'
|
|
|
|
}
|
|
|
|
meta {
|
|
|
|
dimension "vendor"
|
|
|
|
missingDimensionStrategy 'products', 'editor'
|
|
|
|
ndk {
|
|
|
|
//noinspection ChromeOsAbiSupport
|
|
|
|
abiFilters "arm64-v8a"
|
|
|
|
}
|
|
|
|
applicationIdSuffix ".meta"
|
|
|
|
versionNameSuffix "-meta"
|
|
|
|
minSdkVersion 23
|
|
|
|
targetSdkVersion 32
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation "androidx.fragment:fragment:$versions.fragmentVersion"
|
|
|
|
implementation project(":lib")
|
|
|
|
|
|
|
|
implementation "androidx.window:window:1.3.0"
|
|
|
|
implementation "androidx.core:core-splashscreen:$versions.splashscreenVersion"
|
|
|
|
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
|
|
|
|
implementation "org.bouncycastle:bcprov-jdk15to18:1.77"
|
|
|
|
|
|
|
|
// Meta dependencies
|
|
|
|
metaImplementation "org.godotengine:godot-openxr-vendors-meta:3.0.0-stable"
|
2021-06-25 13:45:16 +00:00
|
|
|
}
|