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