1// 2// Copyright (C) 2018 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17cc_defaults { 18 name: "libsnapshot_defaults", 19 defaults: ["fs_mgr_defaults"], 20 cflags: [ 21 "-D_FILE_OFFSET_BITS=64", 22 "-Wall", 23 "-Werror", 24 ], 25 shared_libs: [ 26 "libbase", 27 "libcutils", 28 "liblog", 29 ], 30 static_libs: [ 31 "libdm", 32 "libfstab", 33 "update_metadata-protos", 34 ], 35 whole_static_libs: [ 36 "libext2_uuid", 37 "libext4_utils", 38 "libfstab", 39 ], 40 header_libs: [ 41 "libfiemap_headers", 42 ], 43 export_static_lib_headers: [ 44 "update_metadata-protos", 45 ], 46 export_header_lib_headers: [ 47 "libfiemap_headers", 48 ], 49 export_include_dirs: ["include"], 50 proto: { 51 type: "lite", 52 export_proto_headers: true, 53 canonical_path_from_root: false, 54 }, 55} 56 57cc_defaults { 58 name: "libsnapshot_hal_deps", 59 cflags: [ 60 "-DLIBSNAPSHOT_USE_HAL", 61 ], 62 shared_libs: [ 63 "android.hardware.boot@1.0", 64 "android.hardware.boot@1.1", 65 ], 66} 67 68filegroup { 69 name: "libsnapshot_sources", 70 srcs: [ 71 "android/snapshot/snapshot.proto", 72 "device_info.cpp", 73 "snapshot.cpp", 74 "snapshot_stats.cpp", 75 "snapshot_metadata_updater.cpp", 76 "partition_cow_creator.cpp", 77 "return.cpp", 78 "utility.cpp", 79 ], 80} 81 82cc_library_headers { 83 name: "libsnapshot_headers", 84 recovery_available: true, 85 defaults: ["libsnapshot_defaults"], 86} 87 88cc_library_static { 89 name: "libsnapshot", 90 defaults: [ 91 "libsnapshot_defaults", 92 "libsnapshot_hal_deps", 93 ], 94 srcs: [":libsnapshot_sources"], 95 static_libs: [ 96 "libfs_mgr_binder" 97 ], 98} 99 100cc_library_static { 101 name: "libsnapshot_init", 102 defaults: ["libsnapshot_defaults"], 103 srcs: [":libsnapshot_sources"], 104 recovery_available: true, 105 static_libs: [ 106 "libfs_mgr", 107 ], 108} 109 110cc_library_static { 111 name: "libsnapshot_nobinder", 112 defaults: [ 113 "libsnapshot_defaults", 114 "libsnapshot_hal_deps", 115 ], 116 srcs: [":libsnapshot_sources"], 117 recovery_available: true, 118 static_libs: [ 119 "libfs_mgr", 120 ], 121} 122 123cc_library_static { 124 name: "libsnapshot_test_helpers", 125 defaults: ["libsnapshot_defaults"], 126 export_include_dirs: [ 127 "include_test", 128 ], 129 srcs: [ 130 "android/snapshot/snapshot.proto", 131 "test_helpers.cpp", 132 ], 133 shared_libs: [ 134 "android.hardware.boot@1.1", 135 "libcrypto", 136 ], 137 export_shared_lib_headers: [ 138 "android.hardware.boot@1.1", 139 ], 140 header_libs: [ 141 "libstorage_literals_headers", 142 ], 143 export_header_lib_headers: [ 144 "libstorage_literals_headers", 145 ], 146 static_libs: [ 147 "libfs_mgr", 148 "libgmock", 149 "libgtest", 150 ], 151} 152 153cc_defaults { 154 name: "libsnapshot_test_defaults", 155 defaults: ["libsnapshot_defaults"], 156 srcs: [ 157 "partition_cow_creator_test.cpp", 158 "snapshot_metadata_updater_test.cpp", 159 "snapshot_test.cpp", 160 ], 161 shared_libs: [ 162 "libbinder", 163 "libcrypto", 164 "libhidlbase", 165 "libprotobuf-cpp-lite", 166 "libutils", 167 "libz", 168 ], 169 static_libs: [ 170 "android.hardware.boot@1.0", 171 "android.hardware.boot@1.1", 172 "libfs_mgr", 173 "libgsi", 174 "libgmock", 175 "liblp", 176 "libsnapshot", 177 "libsnapshot_test_helpers", 178 "libsparse", 179 ], 180 header_libs: [ 181 "libstorage_literals_headers", 182 ], 183 test_suites: [ 184 "vts", 185 "device-tests" 186 ], 187 test_min_api_level: 29, 188 auto_gen_config: true, 189 require_root: true, 190} 191 192cc_test { 193 name: "vts_libsnapshot_test", 194 defaults: ["libsnapshot_test_defaults"], 195} 196 197// For VTS 10 198vts_config { 199 name: "VtsLibsnapshotTest", 200 test_config: "VtsLibsnapshotTest.xml" 201} 202 203cc_binary { 204 name: "snapshotctl", 205 srcs: [ 206 "snapshotctl.cpp", 207 ], 208 static_libs: [ 209 "libfstab", 210 "libsnapshot", 211 ], 212 shared_libs: [ 213 "android.hardware.boot@1.0", 214 "android.hardware.boot@1.1", 215 "libbase", 216 "libbinder", 217 "libext2_uuid", 218 "libext4_utils", 219 "libfs_mgr_binder", 220 "libhidlbase", 221 "liblog", 222 "liblp", 223 "libprotobuf-cpp-lite", 224 "libstatslog", 225 "libutils", 226 ], 227} 228