Sdk snapshot set compile_multilib per OsType
Previously, when an sdk snapshot only supported a single os type the
compile_multilib was set based on the multilib usages by the members
of that variant. After the change to support multiple os types per
snapshot the multilib setting was based on the multilib usages across
all the members of all sdk variants. That meant that if one os type
used only "64" and the other used "both" then they would both be
treated as "both" leading to missing variants when the snapshot was
unpacked.
This change tracks the multilib usages per os type and adds a property
for each one.
It intentionally changes a couple of tests:
1) Either by adding compile_multilib that is missing.
2) By targeting it at a specific os type instead of host.
The latter change is important to prevent the snapshot from being
used on a host platform (which will match the host target section)
but which is a different os type to the ones supported by the
snapshot.
Bug: 142935992
Test: m nothing
Change-Id: I883919b644292c3d019db223bb4fd5c11b39591f
diff --git a/sdk/sdk.go b/sdk/sdk.go
index 984ed7a..dabdf85 100644
--- a/sdk/sdk.go
+++ b/sdk/sdk.go
@@ -52,11 +52,16 @@
// Information about the OsType specific member variants associated with this variant.
//
- // Set by OsType specific variants when their GenerateAndroidBuildActions is invoked
- // and used by the CommonOS variant when its GenerateAndroidBuildActions is invoked, which
- // is guaranteed to occur afterwards.
+ // Set by OsType specific variants in the collectMembers() method and used by the
+ // CommonOS variant when building the snapshot. That work is all done on separate
+ // calls to the sdk.GenerateAndroidBuildActions method which is guaranteed to be
+ // called for the OsType specific variants before the CommonOS variant (because
+ // the latter depends on the former).
memberRefs []sdkMemberRef
+ // The multilib variants that are used by this sdk variant.
+ multilibUsages multilibUsage
+
properties sdkProperties
snapshotFile android.OptionalPath
@@ -259,8 +264,8 @@
// This method is guaranteed to be called on OsType specific variants before it is called
// on their corresponding CommonOS variant.
if !s.IsCommonOSVariant() {
- // Collect the OsType specific members are add them to the OsType specific variant.
- s.memberRefs = s.collectMembers(ctx)
+ // Update the OsType specific sdk variant with information about its members.
+ s.collectMembers(ctx)
} else {
// Get the OsType specific variants on which the CommonOS depends.
osSpecificVariants := android.GetOsSpecificVariantsOfCommonOSVariant(ctx)