Prevent dynamically created java_api_contribution from inheriting
parent modules' visibility
By default, dynamically created module inherits the parent module's
visibility. When the parent module's visibility is set to
"//visibility:private" or has any other specified visibility
restrictions in the module definition, the created
java_api_contribution module is not visible to java_api_library.
Thus, override any inherited visibility properties and set the visiblity
of the created java_api_contribution module to public.
Test: m
Change-Id: I5db60a5a1800e2ae28c9650eeb9a2f1c3b4f8989
diff --git a/java/droidstubs.go b/java/droidstubs.go
index d9613e5..8a521aa 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -878,11 +878,13 @@
Name *string
Api_surface *string
Api_file *string
+ Visibility []string
}{}
props.Name = proptools.StringPtr(d.Name() + ".api.contribution")
props.Api_surface = api_surface
props.Api_file = api_file
+ props.Visibility = []string{"//visibility:override", "//visibility:public"}
ctx.CreateModule(ApiContributionFactory, &props)
}