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
17package {
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21liblp_lib_deps = [
22    "libbase",
23    "liblog",
24    "libcrypto_utils",
25    "libsparse",
26    "libext4_utils",
27    "libz",
28]
29
30cc_library {
31    name: "liblp",
32    host_supported: true,
33    recovery_available: true,
34    defaults: ["fs_mgr_defaults"],
35    cppflags: [
36        "-D_FILE_OFFSET_BITS=64",
37    ],
38    srcs: [
39        "builder.cpp",
40        "images.cpp",
41        "partition_opener.cpp",
42        "property_fetcher.cpp",
43        "reader.cpp",
44        "utility.cpp",
45        "writer.cpp",
46    ],
47    shared_libs: [
48        "libcrypto",
49    ] + liblp_lib_deps,
50    target: {
51        windows: {
52            enabled: true,
53        },
54        android: {
55            shared_libs: [
56                "libcutils",
57            ],
58        },
59    },
60    export_include_dirs: ["include"],
61}
62
63filegroup {
64    name: "liblp_test_srcs",
65    srcs: [
66        "builder_test.cpp",
67        "device_test.cpp",
68        "io_test.cpp",
69        "test_partition_opener.cpp",
70        "utility_test.cpp",
71    ],
72}
73
74cc_defaults {
75    name: "liblp_test_defaults",
76    defaults: ["fs_mgr_defaults"],
77    cppflags: [
78        "-Wno-unused-parameter",
79    ],
80    static_libs: [
81        "libcutils",
82        "libgmock",
83        "libfs_mgr",
84        "liblp",
85        "libcrypto_static",
86    ] + liblp_lib_deps,
87    header_libs: [
88        "libstorage_literals_headers",
89    ],
90    stl: "libc++_static",
91    srcs: [":liblp_test_srcs"],
92}
93
94cc_test {
95    name: "liblp_test",
96    defaults: ["liblp_test_defaults"],
97    test_config: "liblp_test.xml",
98    test_suites: ["device-tests"],
99}
100
101cc_test {
102    name: "vts_core_liblp_test",
103    defaults: ["liblp_test_defaults"],
104    test_suites: ["vts"],
105    auto_gen_config: true,
106    test_min_api_level: 29,
107    require_root: true,
108}
109
110cc_test {
111    name: "vts_kernel_liblp_test",
112    defaults: ["liblp_test_defaults"],
113}
114