aboutsummaryrefslogtreecommitdiff
path: root/sdk/cc_sdk_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'sdk/cc_sdk_test.go')
-rw-r--r--sdk/cc_sdk_test.go1023
1 files changed, 788 insertions, 235 deletions
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index 265579aa1..571d21420 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -120,7 +120,7 @@ func TestSdkCompileMultilibOverride(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -145,6 +145,48 @@ cc_prebuilt_library_shared {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_shared {
+ name: "mysdk_sdkmember@current",
+ sdk_member_name: "sdkmember",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ host_supported: true,
+ installable: false,
+ stl: "none",
+ compile_multilib: "64",
+ target: {
+ host: {
+ enabled: false,
+ },
+ android_arm64: {
+ srcs: ["android/arm64/lib/sdkmember.so"],
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["linux_glibc/x86_64/lib/sdkmember.so"],
+ },
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ host_supported: true,
+ compile_multilib: "64",
+ native_shared_libs: ["mysdk_sdkmember@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
.intermediates/sdkmember/android_arm64_armv8-a_shared/sdkmember.so -> android/arm64/lib/sdkmember.so
.intermediates/sdkmember/linux_glibc_x86_64_shared/sdkmember.so -> linux_glibc/x86_64/lib/sdkmember.so
@@ -223,7 +265,7 @@ func TestSnapshotWithObject(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_object {
@@ -247,6 +289,37 @@ cc_prebuilt_object {
},
}
`),
+ // Make sure that the generated sdk_snapshot uses the native_objects property.
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_object {
+ name: "mysdk_crtobj@current",
+ sdk_member_name: "crtobj",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ stl: "none",
+ compile_multilib: "both",
+ system_shared_libs: [],
+ sanitize: {
+ never: true,
+ },
+ arch: {
+ arm64: {
+ srcs: ["arm64/lib/crtobj.o"],
+ },
+ arm: {
+ srcs: ["arm/lib/crtobj.o"],
+ },
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ native_objects: ["mysdk_crtobj@current"],
+}
+`),
checkAllCopyRules(`
.intermediates/crtobj/android_arm64_armv8-a/crtobj.o -> arm64/lib/crtobj.o
.intermediates/crtobj/android_arm_armv7-a-neon/crtobj.o -> arm/lib/crtobj.o
@@ -330,7 +403,7 @@ func TestSnapshotWithCcExportGeneratedHeaders(t *testing.T) {
errorHandler := android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module source path "snapshot/include_gen/generated_foo/gen/protos" does not exist`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -403,7 +476,7 @@ func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -462,7 +535,7 @@ func TestSnapshotWithCcBinary(t *testing.T) {
`)
CheckSnapshot(t, result, "mymodule_exports", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_binary {
@@ -481,6 +554,33 @@ cc_prebuilt_binary {
},
}
`),
+ // Make sure that the generated sdk_snapshot uses the native_binaries property.
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_binary {
+ name: "mymodule_exports_mynativebinary@current",
+ sdk_member_name: "mynativebinary",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ installable: false,
+ compile_multilib: "both",
+ arch: {
+ arm64: {
+ srcs: ["arm64/bin/mynativebinary"],
+ },
+ arm: {
+ srcs: ["arm/bin/mynativebinary"],
+ },
+ },
+}
+
+module_exports_snapshot {
+ name: "mymodule_exports@current",
+ visibility: ["//visibility:public"],
+ native_binaries: ["mymodule_exports_mynativebinary@current"],
+}
+`),
checkAllCopyRules(`
.intermediates/mynativebinary/android_arm64_armv8-a/mynativebinary -> arm64/bin/mynativebinary
.intermediates/mynativebinary/android_arm_armv7-a-neon/mynativebinary -> arm/bin/mynativebinary
@@ -520,7 +620,7 @@ func TestMultipleHostOsTypesSnapshotWithCcBinary(t *testing.T) {
`)
CheckSnapshot(t, result, "myexports", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_binary {
@@ -556,6 +656,68 @@ cc_prebuilt_binary {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_binary {
+ name: "myexports_mynativebinary@current",
+ sdk_member_name: "mynativebinary",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ device_supported: false,
+ host_supported: true,
+ installable: false,
+ stl: "none",
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc: {
+ compile_multilib: "both",
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["linux_glibc/x86_64/bin/mynativebinary"],
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ srcs: ["linux_glibc/x86/bin/mynativebinary"],
+ },
+ windows: {
+ compile_multilib: "64",
+ },
+ windows_x86_64: {
+ enabled: true,
+ srcs: ["windows/x86_64/bin/mynativebinary.exe"],
+ },
+ },
+}
+
+module_exports_snapshot {
+ name: "myexports@current",
+ visibility: ["//visibility:public"],
+ device_supported: false,
+ host_supported: true,
+ native_binaries: ["myexports_mynativebinary@current"],
+ target: {
+ windows: {
+ compile_multilib: "64",
+ },
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ windows_x86_64: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
.intermediates/mynativebinary/linux_glibc_x86_64/mynativebinary -> linux_glibc/x86_64/bin/mynativebinary
.intermediates/mynativebinary/linux_glibc_x86/mynativebinary -> linux_glibc/x86/bin/mynativebinary
@@ -618,7 +780,7 @@ func TestSnapshotWithSingleHostOsType(t *testing.T) {
`)
CheckSnapshot(t, result, "myexports", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_binary {
@@ -661,6 +823,69 @@ cc_prebuilt_library_shared {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_binary {
+ name: "myexports_mynativebinary@current",
+ sdk_member_name: "mynativebinary",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ device_supported: false,
+ host_supported: true,
+ installable: false,
+ stl: "none",
+ compile_multilib: "64",
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_bionic_x86_64: {
+ enabled: true,
+ srcs: ["x86_64/bin/mynativebinary"],
+ },
+ },
+}
+
+cc_prebuilt_library_shared {
+ name: "myexports_mynativelib@current",
+ sdk_member_name: "mynativelib",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ device_supported: false,
+ host_supported: true,
+ installable: false,
+ stl: "none",
+ compile_multilib: "64",
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_bionic_x86_64: {
+ enabled: true,
+ srcs: ["x86_64/lib/mynativelib.so"],
+ },
+ },
+}
+
+module_exports_snapshot {
+ name: "myexports@current",
+ visibility: ["//visibility:public"],
+ device_supported: false,
+ host_supported: true,
+ compile_multilib: "64",
+ native_binaries: ["myexports_mynativebinary@current"],
+ native_shared_libs: ["myexports_mynativelib@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_bionic_x86_64: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
.intermediates/mynativebinary/linux_bionic_x86_64/mynativebinary -> x86_64/bin/mynativebinary
.intermediates/mynativelib/linux_bionic_x86_64_shared/mynativelib.so -> x86_64/lib/mynativelib.so
@@ -693,7 +918,7 @@ func TestSnapshotWithCcStaticNocrtBinary(t *testing.T) {
`)
CheckSnapshot(t, result, "mymodule_exports", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_binary {
@@ -722,6 +947,55 @@ cc_prebuilt_binary {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_binary {
+ name: "mymodule_exports_linker@current",
+ sdk_member_name: "linker",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ device_supported: false,
+ host_supported: true,
+ installable: false,
+ stl: "none",
+ compile_multilib: "both",
+ static_executable: true,
+ nocrt: true,
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["x86_64/bin/linker"],
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ srcs: ["x86/bin/linker"],
+ },
+ },
+}
+
+module_exports_snapshot {
+ name: "mymodule_exports@current",
+ visibility: ["//visibility:public"],
+ device_supported: false,
+ host_supported: true,
+ native_binaries: ["mymodule_exports_linker@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
.intermediates/linker/linux_glibc_x86_64/linker -> x86_64/bin/linker
.intermediates/linker/linux_glibc_x86/linker -> x86/bin/linker
@@ -752,7 +1026,7 @@ func TestSnapshotWithCcSharedLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -853,7 +1127,7 @@ func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -950,7 +1224,7 @@ func TestHostSnapshotWithCcSharedLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -981,6 +1255,57 @@ cc_prebuilt_library_shared {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_shared {
+ name: "mysdk_mynativelib@current",
+ sdk_member_name: "mynativelib",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ device_supported: false,
+ host_supported: true,
+ installable: false,
+ sdk_version: "minimum",
+ stl: "none",
+ compile_multilib: "both",
+ export_include_dirs: ["include/myinclude"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["x86_64/lib/mynativelib.so"],
+ export_include_dirs: ["x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl"],
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ srcs: ["x86/lib/mynativelib.so"],
+ export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl"],
+ },
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ device_supported: false,
+ host_supported: true,
+ native_shared_libs: ["mysdk_mynativelib@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
myinclude/Test.h -> include/myinclude/Test.h
.intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> x86_64/lib/mynativelib.so
@@ -1026,7 +1351,7 @@ func TestMultipleHostOsTypesSnapshotWithCcSharedLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -1062,6 +1387,68 @@ cc_prebuilt_library_shared {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_shared {
+ name: "mysdk_mynativelib@current",
+ sdk_member_name: "mynativelib",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ device_supported: false,
+ host_supported: true,
+ installable: false,
+ stl: "none",
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc: {
+ compile_multilib: "both",
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["linux_glibc/x86_64/lib/mynativelib.so"],
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ srcs: ["linux_glibc/x86/lib/mynativelib.so"],
+ },
+ windows: {
+ compile_multilib: "64",
+ },
+ windows_x86_64: {
+ enabled: true,
+ srcs: ["windows/x86_64/lib/mynativelib.dll"],
+ },
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ device_supported: false,
+ host_supported: true,
+ native_shared_libs: ["mysdk_mynativelib@current"],
+ target: {
+ windows: {
+ compile_multilib: "64",
+ },
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ windows_x86_64: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
.intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> linux_glibc/x86_64/lib/mynativelib.so
.intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> linux_glibc/x86/lib/mynativelib.so
@@ -1092,7 +1479,7 @@ func TestSnapshotWithCcStaticLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "myexports", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_static {
@@ -1155,7 +1542,7 @@ func TestHostSnapshotWithCcStaticLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "myexports", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_static {
@@ -1185,6 +1572,56 @@ cc_prebuilt_library_static {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_static {
+ name: "myexports_mynativelib@current",
+ sdk_member_name: "mynativelib",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ device_supported: false,
+ host_supported: true,
+ installable: false,
+ stl: "none",
+ compile_multilib: "both",
+ export_include_dirs: ["include/myinclude"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["x86_64/lib/mynativelib.a"],
+ export_include_dirs: ["x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl"],
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ srcs: ["x86/lib/mynativelib.a"],
+ export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl"],
+ },
+ },
+}
+
+module_exports_snapshot {
+ name: "myexports@current",
+ visibility: ["//visibility:public"],
+ device_supported: false,
+ host_supported: true,
+ native_static_libs: ["myexports_mynativelib@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
myinclude/Test.h -> include/myinclude/Test.h
.intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> x86_64/lib/mynativelib.a
@@ -1219,7 +1656,7 @@ func TestSnapshotWithCcLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "myexports", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library {
@@ -1251,241 +1688,58 @@ cc_prebuilt_library {
},
}
`),
- checkAllCopyRules(`
-myinclude/Test.h -> include/myinclude/Test.h
-.intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> arm64/lib/mynativelib.a
-.intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so
-.intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> arm/lib/mynativelib.a
-.intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so
-`),
- // TODO(b/183315522): Remove this and fix the issue.
- snapshotTestErrorHandler(checkSnapshotPreferredWithSource, android.FixtureExpectsAtLeastOneErrorMatchingPattern(`\Qunrecognized property "arch.arm.shared.export_include_dirs"\E`)),
- )
-}
-
-func TestSnapshotSameLibraryWithNativeLibsAndNativeSharedLib(t *testing.T) {
- result := testSdkWithCc(t, `
- module_exports {
- host_supported: true,
- name: "myexports",
- target: {
- android: {
- native_shared_libs: [
- "mynativelib",
- ],
- },
- not_windows: {
- native_libs: [
- "mynativelib",
- ],
- },
- },
- }
-
- cc_library {
- name: "mynativelib",
- host_supported: true,
- srcs: [
- "Test.cpp",
- ],
- stl: "none",
- recovery_available: true,
- vendor_available: true,
- }
- `)
-
- CheckSnapshot(t, result, "myexports", "",
- checkAndroidBpContents(`
+ // Make sure that the generated sdk_snapshot uses the native_libs property.
+ checkVersionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library {
- name: "mynativelib",
- prefer: false,
+ name: "myexports_mynativelib@current",
+ sdk_member_name: "mynativelib",
visibility: ["//visibility:public"],
apex_available: ["//apex_available:platform"],
- host_supported: true,
+ installable: false,
vendor_available: true,
stl: "none",
compile_multilib: "both",
- target: {
- host: {
- enabled: false,
- },
- android_arm64: {
- shared: {
- srcs: ["android/arm64/lib/mynativelib.so"],
- },
- static: {
- enabled: false,
- },
- },
- android_arm: {
- shared: {
- srcs: ["android/arm/lib/mynativelib.so"],
- },
- static: {
- enabled: false,
- },
- },
- linux_glibc_x86_64: {
- enabled: true,
+ export_include_dirs: ["include/myinclude"],
+ arch: {
+ arm64: {
static: {
- srcs: ["linux_glibc/x86_64/lib/mynativelib.a"],
+ srcs: ["arm64/lib/mynativelib.a"],
},
shared: {
- srcs: ["linux_glibc/x86_64/lib/mynativelib.so"],
+ srcs: ["arm64/lib/mynativelib.so"],
},
},
- linux_glibc_x86: {
- enabled: true,
+ arm: {
static: {
- srcs: ["linux_glibc/x86/lib/mynativelib.a"],
+ srcs: ["arm/lib/mynativelib.a"],
},
shared: {
- srcs: ["linux_glibc/x86/lib/mynativelib.so"],
+ srcs: ["arm/lib/mynativelib.so"],
},
},
},
}
-`),
- checkAllCopyRules(`
-.intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> android/arm64/lib/mynativelib.so
-.intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> android/arm/lib/mynativelib.so
-.intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> linux_glibc/x86_64/lib/mynativelib.a
-.intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> linux_glibc/x86_64/lib/mynativelib.so
-.intermediates/mynativelib/linux_glibc_x86_static/mynativelib.a -> linux_glibc/x86/lib/mynativelib.a
-.intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> linux_glibc/x86/lib/mynativelib.so
-`),
- )
-}
-func TestSnapshotSameLibraryWithAndroidNativeLibsAndHostNativeSharedLib(t *testing.T) {
- result := testSdkWithCc(t, `
- module_exports {
- host_supported: true,
- name: "myexports",
- target: {
- android: {
- native_libs: [
- "mynativelib",
- ],
- },
- not_windows: {
- native_shared_libs: [
- "mynativelib",
- ],
- },
- },
- }
-
- cc_library {
- name: "mynativelib",
- host_supported: true,
- srcs: [
- "Test.cpp",
- ],
- stl: "none",
- recovery_available: true,
- vendor_available: true,
- }
- `)
-
- CheckSnapshot(t, result, "myexports", "",
- checkAndroidBpContents(`
-// This is auto-generated. DO NOT EDIT.
-
-cc_prebuilt_library {
- name: "mynativelib",
- prefer: false,
+module_exports_snapshot {
+ name: "myexports@current",
visibility: ["//visibility:public"],
- apex_available: ["//apex_available:platform"],
- host_supported: true,
- vendor_available: true,
- stl: "none",
- compile_multilib: "both",
- target: {
- host: {
- enabled: false,
- },
- android_arm64: {
- static: {
- srcs: ["android/arm64/lib/mynativelib.a"],
- },
- shared: {
- srcs: ["android/arm64/lib/mynativelib.so"],
- },
- },
- android_arm: {
- static: {
- srcs: ["android/arm/lib/mynativelib.a"],
- },
- shared: {
- srcs: ["android/arm/lib/mynativelib.so"],
- },
- },
- linux_glibc_x86_64: {
- enabled: true,
- shared: {
- srcs: ["linux_glibc/x86_64/lib/mynativelib.so"],
- },
- static: {
- enabled: false,
- },
- },
- linux_glibc_x86: {
- enabled: true,
- shared: {
- srcs: ["linux_glibc/x86/lib/mynativelib.so"],
- },
- static: {
- enabled: false,
- },
- },
- },
+ native_libs: ["myexports_mynativelib@current"],
}
`),
checkAllCopyRules(`
-.intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> android/arm64/lib/mynativelib.a
-.intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> android/arm64/lib/mynativelib.so
-.intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> android/arm/lib/mynativelib.a
-.intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> android/arm/lib/mynativelib.so
-.intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> linux_glibc/x86_64/lib/mynativelib.so
-.intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> linux_glibc/x86/lib/mynativelib.so
+myinclude/Test.h -> include/myinclude/Test.h
+.intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> arm64/lib/mynativelib.a
+.intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so
+.intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> arm/lib/mynativelib.a
+.intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so
`),
+ // TODO(b/183315522): Remove this and fix the issue.
+ snapshotTestErrorHandler(checkSnapshotPreferredWithSource, android.FixtureExpectsAtLeastOneErrorMatchingPattern(`\Qunrecognized property "arch.arm.shared.export_include_dirs"\E`)),
)
}
-func TestSnapshotSameLibraryWithNativeStaticLibsAndNativeSharedLib(t *testing.T) {
- testSdkError(t, "Incompatible member types", `
- module_exports {
- host_supported: true,
- name: "myexports",
- target: {
- android: {
- native_shared_libs: [
- "mynativelib",
- ],
- },
- not_windows: {
- native_static_libs: [
- "mynativelib",
- ],
- },
- },
- }
-
- cc_library {
- name: "mynativelib",
- host_supported: true,
- srcs: [
- ],
- stl: "none",
- recovery_available: true,
- vendor_available: true,
- }
- `)
-}
-
func TestHostSnapshotWithMultiLib64(t *testing.T) {
result := testSdkWithCc(t, `
module_exports {
@@ -1517,7 +1771,7 @@ func TestHostSnapshotWithMultiLib64(t *testing.T) {
`)
CheckSnapshot(t, result, "myexports", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_static {
@@ -1544,6 +1798,51 @@ cc_prebuilt_library_static {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_static {
+ name: "myexports_mynativelib@current",
+ sdk_member_name: "mynativelib",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ device_supported: false,
+ host_supported: true,
+ installable: false,
+ stl: "none",
+ compile_multilib: "64",
+ export_include_dirs: [
+ "include/myinclude",
+ "include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl",
+ ],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["x86_64/lib/mynativelib.a"],
+ },
+ },
+}
+
+module_exports_snapshot {
+ name: "myexports@current",
+ visibility: ["//visibility:public"],
+ device_supported: false,
+ host_supported: true,
+ compile_multilib: "64",
+ native_static_libs: ["myexports_mynativelib@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
myinclude/Test.h -> include/myinclude/Test.h
.intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h -> include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h
@@ -1569,7 +1868,7 @@ func TestSnapshotWithCcHeadersLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_headers {
@@ -1613,7 +1912,7 @@ func TestSnapshotWithCcHeadersLibraryAndNativeBridgeSupport(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_headers {
@@ -1698,7 +1997,7 @@ func TestSnapshotWithCcHeadersLibraryAndImageVariants(t *testing.T) {
`, trait, property))
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(fmt.Sprintf(`
+ checkUnversionedAndroidBpContents(fmt.Sprintf(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_headers {
@@ -1747,7 +2046,7 @@ func TestHostSnapshotWithCcHeadersLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_headers {
@@ -1773,6 +2072,51 @@ cc_prebuilt_library_headers {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_headers {
+ name: "mysdk_mynativeheaders@current",
+ sdk_member_name: "mynativeheaders",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ device_supported: false,
+ host_supported: true,
+ stl: "none",
+ compile_multilib: "both",
+ export_include_dirs: ["include/myinclude"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ device_supported: false,
+ host_supported: true,
+ native_header_libs: ["mysdk_mynativeheaders@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
myinclude/Test.h -> include/myinclude/Test.h
`),
@@ -1804,7 +2148,7 @@ func TestDeviceAndHostSnapshotWithCcHeadersLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_headers {
@@ -1835,6 +2179,55 @@ cc_prebuilt_library_headers {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_headers {
+ name: "mysdk_mynativeheaders@current",
+ sdk_member_name: "mynativeheaders",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ host_supported: true,
+ stl: "none",
+ compile_multilib: "both",
+ export_system_include_dirs: ["common_os/include/myinclude"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ android: {
+ export_include_dirs: ["android/include/myinclude-android"],
+ },
+ linux_glibc: {
+ export_include_dirs: ["linux_glibc/include/myinclude-host"],
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ host_supported: true,
+ native_header_libs: ["mysdk_mynativeheaders@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
myinclude/Test.h -> common_os/include/myinclude/Test.h
myinclude-android/AndroidTest.h -> android/include/myinclude-android/AndroidTest.h
@@ -1867,7 +2260,7 @@ func TestSystemSharedLibPropagation(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -1940,7 +2333,7 @@ cc_prebuilt_library_shared {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -1974,7 +2367,59 @@ cc_prebuilt_library_shared {
},
}
`),
- )
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_shared {
+ name: "mysdk_sslvariants@current",
+ sdk_member_name: "sslvariants",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ host_supported: true,
+ installable: false,
+ compile_multilib: "both",
+ target: {
+ host: {
+ enabled: false,
+ },
+ android: {
+ system_shared_libs: [],
+ },
+ android_arm64: {
+ srcs: ["android/arm64/lib/sslvariants.so"],
+ },
+ android_arm: {
+ srcs: ["android/arm/lib/sslvariants.so"],
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["linux_glibc/x86_64/lib/sslvariants.so"],
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ srcs: ["linux_glibc/x86/lib/sslvariants.so"],
+ },
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ host_supported: true,
+ native_shared_libs: ["mysdk_sslvariants@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+`))
}
func TestStubsLibrary(t *testing.T) {
@@ -1999,7 +2444,7 @@ func TestStubsLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -2053,7 +2498,7 @@ func TestDeviceAndHostSnapshotWithStubsLibrary(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -2092,7 +2537,64 @@ cc_prebuilt_library_shared {
},
}
`),
- )
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_shared {
+ name: "mysdk_stubslib@current",
+ sdk_member_name: "stubslib",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ host_supported: true,
+ installable: false,
+ compile_multilib: "both",
+ stubs: {
+ versions: [
+ "1",
+ "2",
+ "3",
+ "current",
+ ],
+ },
+ target: {
+ host: {
+ enabled: false,
+ },
+ android_arm64: {
+ srcs: ["android/arm64/lib/stubslib.so"],
+ },
+ android_arm: {
+ srcs: ["android/arm/lib/stubslib.so"],
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["linux_glibc/x86_64/lib/stubslib.so"],
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ srcs: ["linux_glibc/x86/lib/stubslib.so"],
+ },
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ host_supported: true,
+ native_shared_libs: ["mysdk_stubslib@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+`))
}
func TestUniqueHostSoname(t *testing.T) {
@@ -2111,7 +2613,7 @@ func TestUniqueHostSoname(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {
@@ -2143,6 +2645,57 @@ cc_prebuilt_library_shared {
},
}
`),
+ checkVersionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+cc_prebuilt_library_shared {
+ name: "mysdk_mylib@current",
+ sdk_member_name: "mylib",
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ host_supported: true,
+ installable: false,
+ unique_host_soname: true,
+ compile_multilib: "both",
+ target: {
+ host: {
+ enabled: false,
+ },
+ android_arm64: {
+ srcs: ["android/arm64/lib/mylib.so"],
+ },
+ android_arm: {
+ srcs: ["android/arm/lib/mylib.so"],
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ srcs: ["linux_glibc/x86_64/lib/mylib-host.so"],
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ srcs: ["linux_glibc/x86/lib/mylib-host.so"],
+ },
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ host_supported: true,
+ native_shared_libs: ["mysdk_mylib@current"],
+ target: {
+ host: {
+ enabled: false,
+ },
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ linux_glibc_x86: {
+ enabled: true,
+ },
+ },
+}
+`),
checkAllCopyRules(`
.intermediates/mylib/android_arm64_armv8-a_shared/mylib.so -> android/arm64/lib/mylib.so
.intermediates/mylib/android_arm_armv7-a-neon_shared/mylib.so -> android/arm/lib/mylib.so
@@ -2175,7 +2728,7 @@ func TestNoSanitizerMembers(t *testing.T) {
`)
CheckSnapshot(t, result, "mysdk", "",
- checkAndroidBpContents(`
+ checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
cc_prebuilt_library_shared {