Restrict SdkMemberTypes that can be used with sdk/sdk_snapshot

By default SdkMemberTypes are only supported on module_exports module
type. Support for sdk module type has to be explicitly specified.

The java_header_libs, native_shared_libs and stubs_sources are
supported on sdk. The latter is required to provide the stubs source
for an API specified in java_header_libs as they should be kept in
sync.

Bug: 146341462
Test: m nothing
Change-Id: I19b9e60792780a797458d4a9e489506602b13144
This commit is contained in:
Paul Duffin
2019-12-16 17:43:48 +00:00
parent 28aa544884
commit e602918294
8 changed files with 101 additions and 70 deletions

View File

@@ -500,8 +500,8 @@ include/Test.h -> include/include/Test.h
func TestSnapshotWithCcStaticLibrary(t *testing.T) {
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
module_exports {
name: "myexports",
native_static_libs: ["mynativelib"],
}
@@ -520,12 +520,12 @@ func TestSnapshotWithCcStaticLibrary(t *testing.T) {
}
`)
result.CheckSnapshot("mysdk", "android_common", "",
result.CheckSnapshot("myexports", "android_common", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_static {
name: "mysdk_mynativelib@current",
name: "myexports_mynativelib@current",
sdk_member_name: "mynativelib",
export_include_dirs: ["include/include"],
arch: {
@@ -560,9 +560,9 @@ cc_prebuilt_library_static {
system_shared_libs: [],
}
sdk_snapshot {
name: "mysdk@current",
native_static_libs: ["mysdk_mynativelib@current"],
module_exports_snapshot {
name: "myexports@current",
native_static_libs: ["myexports_mynativelib@current"],
}
`),
checkAllCopyRules(`
@@ -584,8 +584,8 @@ func TestHostSnapshotWithCcStaticLibrary(t *testing.T) {
SkipIfNotLinux(t)
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
module_exports {
name: "myexports",
device_supported: false,
host_supported: true,
native_static_libs: ["mynativelib"],
@@ -608,12 +608,12 @@ func TestHostSnapshotWithCcStaticLibrary(t *testing.T) {
}
`)
result.CheckSnapshot("mysdk", "linux_glibc_common", "",
result.CheckSnapshot("myexports", "linux_glibc_common", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_static {
name: "mysdk_mynativelib@current",
name: "myexports_mynativelib@current",
sdk_member_name: "mynativelib",
device_supported: false,
host_supported: true,
@@ -652,11 +652,11 @@ cc_prebuilt_library_static {
system_shared_libs: [],
}
sdk_snapshot {
name: "mysdk@current",
module_exports_snapshot {
name: "myexports@current",
device_supported: false,
host_supported: true,
native_static_libs: ["mysdk_mynativelib@current"],
native_static_libs: ["myexports_mynativelib@current"],
}
`),
checkAllCopyRules(`