summaryrefslogtreecommitdiff
path: root/sdk/update.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2023-03-08 22:06:35 +0000
committer Spandan Das <spandandas@google.com> 2023-03-21 04:36:19 +0000
commitb84dbb2f3ec28b10ba6284516b9067cfde3fd4a0 (patch)
treeb70d566b6e16f64c281c21db5f41bc039cbd6c75 /sdk/update.go
parent895bc9463b89140aad64245afd642a6cd12a336c (diff)
Always include host variants in the sdk snapshot
This relands aosp/2478277. The original CL was submitted as part of a stack that broke tm and udc since those branches contains soong modules that have min_sdk_version of type (kind+level). Test: go test ./sdk Bug: 208456999 Change-Id: Ie5d7f2597092a51c6e74e7b3cab2f81c02906d5e
Diffstat (limited to 'sdk/update.go')
-rw-r--r--sdk/update.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/sdk/update.go b/sdk/update.go
index 0820d62b8..d98ab683d 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -357,6 +357,12 @@ func (s *sdk) buildSnapshot(ctx android.ModuleContext, sdkVariants []*sdk) {
// If the minApiLevel of the member is greater than the target API level then exclude it from
// this snapshot.
exclude := memberVariantDep.minApiLevel.GreaterThan(targetApiLevel)
+ // Always include host variants (e.g. host tools) in the snapshot.
+ // Host variants should not be guarded by a min_sdk_version check. In fact, host variants
+ // do not have a `min_sdk_version`.
+ if memberVariantDep.Host() {
+ exclude = false
+ }
addMember(name, export, exclude)
@@ -1263,6 +1269,11 @@ type sdkMemberVariantDep struct {
minApiLevel android.ApiLevel
}
+// Host returns true if the sdk member is a host variant (e.g. host tool)
+func (s *sdkMemberVariantDep) Host() bool {
+ return s.variant.Target().Os.Class == android.Host
+}
+
var _ android.SdkMember = (*sdkMember)(nil)
// sdkMember groups all the variants of a specific member module together along with the name of the