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    ramdisk_available: true,
34    vendor_ramdisk_available: true,
35    recovery_available: true,
36    defaults: ["fs_mgr_defaults"],
37    cppflags: [
38        "-D_FILE_OFFSET_BITS=64",
39    ],
40    srcs: [
41        "builder.cpp",
42        "super_layout_builder.cpp",
43        "images.cpp",
44        "partition_opener.cpp",
45        "property_fetcher.cpp",
46        "reader.cpp",
47        "utility.cpp",
48        "writer.cpp",
49    ],
50    shared_libs: [
51        "libcrypto",
52    ] + liblp_lib_deps,
53    target: {
54        windows: {
55            enabled: true,
56        },
57        android: {
58            shared_libs: [
59                "libcutils",
60            ],
61        },
62    },
63    export_include_dirs: ["include"],
64}
65
66cc_defaults {
67    name: "liblp_test_defaults",
68    defaults: ["fs_mgr_defaults"],
69    cppflags: [
70        "-Wno-unused-parameter",
71    ],
72    static_libs: [
73        "libcutils",
74        "libgmock",
75        "liblp",
76        "libcrypto_static",
77    ] + liblp_lib_deps,
78    header_libs: [
79        "libstorage_literals_headers",
80    ],
81    target: {
82        android: {
83            srcs: [
84                "device_test.cpp",
85                "io_test.cpp",
86            ],
87            static_libs: [
88                "libfs_mgr",
89            ],
90        }
91    },
92    stl: "libc++_static",
93    srcs: [
94        "builder_test.cpp",
95        "super_layout_builder_test.cpp",
96        "test_partition_opener.cpp",
97        "utility_test.cpp",
98    ],
99}
100
101cc_test {
102    name: "liblp_test",
103    defaults: ["liblp_test_defaults"],
104    test_suites: ["device-tests"],
105    auto_gen_config: true,
106    require_root: true,
107    host_supported: true
108}
109
110cc_test {
111    name: "vts_core_liblp_test",
112    defaults: ["liblp_test_defaults"],
113    test_suites: ["vts"],
114    auto_gen_config: true,
115    test_options: {
116        min_shipping_api_level: 29,
117    },
118    require_root: true,
119}
120
121cc_test {
122    name: "vts_kernel_liblp_test",
123    defaults: ["liblp_test_defaults"],
124}
125