Revert^4 "Set the appropriate deps property for the soong generated fs modules"
This change relands https://r.android.com/3304859.
Test: m nothing --no-skip-soong-tests && ABTD
Bug: 372771060
Change-Id: Ie798fee2a71c14d5e8ac5e2433394bbb090cd595
diff --git a/android/module.go b/android/module.go
index 3079b07..e3dabcc 100644
--- a/android/module.go
+++ b/android/module.go
@@ -113,6 +113,10 @@
VintfFragmentModuleNames(ctx ConfigurableEvaluatorContext) []string
ConfigurableEvaluator(ctx ConfigurableEvaluatorContext) proptools.ConfigurableEvaluator
+
+ // The usage of this method is experimental and should not be used outside of fsgen package.
+ // This will be removed once product packaging migration to Soong is complete.
+ DecodeMultilib(ctx ConfigContext) (string, string)
}
// Qualified id for a module
@@ -2282,6 +2286,10 @@
return proptools.Bool(m.commonProperties.Native_bridge_supported)
}
+func (m *ModuleBase) DecodeMultilib(ctx ConfigContext) (string, string) {
+ return decodeMultilib(ctx, m)
+}
+
type ConfigContext interface {
Config() Config
}
diff --git a/android/module_proxy.go b/android/module_proxy.go
index bc5090e..0f552dd 100644
--- a/android/module_proxy.go
+++ b/android/module_proxy.go
@@ -201,3 +201,7 @@
func (m ModuleProxy) ConfigurableEvaluator(ctx ConfigurableEvaluatorContext) proptools.ConfigurableEvaluator {
panic("method is not implemented on ModuleProxy")
}
+
+func (m ModuleProxy) DecodeMultilib(ctx ConfigContext) (string, string) {
+ panic("method is not implemented on ModuleProxy")
+}
diff --git a/android/neverallow.go b/android/neverallow.go
index 041c9a0..439fe2d 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -61,6 +61,7 @@
AddNeverAllowRules(createProhibitHeaderOnlyRule())
AddNeverAllowRules(createLimitNdkExportRule()...)
AddNeverAllowRules(createLimitDirgroupRule()...)
+ AddNeverAllowRules(createFilesystemIsAutoGeneratedRule())
}
// Add a NeverAllow rule to the set of rules to apply.
@@ -293,6 +294,14 @@
}
}
+func createFilesystemIsAutoGeneratedRule() Rule {
+ return NeverAllow().
+ NotIn("build/soong/fsgen").
+ ModuleType("filesystem", "android_system_image").
+ WithMatcher("is_auto_generated", isSetMatcherInstance).
+ Because("is_auto_generated property is only allowed for filesystem modules in build/soong/fsgen directory")
+}
+
func neverallowMutator(ctx BottomUpMutatorContext) {
m, ok := ctx.Module().(Module)
if !ok {
diff --git a/android/neverallow_test.go b/android/neverallow_test.go
index 192c924..caec8c7 100644
--- a/android/neverallow_test.go
+++ b/android/neverallow_test.go
@@ -359,6 +359,21 @@
`headers_only can only be used for generating framework-minus-apex headers for non-updatable modules`,
},
},
+ // Test for the rule restricting use of is_auto_generated
+ {
+ name: `"is_auto_generated" outside allowed directory`,
+ fs: map[string][]byte{
+ "a/b/Android.bp": []byte(`
+ filesystem {
+ name: "baaz",
+ is_auto_generated: true,
+ }
+ `),
+ },
+ expectedErrors: []string{
+ `is_auto_generated property is only allowed for filesystem modules in build/soong/fsgen directory`,
+ },
+ },
}
var prepareForNeverAllowTest = GroupFixturePreparers(
@@ -367,6 +382,7 @@
ctx.RegisterModuleType("java_library", newMockJavaLibraryModule)
ctx.RegisterModuleType("java_library_host", newMockJavaLibraryModule)
ctx.RegisterModuleType("java_device_for_host", newMockJavaLibraryModule)
+ ctx.RegisterModuleType("filesystem", newMockFilesystemModule)
}),
)
diff --git a/android/visibility_test.go b/android/visibility_test.go
index 1a2eeca..277be0f 100644
--- a/android/visibility_test.go
+++ b/android/visibility_test.go
@@ -2098,8 +2098,9 @@
}
type mockFilesystemModuleProperties struct {
- Partition_type *string
- Deps []string
+ Partition_type *string
+ Deps []string
+ Is_auto_generated *bool
}
type mockFilesystemModule struct {