Add a neverallow rule for prebuilt_* module types
This change adds a neverallow rule to the following module types:
- prebuilt_usr_srec
- prebuilt_priv_app
- prebuilt_rfs
- prebuilt_framework
- prebuilt_res
- prebuilt_wlc_upt
- prebuilt_odm
that these modules cannot be defined in bp files, but can only be auto
generated by other modules.
Test: m nothing --no-skip-soong-tests
Bug: 375053752
Change-Id: Ie1b73966d8ada3863c29f9aca710aa8c735286dd
diff --git a/android/base_module_context.go b/android/base_module_context.go
index e24ce9d..223b534 100644
--- a/android/base_module_context.go
+++ b/android/base_module_context.go
@@ -87,6 +87,10 @@
// This method shouldn't be used directly, prefer the type-safe android.OtherModuleProvider instead.
otherModuleProvider(m blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
+ // OtherModuleIsAutoGenerated returns true if the module is auto generated by another module
+ // instead of being defined in Android.bp file.
+ OtherModuleIsAutoGenerated(m blueprint.Module) bool
+
// Provider returns the value for a provider for the current module. If the value is
// not set it returns nil and false. It panics if called before the appropriate
// mutator or GenerateBuildActions pass for the provider. The value returned may be a deep
@@ -275,6 +279,10 @@
return b.bp.OtherModuleProvider(m, provider)
}
+func (b *baseModuleContext) OtherModuleIsAutoGenerated(m blueprint.Module) bool {
+ return b.bp.OtherModuleIsAutoGenerated(m)
+}
+
func (b *baseModuleContext) provider(provider blueprint.AnyProviderKey) (any, bool) {
return b.bp.Provider(provider)
}