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
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index f477445..255ac08 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -500,8 +500,8 @@
func TestSnapshotWithCcStaticLibrary(t *testing.T) {
result := testSdkWithCc(t, `
- sdk {
- name: "mysdk",
+ module_exports {
+ name: "myexports",
native_static_libs: ["mynativelib"],
}
@@ -520,12 +520,12 @@
}
`)
- 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 @@
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 @@
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 @@
}
`)
- 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 @@
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(`