Miscellaneous cleanup for the Android codebase:

- update gradle plugins versions
- add formatting rules for AndroidManifest and gradle build files
- cleanup java_godot_lib_jni

Note: logic was mostly moved around and no new logic/functionality was added.
This commit is contained in:
fhuya 2020-03-04 09:21:59 -08:00
parent 080b5df625
commit b38283a6b7
13 changed files with 1156 additions and 1013 deletions

View file

@ -80,33 +80,33 @@ android {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = [
'src'
'src'
//DIR_SRC_BEGIN
//DIR_SRC_END
]
res.srcDirs = [
'res'
'res'
//DIR_RES_BEGIN
//DIR_RES_END
]
aidl.srcDirs = [
'aidl'
'aidl'
//DIR_AIDL_BEGIN
//DIR_AIDL_END
]
assets.srcDirs = [
'assets'
'assets'
//DIR_ASSETS_BEGIN
//DIR_ASSETS_END
]
}
debug.jniLibs.srcDirs = [
'libs/debug'
'libs/debug'
//DIR_JNI_DEBUG_BEGIN
//DIR_JNI_DEBUG_END
]
release.jniLibs.srcDirs = [
'libs/release'
'libs/release'
//DIR_JNI_RELEASE_BEGIN
//DIR_JNI_RELEASE_END
]

View file

@ -1,24 +1,24 @@
ext.versions = [
androidGradlePlugin : '3.4.2',
compileSdk : 28,
minSdk : 18,
targetSdk : 28,
buildTools : '28.0.3',
supportCoreUtils : '28.0.0'
androidGradlePlugin: '3.6.0',
compileSdk : 29,
minSdk : 18,
targetSdk : 29,
buildTools : '29.0.1',
supportCoreUtils : '28.0.0'
]
ext.libraries = [
androidGradlePlugin : "com.android.tools.build:gradle:$versions.androidGradlePlugin",
supportCoreUtils : "com.android.support:support-core-utils:$versions.supportCoreUtils"
androidGradlePlugin: "com.android.tools.build:gradle:$versions.androidGradlePlugin",
supportCoreUtils : "com.android.support:support-core-utils:$versions.supportCoreUtils"
]
ext.getExportPackageName = { ->
// Retrieve the app id from the project property set by the Godot build command.
String appId = project.hasProperty("export_package_name") ? project.property("export_package_name") : ""
// Check if the app id is valid, otherwise use the default.
if (appId == null || appId.isEmpty()) {
appId = "com.godot.game"
}
return appId
// Retrieve the app id from the project property set by the Godot build command.
String appId = project.hasProperty("export_package_name") ? project.property("export_package_name") : ""
// Check if the app id is valid, otherwise use the default.
if (appId == null || appId.isEmpty()) {
appId = "com.godot.game"
}
return appId
}

View file

@ -24,7 +24,7 @@ ext {
sconsExt = org.gradle.internal.os.OperatingSystem.current().isWindows() ? ".bat" : ""
supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"]
supportedTargets = ['release':"release", 'debug':"release_debug"]
supportedTargets = ['release': "release", 'debug': "release_debug"]
// Used by gradle to specify which architecture to build for by default when running `./gradlew build`.
// This command is usually used by Android Studio.
@ -95,7 +95,7 @@ task zipCustomBuild(type: Zip) {
doFirst {
logger.lifecycle("Generating Godot custom build template")
}
from(fileTree(dir: 'app', excludes: ['**/build/**', '**/.gradle/**', '**/*.iml']), fileTree(dir: '.', includes: ['gradle.properties','gradlew', 'gradlew.bat', 'gradle/**']))
from(fileTree(dir: 'app', excludes: ['**/build/**', '**/.gradle/**', '**/*.iml']), fileTree(dir: '.', includes: ['gradle.properties', 'gradlew', 'gradlew.bat', 'gradle/**']))
include '**/*'
archiveName 'android_source.zip'
destinationDir(file(binDir))
@ -133,20 +133,20 @@ task generateGodotTemplates(type: GradleBuild) {
* Clean the generated artifacts.
*/
task cleanGodotTemplates(type: Delete) {
// Delete the generated native libs
delete("lib/libs")
// Delete the generated native libs
delete("lib/libs")
// Delete the library generated AAR files
delete("lib/build/outputs/aar")
// Delete the library generated AAR files
delete("lib/build/outputs/aar")
// Delete the app libs directory contents
delete("app/libs")
// Delete the app libs directory contents
delete("app/libs")
// Delete the generated binary apks
delete("app/build/outputs/apk")
// Delete the generated binary apks
delete("app/build/outputs/apk")
// Delete the Godot templates in the Godot bin directory
delete("$binDir/android_debug.apk")
delete("$binDir/android_release.apk")
delete("$binDir/android_source.zip")
// Delete the Godot templates in the Godot bin directory
delete("$binDir/android_debug.apk")
delete("$binDir/android_release.apk")
delete("$binDir/android_source.zip")
}

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip