1//
2// Copyright (C) 2019 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
17package {
18    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "system_core_fs_mgr_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    //   SPDX-license-identifier-MIT
24    default_applicable_licenses: ["system_core_fs_mgr_license"],
25}
26
27cc_library_static {
28    name: "libfs_avb",
29    defaults: ["fs_mgr_defaults"],
30    ramdisk_available: true,
31    vendor_ramdisk_available: true,
32    recovery_available: true,
33    host_supported: true,
34    export_include_dirs: ["include"],
35    srcs: [
36        "avb_ops.cpp",
37        "avb_util.cpp",
38        "fs_avb.cpp",
39        "fs_avb_util.cpp",
40        "types.cpp",
41        "util.cpp",
42    ],
43    static_libs: [
44        "libavb",
45        "libdm",
46        "libgsi",
47        "libfstab",
48    ],
49    export_static_lib_headers: [
50        "libfstab",
51    ],
52    shared_libs: [
53        "libbase",
54        "libcrypto",
55    ],
56    target: {
57        darwin: {
58            enabled: false,
59        },
60    },
61}
62
63cc_defaults {
64    name: "libfs_avb_host_test_defaults",
65    required: [
66        "avbtool",
67    ],
68    data: [
69        "tests/data/*",
70    ],
71    static_libs: [
72        "libavb",
73        "libavb_host_sysdeps",
74        "libdm",
75        "libext2_uuid",
76        "libfs_avb",
77        "libfstab",
78        "libgtest_host",
79    ],
80    shared_libs: [
81        "libbase",
82        "libchrome",
83        "libcrypto",
84    ],
85    target: {
86        darwin: {
87            enabled: false,
88        },
89    },
90    cflags: [
91        "-DHOST_TEST",
92    ],
93}
94
95cc_library_host_static {
96    name: "libfs_avb_test_util",
97    defaults: ["libfs_avb_host_test_defaults"],
98    srcs: [
99        "tests/fs_avb_test_util.cpp",
100    ],
101}
102
103cc_test_host {
104    name: "libfs_avb_test",
105    defaults: ["libfs_avb_host_test_defaults"],
106    test_suites: ["general-tests"],
107    test_options: {
108        unit_test: true,
109    },
110    static_libs: [
111        "libfs_avb_test_util",
112    ],
113    compile_multilib: "first",
114    data: [
115        ":avbtool",
116        ":fec",
117    ],
118    srcs: [
119        "tests/basic_test.cpp",
120        "tests/fs_avb_test.cpp",
121        "tests/fs_avb_util_test.cpp",
122    ],
123}
124
125cc_test_host {
126    name: "libfs_avb_internal_test",
127    defaults: ["libfs_avb_host_test_defaults"],
128    test_suites: ["general-tests"],
129    test_options: {
130        unit_test: true,
131    },
132    static_libs: [
133        "libfs_avb_test_util",
134    ],
135    compile_multilib: "first",
136    data: [
137        ":avbtool",
138        ":fec",
139    ],
140    srcs: [
141        "avb_util.cpp",
142        "util.cpp",
143        "tests/avb_util_test.cpp",
144        "tests/util_test.cpp",
145    ],
146}
147
148cc_test {
149    name: "libfs_avb_device_test",
150    test_suites: ["device-tests"],
151    require_root: true,
152    static_libs: [
153        "libavb",
154        "libdm",
155        "libext2_uuid",
156        "libfs_avb",
157        "libfstab",
158    ],
159    shared_libs: [
160        "libbase",
161        "libcrypto",
162    ],
163    srcs: [
164        "tests/fs_avb_device_test.cpp",
165    ],
166    cflags: [
167        "-Wall",
168        "-Wextra",
169        "-Werror",
170    ],
171}
172