summaryrefslogtreecommitdiff
path: root/libs/androidfw/Android.bp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-10-11 16:50:37 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-10-12 16:02:00 -0700
commit873ef0e2302a1581dbcb83b49cefc95dcc41f5a0 (patch)
treeef00b0878f81644c2cbb37d7f4e5b5a2fc0a5c0c /libs/androidfw/Android.bp
parentdf043ee75cffd64017fd5a571b1e79ee763ea62e (diff)
libandroidfw_tests: package test data correctly
- Convert to use soong, which allows bundling test data with benchmarks. - Also separate libandroidfw_benchmarks so that it doesn't depend on gtest. Test: manual Change-Id: I45bd222fafa87172c77b7f5bb2a7a89ddca72361
Diffstat (limited to 'libs/androidfw/Android.bp')
-rw-r--r--libs/androidfw/Android.bp102
1 files changed, 93 insertions, 9 deletions
diff --git a/libs/androidfw/Android.bp b/libs/androidfw/Android.bp
index c4c14c9e32d4..987096fd6658 100644
--- a/libs/androidfw/Android.bp
+++ b/libs/androidfw/Android.bp
@@ -14,15 +14,27 @@
// libandroidfw is partially built for the host (used by obbtool, aapt, and others)
-cc_library {
- name: "libandroidfw",
- host_supported: true,
+cc_defaults {
+ name: "libandroidfw_defaults",
cflags: [
- "-Wall",
"-Werror",
- "-Wunused",
"-Wunreachable-code",
],
+ target: {
+ windows: {
+ // The Windows compiler warns incorrectly for value initialization with {}.
+ cppflags: ["-Wno-missing-field-initializers"],
+ },
+ host: {
+ cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
+ },
+ },
+}
+
+cc_library {
+ name: "libandroidfw",
+ defaults: ["libandroidfw_defaults"],
+ host_supported: true,
srcs: [
"ApkAssets.cpp",
"Asset.cpp",
@@ -67,7 +79,6 @@ cc_library {
},
},
host: {
- cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
shared: {
enabled: false,
},
@@ -84,9 +95,82 @@ cc_library {
},
windows: {
enabled: true,
- cppflags: ["-Wno-missing-field-initializers"], // The Windows compiler warns
- // incorrectly for value
- // initialization with {}.
},
},
}
+
+common_test_libs = [
+ "libandroidfw",
+ "libbase",
+ "libcutils",
+ "libutils",
+ "libziparchive",
+]
+
+cc_test {
+ name: "libandroidfw_tests",
+ host_supported: true,
+ defaults: ["libandroidfw_defaults"],
+ cppflags: [
+ // This is to suppress warnings/errors from gtest
+ "-Wno-unnamed-type-template-args",
+ ],
+ srcs: [
+ // Helpers/infra for testing.
+ "tests/CommonHelpers.cpp",
+ "tests/TestHelpers.cpp",
+ "tests/TestMain.cpp",
+
+ // Actual tests.
+ "tests/ApkAssets_test.cpp",
+ "tests/AppAsLib_test.cpp",
+ "tests/Asset_test.cpp",
+ "tests/AssetManager2_test.cpp",
+ "tests/AttributeFinder_test.cpp",
+ "tests/AttributeResolution_test.cpp",
+ "tests/ByteBucketArray_test.cpp",
+ "tests/Config_test.cpp",
+ "tests/ConfigLocale_test.cpp",
+ "tests/Idmap_test.cpp",
+ "tests/LoadedArsc_test.cpp",
+ "tests/ResourceUtils_test.cpp",
+ "tests/ResTable_test.cpp",
+ "tests/Split_test.cpp",
+ "tests/StringPiece_test.cpp",
+ "tests/Theme_test.cpp",
+ "tests/TypeWrappers_test.cpp",
+ "tests/ZipUtils_test.cpp",
+ ],
+ target: {
+ android: {
+ srcs: [
+ "tests/BackupData_test.cpp",
+ "tests/ObbFile_test.cpp",
+ ],
+ shared_libs: common_test_libs + ["libui"],
+ },
+ host: {
+ static_libs: common_test_libs + ["liblog", "libz"],
+ },
+ },
+ data: ["tests/data/**/*.apk"],
+}
+
+cc_benchmark {
+ name: "libandroidfw_benchmarks",
+ defaults: ["libandroidfw_defaults"],
+ srcs: [
+ // Helpers/infra for benchmarking.
+ "tests/BenchMain.cpp",
+ "tests/BenchmarkHelpers.cpp",
+ "tests/CommonHelpers.cpp",
+
+ // Actual benchmarks.
+ "tests/AssetManager2_bench.cpp",
+ "tests/SparseEntry_bench.cpp",
+ "tests/Theme_bench.cpp",
+ ],
+ shared_libs: common_test_libs,
+ data: ["tests/data/**/*.apk"],
+}
+