test_for is available for all cc_* module types
Sometimes, the ordinary cc_library_* modules need test_for property when
they are part of a bigger cc_test. Instead of propagating the test_for
property from cc_test to its dependencies, this change requires the very
dependency which needs access to the private part of an APEX to
explicitly have the test_for property.
Bug: 161575591
Test: m
Change-Id: Ie1ffe9a60cd2ab02d41bbe5a98225a40392470f6
diff --git a/cc/cc.go b/cc/cc.go
index b1c1264..81f24ce 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -332,6 +332,11 @@
// framework module from a snapshot.
Exclude_from_vendor_snapshot *bool
Exclude_from_recovery_snapshot *bool
+
+ // List of APEXes that this module has private access to for testing purpose. The module
+ // can depend on libraries that are not exported by the APEXes and use private symbols
+ // from the exported libraries.
+ Test_for []string
}
type VendorProperties struct {
@@ -2935,13 +2940,7 @@
}
func (c *Module) TestFor() []string {
- if test, ok := c.linker.(interface {
- testFor() []string
- }); ok {
- return test.testFor()
- } else {
- return c.ApexModuleBase.TestFor()
- }
+ return c.Properties.Test_for
}
func (c *Module) UniqueApexVariations() bool {