Flag to control if generated SDK prebuilts are preferred.
This is needed because:
- the SDK prebuilt drop is being automated, including the Android.bp
- We want to control the prefer flag on a per-module level
It augments the existing SOONG_SDK_SNAPSHOT_PREFER which now overrides
this new flag when set to true.
Bug: 188427719
Test: m nothing
Change-Id: Ieb5ab9fab53a34c615345b7a9d19cadf713eec26
diff --git a/sdk/sdk.go b/sdk/sdk.go
index b1c8aeb..afc6aa4 100644
--- a/sdk/sdk.go
+++ b/sdk/sdk.go
@@ -93,6 +93,10 @@
// dropped. Adding a rule to members that have //visibility:private will
// cause the //visibility:private to be discarded.
Prebuilt_visibility []string
+
+ // Specifying whether the generated prebuilt SDK build rule should have the
+ // prefer flag set or not.
+ Prebuilts_prefer *bool // default: false
}
// Contains information about the sdk properties that list sdk members, e.g.
@@ -292,6 +296,10 @@
return s.properties.Snapshot
}
+func (s *sdk) PreferPrebuilts() bool {
+ return proptools.BoolDefault(s.properties.Prebuilts_prefer, false)
+}
+
func (s *sdk) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if s.snapshot() {
// We don't need to create a snapshot out of sdk_snapshot.