diff options
author | Jeongik Cha <jeongik@google.com> | 2021-06-04 12:45:23 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2021-06-04 13:36:49 +0900 |
commit | 068a78502ce256ff95fd4c14e6c02aea52a93845 (patch) | |
tree | e9dbc4ad849f3edffa9d3c03e4de6965177b7461 | |
parent | 5b9fd4b41819997c4d89e58d93766846db881a09 (diff) | |
download | aidl-068a78502ce256ff95fd4c14e6c02aea52a93845.tar.gz |
checkUnstableModule skips aidl_interface
It's enough for checkUnstableModule to check only non-aidl_interface to
aidl_interface deps, not dep between aidl_interfaces.
Bug: 190137255
Test: m nothing
Merged-In: I75ab39d9dda47e802bb060eb60fca2d964ac1260
Change-Id: I75ab39d9dda47e802bb060eb60fca2d964ac1260
-rw-r--r-- | build/aidl_interface.go | 21 | ||||
-rw-r--r-- | build/aidl_test.go | 28 |
2 files changed, 42 insertions, 7 deletions
diff --git a/build/aidl_interface.go b/build/aidl_interface.go index 2c1d922a..251d0d63 100644 --- a/build/aidl_interface.go +++ b/build/aidl_interface.go @@ -77,6 +77,10 @@ func createAidlInterfaceMutator(mctx android.TopDownMutatorContext) { } 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 checkUnstableModuleMutator(mctx android.BottomUpMutatorContext) { }) } +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 @@ func recordVersions(mctx android.BottomUpMutatorContext) { 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 3b12469a..325cbda9 100644 --- a/build/aidl_test.go +++ b/build/aidl_test.go @@ -337,6 +337,34 @@ func TestNonVersionedModuleUsageInRelease(t *testing.T) { 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 { |