summaryrefslogtreecommitdiff
path: root/sdk/update.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-05-11 07:18:06 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-05-11 07:18:06 +0000
commitf08e7c444ce8e92f8ce56e5c005281db9de9eb3c (patch)
tree273b36ce783f1dfa655db837bf04a47a84349131 /sdk/update.go
parent9a59e70fe190bb382034209cbb46a772dd7ce587 (diff)
parent0d4ed0ac56b475cf0b820ecdc8431fdef2367adb (diff)
Merge "Allow sdk snapshot to contain source module type"
Diffstat (limited to 'sdk/update.go')
-rw-r--r--sdk/update.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/sdk/update.go b/sdk/update.go
index 707ac63f7..40dba1937 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -1370,17 +1370,20 @@ func (s *sdk) createMemberSnapshot(ctx *memberContext, member *sdkMember, bpModu
memberType := member.memberType
- // 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.
- // 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")
-
- // 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
- // check the behavior when a prebuilt is preferred. It also makes it explicit what the default
- // behavior is for the module.
- bpModule.insertAfter("name", "prefer", prefer)
+ // 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.
+ // 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")
+
+ // 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
+ // check the behavior when a prebuilt is preferred. It also makes it explicit what the default
+ // behavior is for the module.
+ bpModule.insertAfter("name", "prefer", prefer)
+ }
// Group the variants by os type.
variantsByOsType := make(map[android.OsType][]android.Module)