commit | 9f4c382a0b0b7448809b3c24de49f8c017167b4c | [log] [tgz] |
---|---|---|
author | Jiyong Park <jiyong@google.com> | Wed Apr 07 20:36:45 2021 +0900 |
committer | Treehugger Robot <treehugger-gerrit@google.com> | Mon Apr 12 23:42:28 2021 +0000 |
tree | d35ab5baf9de1ed3dd3721008f473af7de4b8479 | |
parent | 50c610432273cf8d530edb95f5a9778f862446d0 [diff] |
aidl-cpp ensures that output file is at <out_dir>/<package>/<name>.cpp Background: When an AIDL file is put to the srcs property of a cc_* module, Soong creates a build rule that invokes aidl-cpp to convert the AIDL file into a CPP source code and headers. Specifically, if the AIDL file is at subdir/android/foo/IFoo.aidl, the command is aidl-cpp subdir/android/foo/IFoo.aidl\ // input aidl out/..../gen/subdir/android/foo/IFoo.aidl\ // output cpp out/..../gen // directory for output headers In addition, the build rule has out/.../gen/subdir/android/foo/BnFoo.h, etc. as the implicit outputs. Problem: In the example above, if the package of the AIDL type is "android.foo", not "subdir.android.foo", then aidl-cpp generates the headers at out/.../gen/android/foo/BnFoo.h, etc. Notice the absence of 'subdir'. These paths are different from the implicit outputs that the Soong expects. The root cause is that Soong has an implicit assumption that the package of an AIDL file at subdir/android/foo is "subdir.android.foo", because it can't look into the AIDL file. When the actual outputs and the outputs listed in the build rule are different, Soong thanksfully triggers an error, but the error doesn't have context and doesn't suggest a way to fix it. The correct thing the developer should do is to set 'subdir' as the base directory so that Soong can infer the package name from the relative path from the base directory. Solution: This change adds a check to the AIDL compiler so that it triggers an error when the output path given by Soong is different from the path that is calculated based on the correct package name. It also emits a message suggesting to fix this using the filegroup and the path property. Bug: 184586092 Test: aidl_unittests Change-Id: I0f23b6027ba3a4755cc2901f4a7f7fc70bffd0ef
Documentation for this project is currently maintained here:
https://source.android.com/devices/architecture/aidl/overview