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
This commit is contained in:
@@ -78,7 +78,7 @@ const (
|
||||
|
||||
// path to the native binary. Relative to <sdk_root>/<api_dir>
|
||||
func nativeBinaryPathFor(lib nativeBinaryInfoProperties) string {
|
||||
return filepath.Join(lib.archType,
|
||||
return filepath.Join(lib.OsPrefix(), lib.archType,
|
||||
nativeBinaryDir, lib.outputFile.Base())
|
||||
}
|
||||
|
||||
|
@@ -254,7 +254,7 @@ const (
|
||||
|
||||
// path to the native library. Relative to <sdk_root>/<api_dir>
|
||||
func nativeLibraryPathFor(lib *nativeLibInfoProperties) string {
|
||||
return filepath.Join(lib.archType,
|
||||
return filepath.Join(lib.OsPrefix(), lib.archType,
|
||||
nativeStubDir, lib.outputFile.Base())
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("ndk_prebuilt_object", NdkPrebuiltObjectFactory)
|
||||
}
|
||||
|
||||
func GatherRequiredDepsForTest(os android.OsType) string {
|
||||
func GatherRequiredDepsForTest(oses ...android.OsType) string {
|
||||
ret := `
|
||||
toolchain_library {
|
||||
name: "libatomic",
|
||||
@@ -341,8 +341,9 @@ func GatherRequiredDepsForTest(os android.OsType) string {
|
||||
}
|
||||
`
|
||||
|
||||
if os == android.Fuchsia {
|
||||
ret += `
|
||||
for _, os := range oses {
|
||||
if os == android.Fuchsia {
|
||||
ret += `
|
||||
cc_library {
|
||||
name: "libbioniccompat",
|
||||
stl: "none",
|
||||
@@ -352,6 +353,22 @@ func GatherRequiredDepsForTest(os android.OsType) string {
|
||||
stl: "none",
|
||||
}
|
||||
`
|
||||
}
|
||||
if os == android.Windows {
|
||||
ret += `
|
||||
toolchain_library {
|
||||
name: "libwinpthread",
|
||||
host_supported: true,
|
||||
enabled: false,
|
||||
target: {
|
||||
windows: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
src: "",
|
||||
}
|
||||
`
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
Reference in New Issue
Block a user