diff options
author | 2020-03-12 10:24:35 +0000 | |
---|---|---|
committer | 2020-03-20 16:55:24 +0000 | |
commit | 9b76c0b65a83796f0f326e51af2aa2b45789cbc1 (patch) | |
tree | 5505f262ad73b4269b467919d8cb707186a24b6b /sdk/cc_sdk_test.go | |
parent | 71da478f51817c1d3815666d1731621769f851c5 (diff) |
Add support for using cc_library in sdk/module_exports
Added link type support in module creation code as cc_prebuilt_library
has to provide both shared and static libraries.
Had to add some calls to FirstUniquePaths() around the include dirs
settings in library_sdk_member as otherwise the shared variant contains
duplicate include dirs (presumably because it gets one set from its
dependency on the static variant and one set of its own). That
difference in include dirs causes problems in the generated
cc_prebuilt_library.
Test: m nothing
Bug: 142918168
Change-Id: Ie7f23fc2341c83c7814cc98e3970df4f5d4c8423
Diffstat (limited to 'sdk/cc_sdk_test.go')
-rw-r--r-- | sdk/cc_sdk_test.go | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go index 6727b4bf0..27a951865 100644 --- a/sdk/cc_sdk_test.go +++ b/sdk/cc_sdk_test.go @@ -1196,6 +1196,93 @@ include/Test.h -> include/include/Test.h ) } +func TestSnapshotWithCcLibrary(t *testing.T) { + result := testSdkWithCc(t, ` + module_exports { + name: "myexports", + native_libs: ["mynativelib"], + } + + cc_library { + name: "mynativelib", + srcs: [ + "Test.cpp", + ], + export_include_dirs: ["include"], + system_shared_libs: [], + stl: "none", + } + `) + + result.CheckSnapshot("myexports", "", + checkAndroidBpContents(` +// This is auto-generated. DO NOT EDIT. + +cc_prebuilt_library { + name: "myexports_mynativelib@current", + sdk_member_name: "mynativelib", + installable: false, + stl: "none", + export_include_dirs: ["include/include"], + arch: { + arm64: { + static: { + srcs: ["arm64/lib/mynativelib.a"], + }, + shared: { + srcs: ["arm64/lib/mynativelib.so"], + }, + }, + arm: { + static: { + srcs: ["arm/lib/mynativelib.a"], + }, + shared: { + srcs: ["arm/lib/mynativelib.so"], + }, + }, + }, +} + +cc_prebuilt_library { + name: "mynativelib", + prefer: false, + stl: "none", + export_include_dirs: ["include/include"], + arch: { + arm64: { + static: { + srcs: ["arm64/lib/mynativelib.a"], + }, + shared: { + srcs: ["arm64/lib/mynativelib.so"], + }, + }, + arm: { + static: { + srcs: ["arm/lib/mynativelib.a"], + }, + shared: { + srcs: ["arm/lib/mynativelib.so"], + }, + }, + }, +} + +module_exports_snapshot { + name: "myexports@current", + native_libs: ["myexports_mynativelib@current"], +} +`), + checkAllCopyRules(` +include/Test.h -> include/include/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`), + ) +} + func TestHostSnapshotWithMultiLib64(t *testing.T) { // b/145598135 - Generating host snapshots for anything other than linux is not supported. SkipIfNotLinux(t) |