diff options
author | fhuya <fhuya@google.com> | 2019-09-22 22:23:59 -0700 |
---|---|---|
committer | fhuya <fhuya@google.com> | 2019-09-24 06:18:21 -0700 |
commit | ef143447adc31eae038940efc8bc8dffbec5a18b (patch) | |
tree | 32808077c2508c80e3daf3c15f4de3fe1828dfda /platform/android/java/lib | |
parent | 2e065d8ad07bb20fede0d0c0b2d33d6628033024 (diff) |
Updates the Godot gradle tasks to enable manual runs of the `scons` command.
Example: To generate for the `release` build target and for the `armv7`, `arm64v8` and `x86` architectures, run the commands:
```
cd godot
scons -j4 platform=android target=release android_arch=armv7
scons -j4 platform=android target=release android_arch=arm64v8
scons -j4 platform=android target=release android_arch=x86
cd platform/android/java
./gradlew generateGodotTemplates
```
Notes:
- The generated build templates will be located in the `godot/bin` directory (i.e: `android_debug.apk`, `android_release.apk`, `android_source.zip`).
- The gradle command will only generate templates for the target(s) with available native shared libraries. For example, running the commands above will only generate the `android_release.apk` and `android_source.zip` files.
To delete the generated artifacts, the following commands can be used:
```
cd platform/android/java
./gradlew cleanGodotTemplates
```
Diffstat (limited to 'platform/android/java/lib')
-rw-r--r-- | platform/android/java/lib/build.gradle | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/platform/android/java/lib/build.gradle b/platform/android/java/lib/build.gradle index 6d07504e45..13a14422ed 100644 --- a/platform/android/java/lib/build.gradle +++ b/platform/android/java/lib/build.gradle @@ -5,8 +5,6 @@ dependencies { } def pathToRootDir = "../../../../" -// Note: Only keep the abis you support to speed up the gradle 'assemble' task. -def supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"] android { compileSdkVersion versions.compileSdk @@ -56,27 +54,20 @@ android { // files is only setup for editing support. gradle.startParameter.excludedTaskNames += taskPrefix + "externalNativeBuild" + buildType - // Create tasks to generate the Godot native libraries. - def taskName = "compileGodotNativeLibs" + buildType - def releaseTarget = "release" - if (buildType == "Debug") { - releaseTarget += "_debug" + def releaseTarget = supportedTargets[buildType.toLowerCase()] + if (releaseTarget == null || releaseTarget == "") { + throw new GradleException("Invalid build type: " + buildType) } - def abiTaskNames = [] - // Creating gradle tasks to generate the native libraries for the supported abis. - supportedAbis.each { abi -> - def abiTaskName = taskName + abi.capitalize() - abiTaskNames += abiTaskName - tasks.create(name: abiTaskName, type: Exec) { - executable "scons" - args "--directory=${pathToRootDir}", "platform=android", "target=${releaseTarget}", "android_arch=${abi}" - } + if (!supportedAbis.contains(defaultAbi)) { + throw new GradleException("Invalid default abi: " + defaultAbi) } - // Creating gradle task to run all of the previously generated tasks. - tasks.create(name: taskName, type: GradleBuild) { - tasks = abiTaskNames + // Creating gradle task to generate the native libraries for the default abi. + def taskName = getSconsTaskName(buildType) + tasks.create(name: taskName, type: Exec) { + executable "scons" + sconsExt + args "--directory=${pathToRootDir}", "platform=android", "target=${releaseTarget}", "android_arch=${defaultAbi}", "-j" + Runtime.runtime.availableProcessors() } // Schedule the tasks so the generated libs are present before the aar file is packaged. |