You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +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
@@ -51,9 +51,9 @@ if lib_arch_dir != "":
|
|||||||
if env["target"] == "release":
|
if env["target"] == "release":
|
||||||
lib_type_dir = "release"
|
lib_type_dir = "release"
|
||||||
elif env["target"] == "release_debug":
|
elif env["target"] == "release_debug":
|
||||||
lib_type_dir = "release_debug"
|
|
||||||
else: # debug
|
|
||||||
lib_type_dir = "debug"
|
lib_type_dir = "debug"
|
||||||
|
else: # debug
|
||||||
|
lib_type_dir = "dev"
|
||||||
|
|
||||||
if env["tools"]:
|
if env["tools"]:
|
||||||
lib_tools_dir = "tools/"
|
lib_tools_dir = "tools/"
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
// Initializes a placeholder for the devImplementation dependency configuration.
|
||||||
|
devImplementation {}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation libraries.kotlinStdLib
|
implementation libraries.kotlinStdLib
|
||||||
implementation libraries.androidxFragment
|
implementation libraries.androidxFragment
|
||||||
@@ -54,6 +59,7 @@ dependencies {
|
|||||||
// Custom build mode. In this scenario this project is the only one around and the Godot
|
// 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.
|
// library is available through the pre-generated godot-lib.*.aar android archive files.
|
||||||
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar', '*.aar'])
|
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar', '*.aar'])
|
||||||
|
devImplementation fileTree(dir: 'libs/dev', include: ['*.jar', '*.aar'])
|
||||||
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar', '*.aar'])
|
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar', '*.aar'])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +113,7 @@ android {
|
|||||||
minSdkVersion getExportMinSdkVersion()
|
minSdkVersion getExportMinSdkVersion()
|
||||||
targetSdkVersion getExportTargetSdkVersion()
|
targetSdkVersion getExportTargetSdkVersion()
|
||||||
|
|
||||||
missingDimensionStrategy 'tools', 'toolsDisabled'
|
missingDimensionStrategy 'products', 'template'
|
||||||
//CHUNK_ANDROID_DEFAULTCONFIG_BEGIN
|
//CHUNK_ANDROID_DEFAULTCONFIG_BEGIN
|
||||||
//CHUNK_ANDROID_DEFAULTCONFIG_END
|
//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 {
|
release {
|
||||||
// Signing and zip-aligning are skipped for prebuilt builds, but
|
// Signing and zip-aligning are skipped for prebuilt builds, but
|
||||||
// performed for custom builds.
|
// performed for custom builds.
|
||||||
@@ -203,6 +221,11 @@ android {
|
|||||||
'libs/debug'
|
'libs/debug'
|
||||||
//DIR_JNI_DEBUG_BEGIN
|
//DIR_JNI_DEBUG_BEGIN
|
||||||
//DIR_JNI_DEBUG_END
|
//DIR_JNI_DEBUG_END
|
||||||
|
]
|
||||||
|
dev.jniLibs.srcDirs = [
|
||||||
|
'libs/dev'
|
||||||
|
//DIR_JNI_DEV_BEGIN
|
||||||
|
//DIR_JNI_DEV_END
|
||||||
]
|
]
|
||||||
release.jniLibs.srcDirs = [
|
release.jniLibs.srcDirs = [
|
||||||
'libs/release'
|
'libs/release'
|
||||||
@@ -224,6 +247,12 @@ task copyAndRenameDebugApk(type: Copy) {
|
|||||||
rename "android_debug.apk", getExportFilename()
|
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) {
|
task copyAndRenameReleaseApk(type: Copy) {
|
||||||
from "$buildDir/outputs/apk/release/android_release.apk"
|
from "$buildDir/outputs/apk/release/android_release.apk"
|
||||||
into getExportPath()
|
into getExportPath()
|
||||||
@@ -236,6 +265,12 @@ task copyAndRenameDebugAab(type: Copy) {
|
|||||||
rename "build-debug.aab", getExportFilename()
|
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) {
|
task copyAndRenameReleaseAab(type: Copy) {
|
||||||
from "$buildDir/outputs/bundle/release/build-release.aab"
|
from "$buildDir/outputs/bundle/release/build-release.aab"
|
||||||
into getExportPath()
|
into getExportPath()
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ ext.getGodotLibraryVersionName = { ->
|
|||||||
ext.generateGodotLibraryVersion = { List<String> requiredKeys ->
|
ext.generateGodotLibraryVersion = { List<String> requiredKeys ->
|
||||||
// Attempt to read the version from the `version.py` file.
|
// Attempt to read the version from the `version.py` file.
|
||||||
String libraryVersionName = ""
|
String libraryVersionName = ""
|
||||||
int libraryVersionCode = 1
|
int libraryVersionCode = 0
|
||||||
|
|
||||||
File versionFile = new File("../../../version.py")
|
File versionFile = new File("../../../version.py")
|
||||||
if (versionFile.isFile()) {
|
if (versionFile.isFile()) {
|
||||||
@@ -126,10 +126,20 @@ ext.generateGodotLibraryVersion = { List<String> requiredKeys ->
|
|||||||
if (requiredKeys.empty) {
|
if (requiredKeys.empty) {
|
||||||
libraryVersionName = map.values().join(".")
|
libraryVersionName = map.values().join(".")
|
||||||
try {
|
try {
|
||||||
libraryVersionCode = Integer.parseInt(map["patch"]) +
|
if (map.containsKey("patch")) {
|
||||||
(Integer.parseInt(map["minor"]) * 100) +
|
libraryVersionCode = Integer.parseInt(map["patch"])
|
||||||
(Integer.parseInt(map["major"]) * 10000)
|
}
|
||||||
} catch (NumberFormatException ignore) {}
|
|
||||||
|
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.
|
// Fallback value in case we're unable to read the file.
|
||||||
libraryVersionName = "custom_build"
|
libraryVersionName = "custom_build"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (libraryVersionCode == 0) {
|
||||||
|
libraryVersionCode = 1
|
||||||
|
}
|
||||||
|
|
||||||
return [libraryVersionName, libraryVersionCode]
|
return [libraryVersionName, libraryVersionCode]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +162,10 @@ ext.getGodotLibraryVersion = { ->
|
|||||||
|
|
||||||
ext.getGodotPublishVersion = { ->
|
ext.getGodotPublishVersion = { ->
|
||||||
List<String> requiredKeys = ["major", "minor", "patch", "status"]
|
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 = "\\|"
|
final String VALUE_SEPARATOR_REGEX = "\\|"
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ allprojects {
|
|||||||
|
|
||||||
ext {
|
ext {
|
||||||
supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"]
|
supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"]
|
||||||
supportedTargets = ["release", "release_debug", "debug"]
|
supportedTargetsMap = [release: "release", dev: "debug", debug: "release_debug"]
|
||||||
supportedFlavors = ["toolsEnabled", "toolsDisabled"]
|
supportedFlavors = ["editor", "template"]
|
||||||
|
|
||||||
// Used by gradle to specify which architecture to build for by default when running
|
// Used by gradle to specify which architecture to build for by default when running
|
||||||
// `./gradlew build` (this command is usually used by Android Studio).
|
// `./gradlew build` (this command is usually used by Android Studio).
|
||||||
@@ -55,6 +55,17 @@ task copyDebugBinaryToBin(type: Copy) {
|
|||||||
include('android_debug.apk')
|
include('android_debug.apk')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy the generated 'android_dev.apk' binary template into the Godot bin directory.
|
||||||
|
* Depends on the app build task to ensure the binary is generated prior to copying.
|
||||||
|
*/
|
||||||
|
task copyDevBinaryToBin(type: Copy) {
|
||||||
|
dependsOn ':app:assembleDev'
|
||||||
|
from('app/build/outputs/apk/dev')
|
||||||
|
into(binDir)
|
||||||
|
include('android_dev.apk')
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the generated 'android_release.apk' binary template into the Godot bin directory.
|
* Copy the generated 'android_release.apk' binary template into the Godot bin directory.
|
||||||
* Depends on the app build task to ensure the binary is generated prior to copying.
|
* Depends on the app build task to ensure the binary is generated prior to copying.
|
||||||
@@ -71,7 +82,7 @@ task copyReleaseBinaryToBin(type: Copy) {
|
|||||||
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
||||||
*/
|
*/
|
||||||
task copyDebugAARToAppModule(type: Copy) {
|
task copyDebugAARToAppModule(type: Copy) {
|
||||||
dependsOn ':lib:assembleToolsDisabledDebug'
|
dependsOn ':lib:assembleTemplateDebug'
|
||||||
from('lib/build/outputs/aar')
|
from('lib/build/outputs/aar')
|
||||||
into('app/libs/debug')
|
into('app/libs/debug')
|
||||||
include('godot-lib.debug.aar')
|
include('godot-lib.debug.aar')
|
||||||
@@ -82,18 +93,40 @@ task copyDebugAARToAppModule(type: Copy) {
|
|||||||
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
||||||
*/
|
*/
|
||||||
task copyDebugAARToBin(type: Copy) {
|
task copyDebugAARToBin(type: Copy) {
|
||||||
dependsOn ':lib:assembleToolsDisabledDebug'
|
dependsOn ':lib:assembleTemplateDebug'
|
||||||
from('lib/build/outputs/aar')
|
from('lib/build/outputs/aar')
|
||||||
into(binDir)
|
into(binDir)
|
||||||
include('godot-lib.debug.aar')
|
include('godot-lib.debug.aar')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy the Godot android library archive dev file into the app module dev libs directory.
|
||||||
|
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
||||||
|
*/
|
||||||
|
task copyDevAARToAppModule(type: Copy) {
|
||||||
|
dependsOn ':lib:assembleTemplateDev'
|
||||||
|
from('lib/build/outputs/aar')
|
||||||
|
into('app/libs/dev')
|
||||||
|
include('godot-lib.dev.aar')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy the Godot android library archive dev file into the root bin directory.
|
||||||
|
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
||||||
|
*/
|
||||||
|
task copyDevAARToBin(type: Copy) {
|
||||||
|
dependsOn ':lib:assembleTemplateDev'
|
||||||
|
from('lib/build/outputs/aar')
|
||||||
|
into(binDir)
|
||||||
|
include('godot-lib.dev.aar')
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the Godot android library archive release file into the app module release libs directory.
|
* Copy the Godot android library archive release file into the app module release libs directory.
|
||||||
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
||||||
*/
|
*/
|
||||||
task copyReleaseAARToAppModule(type: Copy) {
|
task copyReleaseAARToAppModule(type: Copy) {
|
||||||
dependsOn ':lib:assembleToolsDisabledRelease'
|
dependsOn ':lib:assembleTemplateRelease'
|
||||||
from('lib/build/outputs/aar')
|
from('lib/build/outputs/aar')
|
||||||
into('app/libs/release')
|
into('app/libs/release')
|
||||||
include('godot-lib.release.aar')
|
include('godot-lib.release.aar')
|
||||||
@@ -104,7 +137,7 @@ task copyReleaseAARToAppModule(type: Copy) {
|
|||||||
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
* Depends on the library build task to ensure the AAR file is generated prior to copying.
|
||||||
*/
|
*/
|
||||||
task copyReleaseAARToBin(type: Copy) {
|
task copyReleaseAARToBin(type: Copy) {
|
||||||
dependsOn ':lib:assembleToolsDisabledRelease'
|
dependsOn ':lib:assembleTemplateRelease'
|
||||||
from('lib/build/outputs/aar')
|
from('lib/build/outputs/aar')
|
||||||
into(binDir)
|
into(binDir)
|
||||||
include('godot-lib.release.aar')
|
include('godot-lib.release.aar')
|
||||||
@@ -112,7 +145,7 @@ task copyReleaseAARToBin(type: Copy) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate Godot custom build template by zipping the source files from the app directory, as well
|
* Generate Godot custom build template by zipping the source files from the app directory, as well
|
||||||
* as the AAR files generated by 'copyDebugAAR' and 'copyReleaseAAR'.
|
* as the AAR files generated by 'copyDebugAAR', 'copyDevAAR' and 'copyReleaseAAR'.
|
||||||
* The zip file also includes some gradle tools to allow building of the custom build.
|
* The zip file also includes some gradle tools to allow building of the custom build.
|
||||||
*/
|
*/
|
||||||
task zipCustomBuild(type: Zip) {
|
task zipCustomBuild(type: Zip) {
|
||||||
@@ -132,7 +165,13 @@ def templateExcludedBuildTask() {
|
|||||||
if (!isAndroidStudio()) {
|
if (!isAndroidStudio()) {
|
||||||
logger.lifecycle("Excluding Android studio build tasks")
|
logger.lifecycle("Excluding Android studio build tasks")
|
||||||
for (String flavor : supportedFlavors) {
|
for (String flavor : supportedFlavors) {
|
||||||
for (String buildType : supportedTargets) {
|
for (String buildType : supportedTargetsMap.keySet()) {
|
||||||
|
if (buildType == "release" && flavor == "editor") {
|
||||||
|
// The editor can't be used with target=release as debugging tools are then not
|
||||||
|
// included, and it would crash on errors instead of reporting them.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
for (String abi : selectedAbis) {
|
for (String abi : selectedAbis) {
|
||||||
excludedTasks += ":lib:" + getSconsTaskName(flavor, buildType, abi)
|
excludedTasks += ":lib:" + getSconsTaskName(flavor, buildType, abi)
|
||||||
}
|
}
|
||||||
@@ -146,11 +185,7 @@ def templateBuildTasks() {
|
|||||||
def tasks = []
|
def tasks = []
|
||||||
|
|
||||||
// Only build the apks and aar files for which we have native shared libraries.
|
// Only build the apks and aar files for which we have native shared libraries.
|
||||||
for (String target : supportedTargets) {
|
for (String target : supportedTargetsMap.keySet()) {
|
||||||
if (target == "release_debug") {
|
|
||||||
// 'release_debug' is not supported for generating templates.
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
File targetLibs = new File("lib/libs/" + target)
|
File targetLibs = new File("lib/libs/" + target)
|
||||||
if (targetLibs != null
|
if (targetLibs != null
|
||||||
&& targetLibs.isDirectory()
|
&& targetLibs.isDirectory()
|
||||||
@@ -180,21 +215,14 @@ task copyEditorDebugBinaryToBin(type: Copy) {
|
|||||||
dependsOn ':editor:assembleDebug'
|
dependsOn ':editor:assembleDebug'
|
||||||
from('editor/build/outputs/apk/debug')
|
from('editor/build/outputs/apk/debug')
|
||||||
into(binDir)
|
into(binDir)
|
||||||
include('android_editor_debug.apk')
|
include('android_editor.apk')
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyEditorRelease_debugBinaryToBin(type: Copy) {
|
task copyEditorDevBinaryToBin(type: Copy) {
|
||||||
dependsOn ':editor:assembleRelease_debug'
|
dependsOn ':editor:assembleDev'
|
||||||
from('editor/build/outputs/apk/release_debug')
|
from('editor/build/outputs/apk/dev')
|
||||||
into(binDir)
|
into(binDir)
|
||||||
include('android_editor_release_debug.apk')
|
include('android_editor_dev.apk')
|
||||||
}
|
|
||||||
|
|
||||||
task copyEditorReleaseBinaryToBin(type: Copy) {
|
|
||||||
dependsOn ':editor:assembleRelease'
|
|
||||||
from('editor/build/outputs/apk/release')
|
|
||||||
into(binDir)
|
|
||||||
include('android_editor_release.apk')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,9 +237,10 @@ task generateGodotEditor {
|
|||||||
|
|
||||||
def tasks = []
|
def tasks = []
|
||||||
|
|
||||||
for (String target : supportedTargets) {
|
for (String target : supportedTargetsMap.keySet()) {
|
||||||
if (target == "release") {
|
if (target == "release") {
|
||||||
// Skip release for now since we need to provide signing information.
|
// The editor can't be used with target=release as debugging tools are then not
|
||||||
|
// included, and it would crash on errors instead of reporting them.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
File targetLibs = new File("lib/libs/tools/" + target)
|
File targetLibs = new File("lib/libs/tools/" + target)
|
||||||
@@ -250,7 +279,27 @@ task generateDevTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean the generated artifacts.
|
* Clean the generated editor artifacts.
|
||||||
|
*/
|
||||||
|
task cleanGodotEditor(type: Delete) {
|
||||||
|
// Delete the generated native tools libs
|
||||||
|
delete("lib/libs/tools")
|
||||||
|
|
||||||
|
// Delete the library generated AAR files
|
||||||
|
delete("lib/build/outputs/aar")
|
||||||
|
|
||||||
|
// Delete the generated binary apks
|
||||||
|
delete("editor/build/outputs/apk")
|
||||||
|
|
||||||
|
// Delete the Godot editor apks in the Godot bin directory
|
||||||
|
delete("$binDir/android_editor.apk")
|
||||||
|
delete("$binDir/android_editor_dev.apk")
|
||||||
|
|
||||||
|
finalizedBy getTasksByName("clean", true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean the generated template artifacts.
|
||||||
*/
|
*/
|
||||||
task cleanGodotTemplates(type: Delete) {
|
task cleanGodotTemplates(type: Delete) {
|
||||||
// Delete the generated native libs
|
// Delete the generated native libs
|
||||||
@@ -267,9 +316,11 @@ task cleanGodotTemplates(type: Delete) {
|
|||||||
|
|
||||||
// Delete the Godot templates in the Godot bin directory
|
// Delete the Godot templates in the Godot bin directory
|
||||||
delete("$binDir/android_debug.apk")
|
delete("$binDir/android_debug.apk")
|
||||||
|
delete("$binDir/android_dev.apk")
|
||||||
delete("$binDir/android_release.apk")
|
delete("$binDir/android_release.apk")
|
||||||
delete("$binDir/android_source.zip")
|
delete("$binDir/android_source.zip")
|
||||||
delete("$binDir/godot-lib.debug.aar")
|
delete("$binDir/godot-lib.debug.aar")
|
||||||
|
delete("$binDir/godot-lib.dev.aar")
|
||||||
delete("$binDir/godot-lib.release.aar")
|
delete("$binDir/godot-lib.release.aar")
|
||||||
|
|
||||||
finalizedBy getTasksByName("clean", true)
|
finalizedBy getTasksByName("clean", true)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ android {
|
|||||||
//noinspection ExpiredTargetSdkVersion - Restrict to version 29 until https://github.com/godotengine/godot/pull/51815 is submitted
|
//noinspection ExpiredTargetSdkVersion - Restrict to version 29 until https://github.com/godotengine/godot/pull/51815 is submitted
|
||||||
targetSdkVersion 29 // versions.targetSdk
|
targetSdkVersion 29 // versions.targetSdk
|
||||||
|
|
||||||
missingDimensionStrategy 'tools', 'toolsEnabled'
|
missingDimensionStrategy 'products', 'editor'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@@ -30,13 +30,22 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
dev {
|
||||||
applicationIdSuffix ".debug"
|
initWith debug
|
||||||
|
applicationIdSuffix ".dev"
|
||||||
}
|
}
|
||||||
|
|
||||||
release_debug {
|
debug {
|
||||||
initWith debug
|
initWith release
|
||||||
applicationIdSuffix ".releaseDebug"
|
|
||||||
|
// Need to swap with the release signing config when this is ready for public release.
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
|
}
|
||||||
|
|
||||||
|
release {
|
||||||
|
// This buildtype is disabled below.
|
||||||
|
// The editor can't be used with target=release only, as debugging tools are then not
|
||||||
|
// included, and it would crash on errors instead of reporting them.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,9 +56,19 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable 'release' buildtype.
|
||||||
|
// The editor can't be used with target=release only, as debugging tools are then not
|
||||||
|
// included, and it would crash on errors instead of reporting them.
|
||||||
|
variantFilter { variant ->
|
||||||
|
if (variant.buildType.name == "release") {
|
||||||
|
setIgnore(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
variant.outputs.all { output ->
|
variant.outputs.all { output ->
|
||||||
output.outputFileName = "android_editor_${variant.name}.apk"
|
def suffix = variant.name == "dev" ? "_dev" : ""
|
||||||
|
output.outputFileName = "android_editor${suffix}.apk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="godot_editor_name_string">Godot Editor (debug)</string>
|
|
||||||
</resources>
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="godot_editor_name_string">Godot Editor (dev)</string>
|
||||||
|
</resources>
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="godot_editor_name_string">Godot Editor (release-debug)</string>
|
|
||||||
</resources>
|
|
||||||
@@ -35,15 +35,15 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release_debug {
|
dev {
|
||||||
initWith debug
|
initWith debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "tools"
|
flavorDimensions "products"
|
||||||
productFlavors {
|
productFlavors {
|
||||||
toolsEnabled {}
|
editor {}
|
||||||
toolsDisabled {}
|
template {}
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
@@ -71,32 +71,43 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug.jniLibs.srcDirs = ['libs/debug']
|
debug.jniLibs.srcDirs = ['libs/debug']
|
||||||
release_debug.jniLibs.srcDirs = ['libs/release_debug']
|
dev.jniLibs.srcDirs = ['libs/dev']
|
||||||
release.jniLibs.srcDirs = ['libs/release']
|
release.jniLibs.srcDirs = ['libs/release']
|
||||||
|
|
||||||
// Tools enabled jni library
|
// Editor jni library
|
||||||
toolsEnabledDebug.jniLibs.srcDirs = ['libs/tools/debug']
|
editorDebug.jniLibs.srcDirs = ['libs/tools/debug']
|
||||||
toolsEnabledRelease_debug.jniLibs.srcDirs = ['libs/tools/release_debug']
|
editorDev.jniLibs.srcDirs = ['libs/tools/dev']
|
||||||
toolsEnabledRelease.jniLibs.srcDirs = ['libs/tools/release']
|
}
|
||||||
|
|
||||||
|
// Disable 'editorRelease'.
|
||||||
|
// The editor can't be used with target=release as debugging tools are then not
|
||||||
|
// included, and it would crash on errors instead of reporting them.
|
||||||
|
variantFilter { variant ->
|
||||||
|
if (variant.name == "editorRelease") {
|
||||||
|
setIgnore(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
libraryVariants.all { variant ->
|
libraryVariants.all { variant ->
|
||||||
def flavorName = variant.getFlavorName()
|
def flavorName = variant.getFlavorName()
|
||||||
def buildType = variant.buildType.name.capitalize()
|
|
||||||
|
|
||||||
if (flavorName == null || flavorName == "") {
|
if (flavorName == null || flavorName == "") {
|
||||||
throw new GradleException("Invalid product flavor: $flavorName")
|
throw new GradleException("Invalid product flavor: $flavorName")
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean toolsFlag = flavorName == "toolsEnabled"
|
boolean toolsFlag = flavorName == "editor"
|
||||||
|
|
||||||
def releaseTarget = buildType.toLowerCase()
|
def buildType = variant.buildType.name
|
||||||
if (releaseTarget == null || releaseTarget == "") {
|
if (buildType == null || buildType == "" || !supportedTargetsMap.containsKey(buildType)) {
|
||||||
throw new GradleException("Invalid build type: " + buildType)
|
throw new GradleException("Invalid build type: $buildType")
|
||||||
|
}
|
||||||
|
|
||||||
|
def sconsTarget = supportedTargetsMap[buildType]
|
||||||
|
if (sconsTarget == null || sconsTarget == "") {
|
||||||
|
throw new GradleException("Invalid scons target: $sconsTarget")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the name of the generated library
|
// Update the name of the generated library
|
||||||
def outputSuffix = "${releaseTarget}.aar"
|
def outputSuffix = "${buildType}.aar"
|
||||||
if (toolsFlag) {
|
if (toolsFlag) {
|
||||||
outputSuffix = "tools.$outputSuffix"
|
outputSuffix = "tools.$outputSuffix"
|
||||||
}
|
}
|
||||||
@@ -138,24 +149,24 @@ android {
|
|||||||
|
|
||||||
for (String selectedAbi : selectedAbis) {
|
for (String selectedAbi : selectedAbis) {
|
||||||
if (!supportedAbis.contains(selectedAbi)) {
|
if (!supportedAbis.contains(selectedAbi)) {
|
||||||
throw new GradleException("Invalid selected abi: " + selectedAbi)
|
throw new GradleException("Invalid selected abi: $selectedAbi")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creating gradle task to generate the native libraries for the selected abi.
|
// Creating gradle task to generate the native libraries for the selected abi.
|
||||||
def taskName = getSconsTaskName(flavorName, buildType, selectedAbi)
|
def taskName = getSconsTaskName(flavorName, buildType, selectedAbi)
|
||||||
tasks.create(name: taskName, type: Exec) {
|
tasks.create(name: taskName, type: Exec) {
|
||||||
executable sconsExecutableFile.absolutePath
|
executable sconsExecutableFile.absolutePath
|
||||||
args "--directory=${pathToRootDir}", "platform=android", "tools=${toolsFlag}", "target=${releaseTarget}", "android_arch=${selectedAbi}", "-j" + Runtime.runtime.availableProcessors()
|
args "--directory=${pathToRootDir}", "platform=android", "tools=${toolsFlag}", "target=${sconsTarget}", "android_arch=${selectedAbi}", "-j" + Runtime.runtime.availableProcessors()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schedule the tasks so the generated libs are present before the aar file is packaged.
|
// Schedule the tasks so the generated libs are present before the aar file is packaged.
|
||||||
tasks["merge${flavorName.capitalize()}${buildType}JniLibFolders"].dependsOn taskName
|
tasks["merge${flavorName.capitalize()}${buildType.capitalize()}JniLibFolders"].dependsOn taskName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Enable when issues with AGP 7.1+ are resolved (https://github.com/GodotVR/godot_openxr/issues/187).
|
// TODO: Enable when issues with AGP 7.1+ are resolved (https://github.com/GodotVR/godot_openxr/issues/187).
|
||||||
// publishing {
|
// publishing {
|
||||||
// singleVariant("release") {
|
// singleVariant("templateRelease") {
|
||||||
// withSourcesJar()
|
// withSourcesJar()
|
||||||
// withJavadocJar()
|
// withJavadocJar()
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -7,20 +7,15 @@ version = PUBLISH_VERSION
|
|||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
release(MavenPublication) {
|
templateRelease(MavenPublication) {
|
||||||
|
from components.templateRelease
|
||||||
|
|
||||||
// The coordinates of the library, being set from variables that
|
// The coordinates of the library, being set from variables that
|
||||||
// we'll set up later
|
// we'll set up later
|
||||||
groupId ossrhGroupId
|
groupId ossrhGroupId
|
||||||
artifactId PUBLISH_ARTIFACT_ID
|
artifactId PUBLISH_ARTIFACT_ID
|
||||||
version PUBLISH_VERSION
|
version PUBLISH_VERSION
|
||||||
|
|
||||||
// Two artifacts, the `aar` (or `jar`) and the sources
|
|
||||||
if (project.plugins.findPlugin("com.android.library")) {
|
|
||||||
from components.release
|
|
||||||
} else {
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mostly self-explanatory metadata
|
// Mostly self-explanatory metadata
|
||||||
pom {
|
pom {
|
||||||
name = PUBLISH_ARTIFACT_ID
|
name = PUBLISH_ARTIFACT_ID
|
||||||
|
|||||||
Reference in New Issue
Block a user