blob: 4b5873ce25ec8d6aa1d69eadd697e7bee9e83500 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
apply plugin: 'com.android.library'
dependencies {
implementation libraries.supportCoreUtils
implementation libraries.kotlinStdLib
}
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'
}
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 = supportedTargets[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"
}
}
}
|