virtualx-engine/platform/android/java/build.gradle
fhuya 7fabfd402f Split the Android platform java logic into an Android library module (lib) and an application module (app).
The application module `app` serves double duties of providing the prebuilt Godot binaries ('android_debug.apk', 'android_release.apk') and the Godot custom build template ('android_source.zip').
2019-09-04 16:20:22 -07:00

95 lines
2.8 KiB
Groovy

apply from: 'app/config.gradle'
buildscript {
apply from: 'app/config.gradle'
repositories {
google()
jcenter()
}
dependencies {
classpath libraries.androidGradlePlugin
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
def binDir = "../../../bin/"
/**
* Copy the generated 'android_debug.apk' binary template into the Godot bin directory.
* Depends on the app build task to ensure the binary is generated prior to copying.
*/
task copyDebugBinaryToBin(type: Copy) {
dependsOn ':app:build'
from('app/build/outputs/apk/debug')
into(binDir)
include('android_debug.apk')
}
/**
* 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.
*/
task copyReleaseBinaryToBin(type: Copy) {
dependsOn ':app:build'
from('app/build/outputs/apk/release')
into(binDir)
include('android_release.apk')
}
/**
* Copy the Godot android library archive debug file into the app debug libs directory.
* Depends on the library build task to ensure the AAR file is generated prior to copying.
*/
task copyDebugAAR(type: Copy) {
dependsOn ':lib:build'
from('lib/build/outputs/aar')
into('app/libs/debug')
include('godot-lib.debug.aar')
}
/**
* Copy the Godot android library archive release file into the app release libs directory.
* Depends on the library build task to ensure the AAR file is generated prior to copying.
*/
task copyReleaseAAR(type: Copy) {
dependsOn ':lib:build'
from('lib/build/outputs/aar')
into('app/libs/release')
include('godot-lib.release.aar')
}
/**
* 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'.
* The zip file also includes some gradle tools to allow building of the custom build.
*/
task zipCustomBuild(type: Zip) {
dependsOn 'copyDebugAAR'
dependsOn 'copyReleaseAAR'
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))
}
/**
* Master task used to coordinate the tasks defined above to generate the set of Godot templates.
*/
task generateGodotTemplates(type: GradleBuild) {
tasks = [
// Copy the generated aar library files to the custom build directory.
'copyDebugAAR', 'copyReleaseAAR',
// Zip the custom build directory.
'zipCustomBuild',
// Copy the prebuilt binary templates to the bin directory.
'copyDebugBinaryToBin', 'copyReleaseBinaryToBin',
]
}