12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- apply from: "$rootDir/Script/FrameworkConfig.gradle"
- gradle.projectsEvaluated {
- def libraryExtension = getExtensions().findByName("android")
- if (libraryExtension == null) {
- return
- }
-
-
- def aidlSrcDirs = new HashSet<String>()
- for (sourceSets in libraryExtension.sourceSets) {
- def aidl = sourceSets.aidl
- if (aidl.name.contains("android test") || aidl.name.contains("test ")) {
- continue
- }
- aidlSrcDirs.addAll(aidl.srcDirs)
- }
-
-
-
- String aidlInclude = ""
- for (String dir : aidlSrcDirs) {
- aidlInclude += "-I$dir "
- }
- aidlInclude = aidlInclude.trim()
-
- def aidlCompile = new HashSet<Task>()
- for (task in tasks.collect()) {
- def taskName = task.name
- if (taskName.contains("AndroidTest")) {
- continue
- }
- if (taskName.toLowerCase().contains("aidl")) {
- aidlCompile.add(task)
- }
- }
- def frameworksAidl = "$frameworkAidlPath"
- if (frameworksAidl == null || frameworksAidl.isBlank()) {
- println("frameworksAidl is null")
- return
- }
- for (aidlTask in aidlCompile) {
- aidlTask.doFirst { task ->
- def buildTools = task.buildTools
- def aidlExecutable = buildTools.aidlExecutableProvider().get()
- def aidlFrameworkProvider = buildTools.aidlFrameworkProvider().get()
- def aidlSourceOutputDir = null
- for (File file : task.getOutputs().files.files) {
- if (file.absolutePath.contains("aidl_source_output_dir")) {
- aidlSourceOutputDir = file
- }
- }
- for (File file : task.getInputs().files.files) {
- if (file.isDirectory()) {
- continue
- }
- if (file.name == "framework.aidl") {
- continue
- }
-
-
-
-
-
-
-
- String cmd = String.format("%s -p%s -I%s %s -o%s %s", aidlExecutable,
- aidlFrameworkProvider, frameworksAidl, aidlInclude, aidlSourceOutputDir, file)
- runtimeExec(cmd)
- }
-
- throw new StopExecutionException()
- }
- }
- }
|