summaryrefslogtreecommitdiff
path: root/sdk/update.go
diff options
context:
space:
mode:
author Mathew Inwood <mathewi@google.com> 2021-05-20 11:00:12 +0100
committer Mathew Inwood <mathewi@google.com> 2021-06-29 15:55:27 +0000
commitd0b99cea0ac389e831dfddbd3cb10fa09a040d2c (patch)
tree6537f167152036d8337dfbb0cfe572a8757b34fe /sdk/update.go
parent22fd032ccbe6b8352964fc01d961f0d71b20c949 (diff)
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
Diffstat (limited to 'sdk/update.go')
-rw-r--r--sdk/update.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/sdk/update.go b/sdk/update.go
index b146b62c8..2ab45d7c1 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -32,8 +32,9 @@ import (
// ========================================================
//
// SOONG_SDK_SNAPSHOT_PREFER
-// By default every unversioned module in the generated snapshot has prefer: false. Building it
-// with SOONG_SDK_SNAPSHOT_PREFER=true will force them to use prefer: true.
+// By default every unversioned module in the generated snapshot has prefer set by the
+// sdk.prebuilts_prefer property. Building it with SOONG_SDK_SNAPSHOT_PREFER=true will force
+// them to use prefer: true.
//
// SOONG_SDK_SNAPSHOT_VERSION
// This provides control over the version of the generated snapshot.
@@ -1623,11 +1624,11 @@ func (s *sdk) createMemberSnapshot(ctx *memberContext, member *sdkMember, bpModu
// Do not add the prefer property if the member snapshot module is a source module type.
if !memberType.UsesSourceModuleTypeInSnapshot() {
- // Set the prefer based on the environment variable. This is a temporary work around to allow a
- // snapshot to be created that sets prefer: true.
+ // Set the prefer based on the environment variable if present, else the sdk.prefer_prebuilts
+ // value.
// TODO(b/174997203): Remove once the ability to select the modules to prefer can be done
// dynamically at build time not at snapshot generation time.
- prefer := ctx.sdkMemberContext.Config().IsEnvTrue("SOONG_SDK_SNAPSHOT_PREFER")
+ prefer := ctx.sdkMemberContext.Config().IsEnvTrue("SOONG_SDK_SNAPSHOT_PREFER") || s.PreferPrebuilts()
// Set prefer. Setting this to false is not strictly required as that is the default but it does
// provide a convenient hook to post-process the generated Android.bp file, e.g. in tests to