You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
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').
This commit is contained in:
91
platform/android/java/lib/build.gradle
Normal file
91
platform/android/java/lib/build.gradle
Normal file
@@ -0,0 +1,91 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
dependencies {
|
||||
implementation "com.android.support:support-core-utils:28.0.0"
|
||||
}
|
||||
|
||||
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
|
||||
buildToolsVersion versions.buildTools
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion versions.minSdk
|
||||
targetSdkVersion versions.targetSdk
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
disable 'MissingTranslation', 'UnusedResources'
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/NOTICE'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
aidl.srcDirs = ['aidl']
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
debug.jniLibs.srcDirs = ['libs/debug']
|
||||
release.jniLibs.srcDirs = ['libs/release']
|
||||
}
|
||||
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
output.outputFileName = "godot-lib.${variant.name}.aar"
|
||||
}
|
||||
|
||||
def buildType = variant.buildType.name.capitalize()
|
||||
|
||||
def taskPrefix = ""
|
||||
if (project.path != ":") {
|
||||
taskPrefix = project.path + ":"
|
||||
}
|
||||
|
||||
// Disable the externalNativeBuild* task as it would cause build failures since the cmake build
|
||||
// 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 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}"
|
||||
}
|
||||
}
|
||||
|
||||
// Creating gradle task to run all of the previously generated tasks.
|
||||
tasks.create(name: taskName, type: GradleBuild) {
|
||||
tasks = abiTaskNames
|
||||
}
|
||||
|
||||
// Schedule the tasks so the generated libs are present before the aar file is packaged.
|
||||
tasks["merge${buildType}JniLibFolders"].dependsOn taskName
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user