-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgradle-task-hook.txt
39 lines (33 loc) · 1.23 KB
/
gradle-task-hook.txt
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
task build_native(type: Exec) {
println "start build native so..."
String buildPath = buildDir;
String workspace = buildPath.substring(0, buildPath.lastIndexOf(File.separator))
String os = System.getProperty("os.name");
String batPath = ""
if (os.toLowerCase().startsWith("win")) {
batPath = workspace + File.separator + "abtor_build.bat"
commandLine batPath, workspace
} else {
batPath = workspace + File.separator + "abtor_build.sh"
commandLine "sh", batPath, workspace
}
println "execute: " + batPath
}
afterEvaluate {
android.applicationVariants.each { variant ->
String BUILD_TYPE = "${variant.buildType.name}"
if (BUILD_TYPE.toLowerCase() != "debug") {
return;
}
def shrinkTask = tasks.findByName("mergeDebugJniLibFolders")
build_native.dependsOn shrinkTask.taskDependencies.getDependencies(shrinkTask)
shrinkTask.dependsOn build_native
}
}
//È¥µôgradleµÄndk-build²Ù×÷
gradle.taskGraph.beforeTask { task ->
if ( task.name == "externalNativeBuildRelease" || task.name == "externalNativeBuildDebug") {
task.deleteAllActions()
println "Task $task.name is being rendered useless"
}
}