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    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21cc_binary {
22    name: "gsi_tool",
23    shared_libs: [
24        "gsi_aidl_interface-cpp",
25        "libbase",
26        "libbinder",
27        "libcutils",
28        "libgsi",
29        "liblog",
30        "libutils",
31    ],
32    static_libs: [
33        "libgsid",
34    ],
35    srcs: [
36        "gsi_tool.cpp",
37    ],
38}
39
40cc_library {
41    name: "libgsi",
42    ramdisk_available: true,
43    vendor_ramdisk_available: true,
44    recovery_available: true,
45    host_supported: true,
46    srcs: [
47        "libgsi.cpp",
48    ],
49    shared_libs: [
50        "libbase",
51    ],
52    export_include_dirs: ["include"],
53}
54
55cc_library_static {
56    name: "libgsid",
57    srcs: [
58        "libgsid.cpp",
59    ],
60    shared_libs: [
61        "gsi_aidl_interface-cpp",
62        "libbase",
63        "libbinder",
64        "libutils",
65    ],
66    export_include_dirs: ["include"],
67}
68
69cc_library_headers {
70    name: "libgsi_headers",
71    host_supported: true,
72    ramdisk_available: true,
73    vendor_ramdisk_available: true,
74    recovery_available: true,
75    vendor_available: true,
76    export_include_dirs: ["include"],
77    apex_available: [
78        "//apex_available:anyapex",
79        "//apex_available:platform",
80    ],
81    min_sdk_version: "31",
82}
83
84cc_defaults {
85    name: "gsid_defaults",
86    srcs: [
87        "gsi_service.cpp",
88        "partition_installer.cpp",
89    ],
90    shared_libs: [
91        "libbase",
92        "libbinder",
93        "libcrypto",
94        "liblog",
95    ],
96    static_libs: [
97        "gsi_aidl_interface-cpp",
98        "libavb",
99        "libcutils",
100        "libdm",
101        "libext4_utils",
102        "libfs_mgr",
103        "libgsi",
104        "libgsid",
105        "liblp",
106        "libselinux",
107        "libutils",
108        "libvold_binder",
109    ],
110    header_libs: [
111        "libstorage_literals_headers",
112    ],
113    target: {
114        android: {
115            shared_libs: [
116                "libprocessgroup",
117                "libvndksupport",
118            ],
119        },
120    },
121    local_include_dirs: ["include"],
122}
123
124cc_binary {
125    name: "gsid",
126    defaults: [
127        "gsid_defaults",
128    ],
129    srcs: [
130        "daemon.cpp",
131    ],
132    required: [
133        "mke2fs",
134    ],
135    init_rc: [
136        "gsid.rc",
137    ],
138}
139
140aidl_interface {
141    name: "gsi_aidl_interface",
142    unstable: true,
143    srcs: [":gsiservice_aidl"],
144    local_include_dir: "aidl",
145    backend: {
146        ndk: {
147            enabled: false,
148        },
149    },
150}
151
152filegroup {
153    name: "gsiservice_aidl",
154    srcs: [
155        "aidl/android/gsi/AvbPublicKey.aidl",
156        "aidl/android/gsi/GsiProgress.aidl",
157        "aidl/android/gsi/IGsiService.aidl",
158        "aidl/android/gsi/IGsiServiceCallback.aidl",
159        "aidl/android/gsi/IImageService.aidl",
160        "aidl/android/gsi/IProgressCallback.aidl",
161        "aidl/android/gsi/MappedImage.aidl",
162    ],
163    path: "aidl",
164}
165
166cc_fuzz {
167    name: "gsi_service_fuzzer",
168    defaults: [
169        "gsid_defaults",
170        "service_fuzzer_defaults",
171        "fuzzer_disable_leaks",
172    ],
173    srcs: [
174        "fuzzers/GsiServiceFuzzer.cpp",
175    ],
176    fuzz_config: {
177        triage_assignee: "waghpawan@google.com",
178        cc: [
179            "elsk@google.com",
180            "yochiang@google.com",
181        ]
182    },
183}
184