2019-09-03 02:31:51 +02:00
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
|
|
|
|
dependencies {
|
2020-01-27 19:45:25 +01:00
|
|
|
implementation libraries.supportCoreUtils
|
2019-10-18 18:59:04 +02:00
|
|
|
implementation libraries.v4Support
|
2019-09-03 02:31:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
def pathToRootDir = "../../../../"
|
|
|
|
|
|
|
|
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'
|
2020-03-08 12:34:44 +01:00
|
|
|
doNotStrip '**/*.so'
|
2019-09-03 02:31:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-03-08 12:34:44 +01:00
|
|
|
def releaseTarget = buildType.toLowerCase()
|
2019-09-23 07:23:59 +02:00
|
|
|
if (releaseTarget == null || releaseTarget == "") {
|
|
|
|
throw new GradleException("Invalid build type: " + buildType)
|
2019-09-03 02:31:51 +02:00
|
|
|
}
|
|
|
|
|
2019-09-23 07:23:59 +02:00
|
|
|
if (!supportedAbis.contains(defaultAbi)) {
|
|
|
|
throw new GradleException("Invalid default abi: " + defaultAbi)
|
2019-09-03 02:31:51 +02:00
|
|
|
}
|
|
|
|
|
2019-09-23 07:23:59 +02:00
|
|
|
// 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()
|
2019-09-03 02:31:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|