blob: fd17a707cfdc91e9bf2752e3d0cedb64b997c988 [file] [log] [blame]
// List of clang-tidy checks that are reported as errors.
// Please keep this list ordered lexicographically.
tidy_errors = [
"android-*",
"bugprone-infinite-loop",
"bugprone-macro-parentheses",
"bugprone-misplaced-widening-cast",
"bugprone-move-forwarding-reference",
"bugprone-sizeof-container",
"bugprone-sizeof-expression",
"bugprone-string-constructor",
"bugprone-terminating-continue",
"bugprone-undefined-memory-manipulation",
"bugprone-undelegated-constructor",
"bugprone-unhandled-self-assignment",
"bugprone-unused-raii",
"cert-err34-c",
"google-default-arguments",
"google-explicit-constructor",
"google-readability-avoid-underscore-in-googletest-name",
"google-readability-todo",
"google-runtime-int",
"google-runtime-member-string-references",
"misc-move-const-arg",
"misc-move-forwarding-reference",
"misc-unused-parameters",
"misc-unused-using-decls",
"misc-use-after-move",
"modernize-pass-by-value",
"performance-faster-string-find",
"performance-for-range-copy",
"performance-implicit-conversion-in-loop",
"performance-inefficient-vector-operation",
"performance-move-const-arg",
"performance-move-constructor-init",
"performance-noexcept-move-constructor",
"performance-unnecessary-copy-initialization",
"performance-unnecessary-value-param",
"readability-avoid-const-params-in-decls",
]
cc_defaults {
name: "apex_flags_defaults",
cflags: [
"-Wall",
"-Wextra",
"-Werror",
"-Wno-unused-parameter",
// Some extra flags.
"-fstrict-aliasing",
"-Wredundant-decls",
"-Wshadow",
"-Wstrict-aliasing",
"-Wthread-safety",
"-Wthread-safety-negative",
"-Wunreachable-code",
"-Wunreachable-code-break",
"-Wunreachable-code-return",
"-Wunused",
"-Wused-but-marked-unused",
],
tidy: true,
tidy_checks: tidy_errors,
tidy_checks_as_errors: tidy_errors,
tidy_flags: [
"-format-style='file'",
"--header-filter='system/apex/'",
],
}
cc_defaults {
name: "libapexd-deps",
defaults: ["libapex-deps"],
shared_libs: [
"libbinder",
"libselinux",
"liblog",
"liblogwrap",
],
static_libs: [
"libapex",
"libavb",
"libdm",
"libext2_uuid",
"libverity_tree",
"libvold_binder",
"libxml2",
],
whole_static_libs: ["com.android.sysprop.apex"],
}
aidl_interface {
name: "apex_aidl_interface",
unstable: true,
srcs: [
"aidl/android/apex/ApexInfo.aidl",
"aidl/android/apex/ApexInfoList.aidl",
"aidl/android/apex/ApexSessionInfo.aidl",
"aidl/android/apex/ApexSessionParams.aidl",
"aidl/android/apex/IApexService.aidl",
],
local_include_dir: "aidl",
backend: {
java: {
sdk_version: "28",
},
ndk: {
enabled: false,
},
},
}
cc_binary {
name: "apexd",
defaults: [
"apex_flags_defaults",
"libapex-deps",
"libapexd-deps",
"libapexservice-deps",
],
srcs: [
"apexd_main.cpp",
],
static_libs: [
"libapex",
"libapexd",
"libapexd_checkpoint_vold",
"libapexservice",
],
init_rc: ["apexd.rc"],
// Just like the init, apexd should be able to run without
// any APEX activated. To do so, it uses the bootstrap linker
// and the bootstrap bionic libraries.
bootstrap: true,
}
cc_library_static {
name: "libapexd",
defaults: [
"apex_flags_defaults",
"libapexd-deps",
],
srcs: [
"apex_database.cpp",
"apexd.cpp",
"apexd_lifecycle.cpp",
"apexd_loop.cpp",
"apexd_prepostinstall.cpp",
"apexd_private.cpp",
"apexd_session.cpp",
"apexd_verity.cpp",
],
export_include_dirs: ["."],
generated_sources: ["apex-info-list"],
// Don't add shared/static libs here; add to libapexd_defaults instead.
}
cc_library_static {
name: "libapexd_checkpoint_vold",
defaults: ["apex_flags_defaults"],
srcs: [ "apexd_checkpoint_vold.cpp" ],
static_libs: [
"libbase",
"libutils",
"libvold_binder",
],
export_include_dirs: ["."],
}
cc_defaults {
name: "libapexservice-deps",
shared_libs: [
"apex_aidl_interface-cpp",
"libbinder",
"libutils",
],
}
cc_library_static {
name: "libapexservice",
defaults: [
"apex_flags_defaults",
"libapexd-deps",
"libapexservice-deps",
],
srcs: ["apexservice.cpp"],
static_libs: [
"libapexd",
],
}
cc_defaults {
name: "libapex-deps",
shared_libs: [
"libbase",
"libcrypto",
"libcutils",
"libprotobuf-cpp-full",
"libziparchive",
],
static_libs: [
"lib_apex_session_state_proto",
"lib_apex_manifest_proto",
"libavb",
],
static: {
whole_static_libs: ["libc++fs"],
},
cpp_std: "experimental",
shared: {
static_libs: ["libc++fs"],
},
}
cc_library_static {
name: "libapex",
defaults: [
"apex_flags_defaults",
"libapex-deps"
],
srcs: [
"apex_file.cpp",
"apex_manifest.cpp",
"apex_preinstalled_data.cpp",
"apex_shim.cpp",
],
host_supported: true,
target: {
darwin: {
enabled: false,
},
},
header_libs: [
"libutils_headers",
],
export_header_lib_headers: [
"libutils_headers",
],
}
genrule {
// Generates an apex which has a different manifest outside the filesystem
// image.
name: "gen_manifest_mismatch_apex",
out: ["apex.apexd_test_manifest_mismatch.apex"],
srcs: [":apex.apexd_test"],
tools: ["soong_zip", "zipalign", "conv_apex_manifest"],
cmd: "unzip -q $(in) -d $(genDir) && " +
"$(location conv_apex_manifest) setprop version 137 $(genDir)/apex_manifest.pb && " +
"$(location soong_zip) -d -C $(genDir) -D $(genDir) " +
"-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
"-o $(genDir)/unaligned.apex && " +
"$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
"$(genDir)/apex.apexd_test_manifest_mismatch.apex"
}
genrule {
// Generates an apex which has a different manifest outside the filesystem
// image.
name: "gen_manifest_mismatch_apex_no_hashtree",
out: ["apex.apexd_test_no_hashtree_manifest_mismatch.apex"],
srcs: [":apex.apexd_test_no_hashtree"],
tools: ["soong_zip", "zipalign", "conv_apex_manifest"],
cmd: "unzip -q $(in) -d $(genDir) && " +
"$(location conv_apex_manifest) setprop version 137 $(genDir)/apex_manifest.pb && " +
"$(location soong_zip) -d -C $(genDir) -D $(genDir) " +
"-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
"-o $(genDir)/unaligned.apex && " +
"$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
"$(genDir)/apex.apexd_test_no_hashtree_manifest_mismatch.apex"
}
genrule {
// Generates an apex with a corrupted filesystem superblock, which should cause
// Apex::Open to fail
name: "gen_corrupt_superblock_apex",
out: ["apex.apexd_test_corrupt_superblock_apex.apex"],
srcs: [":apex.apexd_test"],
tools: ["soong_zip", "zipalign"],
cmd: "unzip -q $(in) -d $(genDir) && " +
"dd if=/dev/zero of=$(genDir)/apex_payload.img conv=notrunc bs=1024 seek=1 count=1 && " +
"$(location soong_zip) -d -C $(genDir) -D $(genDir) " +
"-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
"-o $(genDir)/unaligned.apex && " +
"$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
"$(genDir)/apex.apexd_test_corrupt_superblock_apex.apex"
}
genrule {
// Generates an apex with a corrupted filesystem image, which should cause
// dm-verity verification to fail
name: "gen_corrupt_apex",
out: ["apex.apexd_test_corrupt_apex.apex"],
srcs: [":apex.apexd_test"],
tools: ["soong_zip", "zipalign"],
cmd: "unzip -q $(in) -d $(genDir) && " +
"dd if=/dev/zero of=$(genDir)/apex_payload.img conv=notrunc bs=1024 seek=16 count=1 && " +
"$(location soong_zip) -d -C $(genDir) -D $(genDir) " +
"-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
"-o $(genDir)/unaligned.apex && " +
"$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
"$(genDir)/apex.apexd_test_corrupt_apex.apex"
}
genrule {
// Extract the root digest with avbtool
name: "apex.apexd_test_digest",
out: ["apex.apexd_test_digest.txt"],
srcs: [":apex.apexd_test"],
tools: ["avbtool"],
cmd: "unzip -q $(in) -d $(genDir) apex_payload.img && " +
"$(location avbtool) print_partition_digests --image $(genDir)/apex_payload.img " +
"| cut -c 3-| tee $(out)"
}
genrule {
// Extract the root digest with avbtool
name: "apex.apexd_test_f2fs_digest",
out: ["apex.apexd_test_f2fs_digest.txt"],
srcs: [":apex.apexd_test_f2fs"],
tools: ["avbtool"],
cmd: "unzip -q $(in) -d $(genDir) apex_payload.img && " +
"$(location avbtool) print_partition_digests --image $(genDir)/apex_payload.img " +
"| cut -c 3-| tee $(out)"
}
genrule {
// Generates an apex which has same module name as apex.apexd_test.apex, but
// is actually signed with a different key.
name: "gen_key_mismatch_apex",
out: ["apex.apexd_test_different_key.apex"],
srcs: [":apex.apexd_test_no_inst_key"],
tools: ["soong_zip", "zipalign", "conv_apex_manifest"],
cmd: "unzip -q $(in) -d $(genDir) && " +
"$(location conv_apex_manifest) setprop name com.android.apex.test_package $(genDir)/apex_manifest.pb && " +
"$(location soong_zip) -d -C $(genDir) -D $(genDir) " +
"-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
"-o $(genDir)/unaligned.apex && " +
"$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
"$(genDir)/apex.apexd_test_different_key.apex"
}
cc_test {
name: "ApexTestCases",
defaults: [
"apex_flags_defaults",
"libapex-deps",
"libapexd-deps"
],
require_root: true,
cflags: [
// Otherwise libgmock won't compile.
"-Wno-used-but-marked-unused",
],
data: [
":apex.apexd_test",
":apex.apexd_test_f2fs",
":apex.apexd_test_digest",
":apex.apexd_test_f2fs_digest",
":apex.apexd_test_different_app",
":apex.apexd_test_no_hashtree",
":apex.apexd_test_no_hashtree_2",
":apex.apexd_test_no_inst_key",
":apex.apexd_test_f2fs_no_inst_key",
":apex.apexd_test_nocode",
":apex.apexd_test_postinstall",
":apex.apexd_test_preinstall",
":apex.apexd_test_prepostinstall.fail",
":apex.apexd_test_v2",
":apex.corrupted_b146895998",
":apex.banned_name",
":gen_key_mismatch_apex",
":gen_manifest_mismatch_apex",
":gen_manifest_mismatch_apex_no_hashtree",
":gen_corrupt_superblock_apex",
":gen_corrupt_apex",
":com.android.apex.cts.shim.v1_prebuilt",
":com.android.apex.cts.shim.v2_prebuilt",
":com.android.apex.cts.shim.v2_wrong_sha_prebuilt",
":com.android.apex.cts.shim.v2_additional_file_prebuilt",
":com.android.apex.cts.shim.v2_additional_folder_prebuilt",
":com.android.apex.cts.shim.v2_with_pre_install_hook_prebuilt",
":com.android.apex.cts.shim.v2_with_post_install_hook_prebuilt",
"apexd_testdata/com.android.apex.test_package.avbpubkey",
],
srcs: [
"apex_database_test.cpp",
"apex_file_test.cpp",
"apex_manifest_test.cpp",
"apex_preinstalled_data_test.cpp",
"apexd_session_test.cpp",
"apexd_verity_test.cpp",
"apexd_utils_test.cpp",
"apexservice_test.cpp",
],
host_supported: false,
compile_multilib: "first",
static_libs: [
"apex_aidl_interface-cpp",
"libapex",
"libapexd",
"libfstab",
"libgmock",
],
shared_libs: [
"libbinder",
"libfs_mgr",
"libutils",
],
test_suites: ["device-tests"],
test_config: "AndroidTest.xml",
}
cc_test {
name: "flattened_apex_test",
defaults: [
"apex_flags_defaults",
"libapex-deps",
"libapexd-deps"
],
srcs: ["flattened_apex_test.cpp"],
host_supported: false,
compile_multilib: "first",
static_libs: [
"libapex",
"libapexd",
],
test_suites: ["device-tests"],
test_config: "flattened_apex_test_config.xml",
}
xsd_config {
name: "apex-info-list",
srcs: ["ApexInfoList.xsd"],
package_name: "com.android.apex",
api_dir: "apex-info-list-api",
gen_writer: true,
}