c2a: Automatically make crates APEX available
The bulk of Rust packages in external/ are OS agnostic and do not care about individual platform features. This change is intended to reduce the churn of repeatedly adding new `apex_available` attributes to crates by defaulting to availability. When landing a new crate which is either platform revision specific or has an unstable file format, prefer to set `apex_available: ["//apex_available:platform"]` until you have thought things through. Bug: 174862583 Test: Regenerate with no apex_available, see universal availability Test: Regenerate with apex_available: [], see [] Test: Regenerate with apex_available: [foo], see [foo] Change-Id: I958597789bfc966caec043d051996284dab7a927
This commit is contained in:
@@ -709,8 +709,14 @@ class Crate(object):
|
||||
for header_dir in self.runner.args.exported_c_header_dir:
|
||||
self.write(' "%s",' % header_dir)
|
||||
self.write(' ],')
|
||||
if self.runner.args.apex_available and crate_type in LIBRARY_CRATE_TYPES:
|
||||
if crate_type in LIBRARY_CRATE_TYPES:
|
||||
self.write(' apex_available: [')
|
||||
if self.runner.args.apex_available is None:
|
||||
# If apex_available is not explicitly set, make it available to all
|
||||
# apexes.
|
||||
self.write(' "//apex_available:platform",')
|
||||
self.write(' "//apex_available:anyapex",')
|
||||
else:
|
||||
for apex in self.runner.args.apex_available:
|
||||
self.write(' "%s",' % apex)
|
||||
self.write(' ],')
|
||||
|
||||
Reference in New Issue
Block a user