Add support for multiple os types
Updates the member snapshot creation code to support multiple os types.
It basically sorts the variants by os type, then applies the code to
optimize the arch properties and then it optimizes the properties that
are common across architectures and extracts any properties that are
common across os types.
The java and cc member types needed to be modified to make the location
of the generated files within the snapshot os type dependent when there
is more than one os type. That was done by adding an OsPrefix() method
to the SdkMemberPropertiesBase which returns the os prefix to use when
there is > 1 os type and otherwise returns an empty string.
Added three tests, one for cc shared libraries, one for cc binary and
one for java header libraries.
Bug: 150451422
Test: m nothing
Change-Id: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac
diff --git a/android/sdk.go b/android/sdk.go
index f28c392..969e21a 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -448,10 +448,29 @@
// Base structure for all implementations of SdkMemberProperties.
//
-// Contains common properties that apply across many different member types.
+// Contains common properties that apply across many different member types. These
+// are not affected by the optimization to extract common values.
type SdkMemberPropertiesBase struct {
// The setting to use for the compile_multilib property.
Compile_multilib string
+
+ // The number of unique os types supported by the member variants.
+ Os_count int
+
+ // The os type for which these properties refer.
+ Os OsType
+}
+
+// The os prefix to use for any file paths in the sdk.
+//
+// Is an empty string if the member only provides variants for a single os type, otherwise
+// is the OsType.Name.
+func (b *SdkMemberPropertiesBase) OsPrefix() string {
+ if b.Os_count == 1 {
+ return ""
+ } else {
+ return b.Os.Name
+ }
}
func (b *SdkMemberPropertiesBase) Base() *SdkMemberPropertiesBase {