diff options
Diffstat (limited to 'Android.bp')
-rw-r--r-- | Android.bp | 433 |
1 files changed, 432 insertions, 1 deletions
@@ -61,7 +61,11 @@ cc_defaults { */ clang: true, + static_libs: ["libc++fs"], shared_libs: ["libbase"], + + // build all ioraps for host. + host_supported: true, } cc_defaults { @@ -85,6 +89,9 @@ cc_defaults { // libplatformprotos has an indirect dependency on full, causing compilation/linking // errors if we use lite "libprotobuf-cpp-full", + + // phenotype flags support + "server_configurable_flags", ], // srcs: [":libprotobuf-internal-protos"], @@ -101,6 +108,9 @@ cc_library_static { srcs: [ ":iorap-aidl", "src/binder/iiorap_impl.cc", + "src/binder/package_change_observer.cc", + "src/binder/package_manager_remote.cc", + "src/binder/package_version_map.cc", ], shared_libs: [ "libbinder", @@ -112,6 +122,7 @@ cc_library_static { include_dirs: ["frameworks/native/aidl/binder"], export_aidl_headers: true, }, + static_libs: [ "libplatformprotos", // android framework C++ protos. ], @@ -120,10 +131,16 @@ cc_library_static { cc_defaults { name: "libiorap-manager-default-dependencies", static_libs: [ + "libiorap-binder", "libiorap-perfetto", + "libiorap-prefetcher", + "libiorap-db", + "libiorap-maintenance", ], defaults: [ "libiorap-perfetto-default-dependencies", + "libiorap-prefetcher-default-dependencies", + "libiorap-db-default-dependencies", ], // Users of 'libiorap-manager' also need to include these defaults to avoid // linking errors. @@ -158,6 +175,13 @@ cc_binary { init_rc: [ "iorapd.rc", ], + // iorapd fork+execs into iorap.prefetcherd and iorap.cmd.compiler + // maintenance used by tests + required: [ + "iorap.cmd.compiler", + "iorap.prefetcherd", + "iorap.cmd.maintenance", + ], } cc_library_static { @@ -205,14 +229,53 @@ cc_test { defaults: [ "iorap-default-flags", "iorap-default-dependencies", + "libiorap-compiler-default-dependencies", ], srcs: [ - "tests/src/**/*.cc", + "tests/src/binder/*.cc", + "tests/src/inode2filename/*.cc", + "tests/src/log/*.cc", + "tests/src/tmp/*.cc", + ], + data: [ + "tests/src/compiler/testdata/*", ], cflags: ["-O2", "-UNDEBUG"], // TODO: we should probably have per-component tests. static_libs: ["libgmock_main", "libgmock", "libgtest", "libiorap-inode2filename"], + +} + + +cc_test_host { + name: "iorapd-host-tests", + gtest: false, // we use gtest *and* gmock. + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-compiler-default-dependencies", + "libiorap-maintenance-default-dependencies", + ], + srcs: [ + "tests/src/compiler/*.cc", + "tests/src/db/*.cc", + "tests/src/maintenance/*.cc", + ], + data: [ + "tests/src/compiler/testdata/*", + "tests/src/maintenance/testdata/*", + ], + cflags: ["-O2", "-UNDEBUG"], + + // TODO: we should probably have per-component tests. + static_libs: [ + "libgmock_main", + "libgmock", + "libgtest", + "libiorap-compiler", + "libiorap-maintenance", + ], } filegroup { @@ -294,3 +357,371 @@ cc_binary { "perfetto_trace_protos", ], } + +// Static libraries cannot export their dependencies, +// the current convention is to use an extra 'defaults' rule for statics +// to bring in all the dependencies. +cc_defaults { + name: "libiorap-compiler-default-dependencies", + + defaults: [ + // use the perfetto namespace + "libiorap-perfetto-default-dependencies", + // use the inode2filename namespace + "libiorap-serialize-default-dependencies", // uses but does not re-export serialize. + ], + + // Some of the libperfetto header typedefs leak out into iorap. + // Avoids compilation #include errors. + // TODO: clean this up, the headers should not leak out (maybe all we need is a PerfettoConsumer + // forward declaration?). + include_dirs: [], + // Various perfetto protos are used directly by iorap. + // + // Furthermore, we need this regardless to avoid linking errors when linking + // libiorap-compiler.a into the main cc_binary rule. + static_libs: [ + "libiorap-perfetto", + // "perfetto_trace_protos", + "libiorap-inode2filename", + "libiorap-serialize", + ], + + shared_libs: [ + // Not part of true dependencies: Users of 'libiorap-compiler' do not link against + // libperfetto. + // We only put this to avoid linking errors when building iorapd. + // TODO: can we split iorapd into libiorapd-main that doesn't link against libperfetto? + // only the last cc_binary should need the full transitive closure of the dependency graph. + ] +} + +cc_library_static { + name: "libiorap-compiler", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-compiler-default-dependencies", + ], + + srcs: [ + "src/compiler/**/*.cc", + ], +} + +cc_binary { + name: "iorap.cmd.compiler", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-compiler-default-dependencies", + ], + shared_libs: [], + include_dirs: [], + srcs: [ + "src/compiler/**/*.cc", + ], + // Easier debugging. TODO: make a separate debug config. + // XX: Using -O0 seems to completely hide some errors. + cflags: ["-O2", "-UNDEBUG", "-DIORAP_COMPILER_MAIN=1"], + sanitize: { + undefined: true, + all_undefined: true, + // Pretty print when ubsan detects a problem. + // Otherwise it just calls abort(). + +/* + diag: { + undefined: true, + }, + */ // don't use the diag when you want it to crash. + }, + + static_libs: [ + ], + required: [ + "iorap.inode2filename", + ], +} + +// Static libraries cannot export their dependencies, +// the current convention is to use an extra 'defaults' rule for statics +// to bring in all the dependencies. +cc_defaults { + name: "libiorap-serialize-default-dependencies", + + defaults: [ + ], + + include_dirs: [], + static_libs: [ + ], + shared_libs: [ + ], + // Above intentionally left empty. + srcs: [ + "src/serialize/**/*.proto", + ], +} + +cc_library_static { + name: "libiorap-serialize", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-serialize-default-dependencies", + ], + + srcs: [ + "src/serialize/**/*.cc", + ], +} + + +// Static libraries cannot export their dependencies, +// the current convention is to use an extra 'defaults' rule for statics +// to bring in all the dependencies. +cc_defaults { + name: "libiorap-prefetcher-default-dependencies", + + defaults: [ + ], + + include_dirs: [], + static_libs: [ + "libiorap-serialize", + ], + shared_libs: [ + "libminijail", + ], + + // disable mac builds because libminijail doesn't work there + target: { + darwin: { + enabled: false, + }, + }, +} + +cc_library_static { + name: "libiorap-prefetcher", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-prefetcher-default-dependencies", + "libiorap-serialize-default-dependencies", + ], + + srcs: [ + "src/prefetcher/**/*.cc", + ], +} + +cc_binary { + name: "iorap.prefetcherd", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-prefetcher-default-dependencies", + "libiorap-serialize-default-dependencies", + ], + shared_libs: [], + include_dirs: [], + srcs: [ + "src/prefetcher/**/*.cc", + ], + // Easier debugging. TODO: make a separate debug config. + // XX: Using -O0 seems to completely hide some errors. + cflags: ["-O2", "-UNDEBUG", "-DIORAP_PREFETCHER_MAIN=1"], + sanitize: { + undefined: true, + all_undefined: true, + // Pretty print when ubsan detects a problem. + // Otherwise it just calls abort(). + +/* + diag: { + undefined: true, + }, + */ // don't use the diag when you want it to crash. + }, + + static_libs: [ + ], +} + +cc_binary { + name: "iorap.cmd.prefetcher.client", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-prefetcher-default-dependencies", + "libiorap-serialize-default-dependencies", + ], + shared_libs: [], + include_dirs: [], + srcs: [ + "src/prefetcher/**/*.cc", + ], + // Easier debugging. TODO: make a separate debug config. + // XX: Using -O0 seems to completely hide some errors. + cflags: ["-O2", "-UNDEBUG", "-DIORAP_PREFETCHER_MAIN_CLIENT=1"], + sanitize: { + undefined: true, + all_undefined: true, + // Pretty print when ubsan detects a problem. + // Otherwise it just calls abort(). + +/* + diag: { + undefined: true, + }, + */ // don't use the diag when you want it to crash. + }, + + static_libs: [ + ], +} + +prebuilt_etc { + name: "iorap.prefetcherd.policy", + sub_dir: "seccomp_policy", + arch: { + arm: { + src: "seccomp_policy/prefetcherd.arm.policy" + }, + arm64: { + src: "seccomp_policy/prefetcherd.arm64.policy" + }, + x86: { + src: "seccomp_policy/prefetcherd.x86.policy" + }, + x86_64: { + src: "seccomp_policy/prefetcherd.x86_64.policy" + }, + }, + required: [ + "crash_dump.policy", + ], +} + +// Static libraries cannot export their dependencies, +// the current convention is to use an extra 'defaults' rule for statics +// to bring in all the dependencies. +cc_defaults { + name: "libiorap-db-default-dependencies", + + defaults: [ + ], + + include_dirs: [], + static_libs: [ + ], + shared_libs: [ + "libsqlite", + ], +} + +cc_library_static { + name: "libiorap-db", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-db-default-dependencies", + ], + + srcs: [ + "src/db/**/*.cc", + ], +} + +cc_binary { + name: "iorap.cmd.db", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-db-default-dependencies", + ], + shared_libs: [], + include_dirs: [], + srcs: [ + "src/db/**/*.cc", + ], + // Easier debugging. TODO: make a separate debug config. + // XX: Using -O0 seems to completely hide some errors. + cflags: ["-O2", "-UNDEBUG", "-DIORAP_DB_MAIN=1"], + sanitize: { + undefined: true, + all_undefined: true, + // Pretty print when ubsan detects a problem. + // Otherwise it just calls abort(). + +/* + diag: { + undefined: true, + }, + */ // don't use the diag when you want it to crash. + }, + + static_libs: [ + ], +} + +cc_defaults { + name: "libiorap-maintenance-default-dependencies", + + defaults: [ + "libiorap-compiler-default-dependencies", + "libiorap-db-default-dependencies", + "libiorap-prefetcher-default-dependencies", + ], + + include_dirs: [], + + static_libs: [ + "libiorap-binder", + "libiorap-compiler", + "libiorap-db", + "libiorap-prefetcher", + ], + + shared_libs: [] +} + +cc_library_static { + name: "libiorap-maintenance", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-maintenance-default-dependencies", + ], + + srcs: [ + "src/maintenance/*.cc", + ], +} + +cc_binary { + name: "iorap.cmd.maintenance", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-maintenance-default-dependencies", + ], + shared_libs: [], + include_dirs: [], + srcs: [ + "src/maintenance/*.cc", + ], + cflags: ["-O2", "-UNDEBUG", "-DIORAP_MAINTENANCE_MAIN=1"], + sanitize: { + undefined: true, + all_undefined: true, + + diag: { + undefined: true, + }, + }, + + static_libs: [], +} |