You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Cleanup the gradle build configuration
These changes resolve the inconsistency between gradle and scons targets by configuring the gradle buildtypes to match the scons targets.
This commit is contained in:
committed by
Fredia Huya-Kouadio
parent
cb0b2aefc3
commit
6f2442b17a
@@ -42,6 +42,11 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
// Initializes a placeholder for the devImplementation dependency configuration.
|
||||
devImplementation {}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation libraries.kotlinStdLib
|
||||
implementation libraries.androidxFragment
|
||||
@@ -54,6 +59,7 @@ dependencies {
|
||||
// Custom build mode. In this scenario this project is the only one around and the Godot
|
||||
// library is available through the pre-generated godot-lib.*.aar android archive files.
|
||||
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar', '*.aar'])
|
||||
devImplementation fileTree(dir: 'libs/dev', include: ['*.jar', '*.aar'])
|
||||
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar', '*.aar'])
|
||||
}
|
||||
|
||||
@@ -107,7 +113,7 @@ android {
|
||||
minSdkVersion getExportMinSdkVersion()
|
||||
targetSdkVersion getExportTargetSdkVersion()
|
||||
|
||||
missingDimensionStrategy 'tools', 'toolsDisabled'
|
||||
missingDimensionStrategy 'products', 'template'
|
||||
//CHUNK_ANDROID_DEFAULTCONFIG_BEGIN
|
||||
//CHUNK_ANDROID_DEFAULTCONFIG_END
|
||||
}
|
||||
@@ -163,6 +169,18 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
dev {
|
||||
initWith debug
|
||||
// Signing and zip-aligning are skipped for prebuilt builds, but
|
||||
// performed for custom builds.
|
||||
zipAlignEnabled shouldZipAlign()
|
||||
if (shouldSign()) {
|
||||
signingConfig signingConfigs.debug
|
||||
} else {
|
||||
signingConfig null
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
// Signing and zip-aligning are skipped for prebuilt builds, but
|
||||
// performed for custom builds.
|
||||
@@ -203,6 +221,11 @@ android {
|
||||
'libs/debug'
|
||||
//DIR_JNI_DEBUG_BEGIN
|
||||
//DIR_JNI_DEBUG_END
|
||||
]
|
||||
dev.jniLibs.srcDirs = [
|
||||
'libs/dev'
|
||||
//DIR_JNI_DEV_BEGIN
|
||||
//DIR_JNI_DEV_END
|
||||
]
|
||||
release.jniLibs.srcDirs = [
|
||||
'libs/release'
|
||||
@@ -224,6 +247,12 @@ task copyAndRenameDebugApk(type: Copy) {
|
||||
rename "android_debug.apk", getExportFilename()
|
||||
}
|
||||
|
||||
task copyAndRenameDevApk(type: Copy) {
|
||||
from "$buildDir/outputs/apk/dev/android_dev.apk"
|
||||
into getExportPath()
|
||||
rename "android_dev.apk", getExportFilename()
|
||||
}
|
||||
|
||||
task copyAndRenameReleaseApk(type: Copy) {
|
||||
from "$buildDir/outputs/apk/release/android_release.apk"
|
||||
into getExportPath()
|
||||
@@ -236,6 +265,12 @@ task copyAndRenameDebugAab(type: Copy) {
|
||||
rename "build-debug.aab", getExportFilename()
|
||||
}
|
||||
|
||||
task copyAndRenameDevAab(type: Copy) {
|
||||
from "$buildDir/outputs/bundle/dev/build-dev.aab"
|
||||
into getExportPath()
|
||||
rename "build-dev.aab", getExportFilename()
|
||||
}
|
||||
|
||||
task copyAndRenameReleaseAab(type: Copy) {
|
||||
from "$buildDir/outputs/bundle/release/build-release.aab"
|
||||
into getExportPath()
|
||||
|
||||
@@ -103,7 +103,7 @@ ext.getGodotLibraryVersionName = { ->
|
||||
ext.generateGodotLibraryVersion = { List<String> requiredKeys ->
|
||||
// Attempt to read the version from the `version.py` file.
|
||||
String libraryVersionName = ""
|
||||
int libraryVersionCode = 1
|
||||
int libraryVersionCode = 0
|
||||
|
||||
File versionFile = new File("../../../version.py")
|
||||
if (versionFile.isFile()) {
|
||||
@@ -126,10 +126,20 @@ ext.generateGodotLibraryVersion = { List<String> requiredKeys ->
|
||||
if (requiredKeys.empty) {
|
||||
libraryVersionName = map.values().join(".")
|
||||
try {
|
||||
libraryVersionCode = Integer.parseInt(map["patch"]) +
|
||||
(Integer.parseInt(map["minor"]) * 100) +
|
||||
(Integer.parseInt(map["major"]) * 10000)
|
||||
} catch (NumberFormatException ignore) {}
|
||||
if (map.containsKey("patch")) {
|
||||
libraryVersionCode = Integer.parseInt(map["patch"])
|
||||
}
|
||||
|
||||
if (map.containsKey("minor")) {
|
||||
libraryVersionCode += (Integer.parseInt(map["minor"]) * 100)
|
||||
}
|
||||
|
||||
if (map.containsKey("major")) {
|
||||
libraryVersionCode += (Integer.parseInt(map["major"]) * 10000)
|
||||
}
|
||||
} catch (NumberFormatException ignore) {
|
||||
libraryVersionCode = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +147,11 @@ ext.generateGodotLibraryVersion = { List<String> requiredKeys ->
|
||||
// Fallback value in case we're unable to read the file.
|
||||
libraryVersionName = "custom_build"
|
||||
}
|
||||
|
||||
if (libraryVersionCode == 0) {
|
||||
libraryVersionCode = 1
|
||||
}
|
||||
|
||||
return [libraryVersionName, libraryVersionCode]
|
||||
}
|
||||
|
||||
@@ -147,7 +162,10 @@ ext.getGodotLibraryVersion = { ->
|
||||
|
||||
ext.getGodotPublishVersion = { ->
|
||||
List<String> requiredKeys = ["major", "minor", "patch", "status"]
|
||||
return generateGodotLibraryVersion(requiredKeys)
|
||||
String versionName = ""
|
||||
int versionCode = 1
|
||||
(versionName, versionCode) = generateGodotLibraryVersion(requiredKeys)
|
||||
return versionName
|
||||
}
|
||||
|
||||
final String VALUE_SEPARATOR_REGEX = "\\|"
|
||||
|
||||
Reference in New Issue
Block a user