2f38cfd9ab
The issue was caused by PR #36906 which changes prevented the generated shared libraries from being stripped. Since the change is only needed for development (debugging) purposes, it's commented out by default.
87 lines
2.7 KiB
Groovy
87 lines
2.7 KiB
Groovy
apply plugin: 'com.android.library'
|
|
apply plugin: 'kotlin-android'
|
|
|
|
dependencies {
|
|
implementation libraries.supportCoreUtils
|
|
implementation libraries.kotlinStdLib
|
|
implementation libraries.v4Support
|
|
}
|
|
|
|
def pathToRootDir = "../../../../"
|
|
|
|
android {
|
|
compileSdkVersion versions.compileSdk
|
|
buildToolsVersion versions.buildTools
|
|
|
|
defaultConfig {
|
|
minSdkVersion versions.minSdk
|
|
targetSdkVersion versions.targetSdk
|
|
}
|
|
|
|
lintOptions {
|
|
abortOnError false
|
|
disable 'MissingTranslation', 'UnusedResources'
|
|
}
|
|
|
|
packagingOptions {
|
|
exclude 'META-INF/LICENSE'
|
|
exclude 'META-INF/NOTICE'
|
|
|
|
// Should be uncommented for development purpose within Android Studio
|
|
// doNotStrip '**/*.so'
|
|
}
|
|
|
|
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
|
|
|
|
def releaseTarget = buildType.toLowerCase()
|
|
if (releaseTarget == null || releaseTarget == "") {
|
|
throw new GradleException("Invalid build type: " + buildType)
|
|
}
|
|
|
|
if (!supportedAbis.contains(defaultAbi)) {
|
|
throw new GradleException("Invalid default abi: " + defaultAbi)
|
|
}
|
|
|
|
// 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.
|
|
tasks["merge${buildType}JniLibFolders"].dependsOn taskName
|
|
}
|
|
|
|
externalNativeBuild {
|
|
cmake {
|
|
path "CMakeLists.txt"
|
|
}
|
|
}
|
|
}
|