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 Bug: 153306490 Test: m nothing Merged-In: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac Change-Id: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac
This commit is contained in:
16
java/java.go
16
java/java.go
@@ -1866,12 +1866,12 @@ const (
|
||||
)
|
||||
|
||||
// path to the jar file of a java library. Relative to <sdk_root>/<api_dir>
|
||||
func sdkSnapshotFilePathForJar(name string) string {
|
||||
return sdkSnapshotFilePathForMember(name, jarFileSuffix)
|
||||
func sdkSnapshotFilePathForJar(osPrefix, name string) string {
|
||||
return sdkSnapshotFilePathForMember(osPrefix, name, jarFileSuffix)
|
||||
}
|
||||
|
||||
func sdkSnapshotFilePathForMember(name string, suffix string) string {
|
||||
return filepath.Join(javaDir, name+suffix)
|
||||
func sdkSnapshotFilePathForMember(osPrefix, name string, suffix string) string {
|
||||
return filepath.Join(javaDir, osPrefix, name+suffix)
|
||||
}
|
||||
|
||||
type librarySdkMemberType struct {
|
||||
@@ -1918,7 +1918,7 @@ func (p *librarySdkMemberProperties) PopulateFromVariant(variant android.SdkAwar
|
||||
func (p *librarySdkMemberProperties) AddToPropertySet(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, propertySet android.BpPropertySet) {
|
||||
if p.jarToExport != nil {
|
||||
exportedJar := p.jarToExport
|
||||
snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(p.library.Name())
|
||||
snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(p.OsPrefix(), p.library.Name())
|
||||
builder.CopyToSnapshot(exportedJar, snapshotRelativeJavaLibPath)
|
||||
|
||||
for _, dir := range p.library.AidlIncludeDirs() {
|
||||
@@ -2125,10 +2125,10 @@ func (p *testSdkMemberProperties) PopulateFromVariant(variant android.SdkAware)
|
||||
|
||||
func (p *testSdkMemberProperties) AddToPropertySet(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, propertySet android.BpPropertySet) {
|
||||
if p.jarToExport != nil {
|
||||
snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(p.test.Name())
|
||||
snapshotRelativeJavaLibPath := sdkSnapshotFilePathForJar(p.OsPrefix(), p.test.Name())
|
||||
builder.CopyToSnapshot(p.jarToExport, snapshotRelativeJavaLibPath)
|
||||
|
||||
snapshotRelativeTestConfigPath := sdkSnapshotFilePathForMember(p.test.Name(), testConfigSuffix)
|
||||
snapshotRelativeTestConfigPath := sdkSnapshotFilePathForMember(p.OsPrefix(), p.test.Name(), testConfigSuffix)
|
||||
builder.CopyToSnapshot(p.test.testConfig, snapshotRelativeTestConfigPath)
|
||||
|
||||
propertySet.AddProperty("jars", []string{snapshotRelativeJavaLibPath})
|
||||
@@ -2336,7 +2336,7 @@ func BinaryHostFactory() android.Module {
|
||||
//
|
||||
|
||||
type ImportProperties struct {
|
||||
Jars []string `android:"path"`
|
||||
Jars []string `android:"path,arch_variant"`
|
||||
|
||||
Sdk_version *string
|
||||
|
||||
|
Reference in New Issue
Block a user