blob: eaef18037751f5393a08071d72f25c6deb609c60 [file] [log] [blame]
//
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
cc_defaults {
name: "libsnapshot_defaults",
defaults: ["fs_mgr_defaults"],
cflags: [
"-D_FILE_OFFSET_BITS=64",
"-Wall",
"-Werror",
],
shared_libs: [
"libbase",
"libcutils",
"liblog",
],
static_libs: [
"libdm",
"libfstab",
"update_metadata-protos",
],
whole_static_libs: [
"libext2_uuid",
"libext4_utils",
"libfstab",
],
header_libs: [
"libfiemap_headers",
],
export_static_lib_headers: [
"update_metadata-protos",
],
export_header_lib_headers: [
"libfiemap_headers",
],
export_include_dirs: ["include"],
proto: {
type: "lite",
export_proto_headers: true,
canonical_path_from_root: false,
},
}
cc_defaults {
name: "libsnapshot_hal_deps",
cflags: [
"-DLIBSNAPSHOT_USE_HAL",
],
shared_libs: [
"android.hardware.boot@1.0",
"android.hardware.boot@1.1",
],
}
filegroup {
name: "libsnapshot_sources",
srcs: [
"android/snapshot/snapshot.proto",
"device_info.cpp",
"snapshot.cpp",
"snapshot_stats.cpp",
"snapshot_stub.cpp",
"snapshot_metadata_updater.cpp",
"partition_cow_creator.cpp",
"return.cpp",
"utility.cpp",
],
}
cc_library_headers {
name: "libsnapshot_headers",
recovery_available: true,
defaults: ["libsnapshot_defaults"],
}
cc_library_static {
name: "libsnapshot",
defaults: [
"libsnapshot_defaults",
"libsnapshot_hal_deps",
],
srcs: [":libsnapshot_sources"],
static_libs: [
"libfs_mgr_binder"
],
}
cc_library_static {
name: "libsnapshot_init",
native_coverage : true,
defaults: ["libsnapshot_defaults"],
srcs: [":libsnapshot_sources"],
recovery_available: true,
static_libs: [
"libfs_mgr",
],
}
cc_library_static {
name: "libsnapshot_nobinder",
defaults: [
"libsnapshot_defaults",
"libsnapshot_hal_deps",
],
srcs: [":libsnapshot_sources"],
recovery_available: true,
static_libs: [
"libfs_mgr",
],
}
cc_library_static {
name: "libsnapshot_test_helpers",
defaults: ["libsnapshot_defaults"],
export_include_dirs: [
"include_test",
],
srcs: [
"android/snapshot/snapshot.proto",
"test_helpers.cpp",
],
shared_libs: [
"android.hardware.boot@1.1",
"libcrypto",
],
export_shared_lib_headers: [
"android.hardware.boot@1.1",
],
header_libs: [
"libstorage_literals_headers",
],
export_header_lib_headers: [
"libstorage_literals_headers",
],
static_libs: [
"libfs_mgr",
"libgmock",
"libgtest",
],
}
cc_defaults {
name: "libsnapshot_test_defaults",
defaults: ["libsnapshot_defaults"],
srcs: [
"partition_cow_creator_test.cpp",
"snapshot_metadata_updater_test.cpp",
"snapshot_test.cpp",
],
shared_libs: [
"libbinder",
"libcrypto",
"libhidlbase",
"libprotobuf-cpp-lite",
"libutils",
"libz",
],
static_libs: [
"android.hardware.boot@1.0",
"android.hardware.boot@1.1",
"libfs_mgr",
"libgsi",
"libgmock",
"liblp",
"libsnapshot",
"libsnapshot_test_helpers",
"libsparse",
],
header_libs: [
"libstorage_literals_headers",
],
test_suites: [
"vts",
"device-tests"
],
test_min_api_level: 29,
auto_gen_config: true,
require_root: true,
}
cc_test {
name: "vts_libsnapshot_test",
defaults: ["libsnapshot_test_defaults"],
}
// For VTS 10
vts_config {
name: "VtsLibsnapshotTest",
test_config: "VtsLibsnapshotTest.xml"
}
cc_binary {
name: "snapshotctl",
srcs: [
"snapshotctl.cpp",
],
static_libs: [
"libfstab",
"libsnapshot",
"update_metadata-protos",
],
shared_libs: [
"android.hardware.boot@1.0",
"android.hardware.boot@1.1",
"libbase",
"libbinder",
"libext2_uuid",
"libext4_utils",
"libfs_mgr_binder",
"libhidlbase",
"liblog",
"liblp",
"libprotobuf-cpp-lite",
"libstatslog",
"libutils",
],
}
cc_test {
name: "snapshot_power_test",
srcs: [
"power_test.cpp",
],
static_libs: [
"libsnapshot",
"update_metadata-protos",
],
shared_libs: [
"libbase",
"libfs_mgr_binder",
"liblog",
],
gtest: false,
}
cc_defaults {
name: "libsnapshot_fuzzer_defaults",
native_coverage : true,
srcs: [
// Compile the protobuf definition again with type full.
"android/snapshot/snapshot_fuzz.proto",
"update_engine/update_metadata.proto",
"fuzz_utils.cpp",
"snapshot_fuzz.cpp",
"snapshot_fuzz_utils.cpp",
// Compile libsnapshot sources directly to avoid dependency
// to update_metadata-protos
":libsnapshot_sources",
],
static_libs: [
"libbase",
"libcrypto_static",
"libcutils",
"libext2_uuid",
"libext4_utils",
"libfstab",
"libfs_mgr",
"libgtest", // from libsnapshot_test_helpers
"libgmock", // from libsnapshot_test_helpers
"liblog",
"liblp",
"libsnapshot_test_helpers",
"libprotobuf-mutator",
],
header_libs: [
"libfiemap_headers",
"libstorage_literals_headers",
],
proto: {
type: "full",
canonical_path_from_root: false,
local_include_dirs: ["."],
},
}
cc_fuzz {
name: "libsnapshot_fuzzer",
defaults: ["libsnapshot_fuzzer_defaults"],
corpus: ["corpus/*"],
fuzz_config: {
cc: ["android-virtual-ab+bugs@google.com"],
componentid: 30545,
hotlists: ["1646452"],
fuzz_on_haiku_host: false,
fuzz_on_haiku_device: true,
},
}
cc_test {
name: "libsnapshot_fuzzer_test",
defaults: ["libsnapshot_fuzzer_defaults"],
data: ["corpus/*"],
test_suites: [
"device-tests",
],
auto_gen_config: true,
require_root: true,
}
cc_defaults {
name: "snapuserd_defaults",
srcs: [
"snapuserd.cpp",
],
cflags: [
"-Wall",
"-Werror"
],
static_libs: [
"libbase",
"liblog",
"libdm",
],
}
cc_binary {
name: "snapuserd",
defaults: ["snapuserd_defaults"],
}
cc_binary {
name: "snapuserd_ramdisk",
stem: "snapuserd",
defaults: ["snapuserd_defaults"],
ramdisk: true,
static_executable: true,
system_shared_libs: [],
}