checkUnstableModule skips aidl_interface am: 068a78502c
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/tools/aidl/+/14831300
Change-Id: Ifd0b3bd9ce95c4c3188df987807d42f68a7cac96
diff --git a/build/aidl_interface.go b/build/aidl_interface.go
index 2c1d922..251d0d6 100644
--- a/build/aidl_interface.go
+++ b/build/aidl_interface.go
@@ -77,6 +77,10 @@
}
func checkUnstableModuleMutator(mctx android.BottomUpMutatorContext) {
+ // If it is an aidl interface, we don't need to check its dependencies.
+ if isAidlModule(mctx.ModuleName(), mctx.Config()) {
+ return
+ }
mctx.VisitDirectDepsIf(func(m android.Module) bool {
return android.InList(m.Name(), *unstableModules(mctx.Config()))
}, func(m android.Module) {
@@ -93,6 +97,15 @@
})
}
+func isAidlModule(moduleName string, config android.Config) bool {
+ for _, i := range *aidlInterfaces(config) {
+ if android.InList(moduleName, i.internalModuleNames) {
+ return true
+ }
+ }
+ return false
+}
+
func recordVersions(mctx android.BottomUpMutatorContext) {
switch mctx.Module().(type) {
case *java.Library:
@@ -103,13 +116,7 @@
return
}
- isAidlModule := false // whether this module is from an AIDL interface
- for _, i := range *aidlInterfaces(mctx.Config()) {
- if android.InList(mctx.ModuleName(), i.internalModuleNames) {
- isAidlModule = true
- break
- }
- }
+ isAidlModule := isAidlModule(mctx.ModuleName(), mctx.Config())
// First, gather all the AIDL interfaces modules that are directly or indirectly
// depended on by this module
diff --git a/build/aidl_test.go b/build/aidl_test.go
index 3b12469..325cbda 100644
--- a/build/aidl_test.go
+++ b/build/aidl_test.go
@@ -337,6 +337,34 @@
testAidl(t, nonVersionedUnstableModuleUsageInJavaBp)
}
+func TestImportInRelease(t *testing.T) {
+ importInRelease := `
+ aidl_interface {
+ name: "foo",
+ srcs: [
+ "IFoo.aidl",
+ ],
+ imports: ["bar"],
+ versions: ["1"],
+ }
+
+ aidl_interface {
+ name: "bar",
+ srcs: [
+ "IBar.aidl",
+ ],
+ versions: ["1"],
+ }
+ `
+
+ testAidl(t, importInRelease, setReleaseEnv(), withFiles(map[string][]byte{
+ "aidl_api/foo/1/foo.1.aidl": nil,
+ "aidl_api/foo/1/.hash": nil,
+ "aidl_api/bar/1/bar.1.aidl": nil,
+ "aidl_api/bar/1/.hash": nil,
+ }))
+}
+
func TestUnstableVersionedModuleUsageInRelease(t *testing.T) {
nonVersionedModuleUsageInJavaBp := `
aidl_interface {