• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_team: "trendy_team_android_kernel",
19    default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22cc_defaults {
23    name: "libsnapshot_defaults",
24    defaults: ["fs_mgr_defaults"],
25    cflags: [
26        "-D_FILE_OFFSET_BITS=64",
27        "-Wall",
28        "-Werror",
29    ],
30    shared_libs: [
31        "libbase",
32        "libchrome",
33        "libcutils",
34        "liblog",
35    ],
36    static_libs: [
37        "libbrotli",
38        "libdm",
39        "libfstab",
40        "update_metadata-protos",
41    ],
42    whole_static_libs: [
43        "libbrotli",
44        "libcutils",
45        "libext2_uuid",
46        "libext4_utils",
47        "libfstab",
48        "libsnapuserd_client",
49        "libz",
50    ],
51    header_libs: [
52        "libfiemap_headers",
53        "libstorage_literals_headers",
54        "libupdate_engine_headers",
55    ],
56    export_static_lib_headers: [
57        "update_metadata-protos",
58    ],
59    export_header_lib_headers: [
60        "libfiemap_headers",
61    ],
62    export_include_dirs: ["include"],
63    proto: {
64        type: "lite",
65        export_proto_headers: true,
66        canonical_path_from_root: false,
67    },
68}
69
70cc_defaults {
71    name: "libsnapshot_hal_deps",
72    cflags: [
73        "-DLIBSNAPSHOT_USE_HAL",
74    ],
75    shared_libs: [
76        "android.hardware.boot@1.0",
77        "android.hardware.boot@1.1",
78        "android.hardware.boot-V1-ndk",
79        "libboot_control_client",
80    ],
81}
82
83filegroup {
84    name: "libsnapshot_sources",
85    srcs: [
86        "android/snapshot/snapshot.proto",
87        "device_info.cpp",
88        "snapshot.cpp",
89        "snapshot_stats.cpp",
90        "snapshot_stub.cpp",
91        "snapshot_metadata_updater.cpp",
92        "partition_cow_creator.cpp",
93        "return.cpp",
94        "utility.cpp",
95        "scratch_super.cpp",
96    ],
97}
98
99cc_library_headers {
100    name: "libsnapshot_headers",
101    recovery_available: true,
102    defaults: ["libsnapshot_defaults"],
103}
104
105cc_library_static {
106    name: "libsnapshot_static",
107    defaults: [
108        "libsnapshot_defaults",
109        "libsnapshot_hal_deps",
110    ],
111    srcs: [":libsnapshot_sources"],
112    static_libs: [
113        "libfs_mgr_binder",
114    ],
115    whole_static_libs: [
116        "libselinux",
117    ],
118}
119
120cc_library {
121    name: "libsnapshot",
122    defaults: [
123        "libsnapshot_defaults",
124        "libsnapshot_cow_defaults",
125        "libsnapshot_hal_deps",
126    ],
127    srcs: [":libsnapshot_sources"],
128    shared_libs: [
129        "libfs_mgr_binder",
130        "liblp",
131        "libprotobuf-cpp-lite",
132    ],
133    static_libs: [
134        "libsnapshot_cow",
135    ],
136    whole_static_libs: [
137        "libselinux",
138    ],
139}
140
141cc_library_static {
142    name: "libsnapshot_init",
143    native_coverage: true,
144    defaults: ["libsnapshot_defaults"],
145    srcs: [":libsnapshot_sources"],
146    ramdisk_available: true,
147    recovery_available: true,
148    cflags: [
149        "-DLIBSNAPSHOT_NO_COW_WRITE",
150    ],
151    static_libs: [
152        "libfs_mgr",
153        "libselinux",
154    ],
155}
156
157cc_library_static {
158    name: "libsnapshot_nobinder",
159    defaults: [
160        "libsnapshot_defaults",
161        "libsnapshot_hal_deps",
162    ],
163    srcs: [":libsnapshot_sources"],
164    recovery_available: true,
165    cflags: [
166        "-DLIBSNAPSHOT_NO_COW_WRITE",
167    ],
168    static_libs: [
169        "libfs_mgr",
170    ],
171    whole_static_libs: [
172        "libselinux",
173    ],
174}
175
176cc_defaults {
177    name: "libsnapshot_cow_defaults",
178    defaults: [
179        "fs_mgr_defaults",
180    ],
181    cflags: [
182        "-D_FILE_OFFSET_BITS=64",
183        "-Wall",
184        "-Werror",
185    ],
186    shared_libs: [
187        "libbase",
188        "liblog",
189    ],
190    static_libs: [
191        "libbrotli",
192        "libz",
193        "liblz4",
194        "libzstd",
195    ],
196    header_libs: [
197        "libupdate_engine_headers",
198    ],
199}
200
201cc_library_static {
202    name: "libsnapshot_cow",
203    defaults: [
204        "libsnapshot_cow_defaults",
205    ],
206    srcs: [
207        "libsnapshot_cow/cow_compress.cpp",
208        "libsnapshot_cow/cow_decompress.cpp",
209        "libsnapshot_cow/cow_format.cpp",
210        "libsnapshot_cow/cow_reader.cpp",
211        "libsnapshot_cow/parser_v2.cpp",
212        "libsnapshot_cow/parser_v3.cpp",
213        "libsnapshot_cow/snapshot_reader.cpp",
214        "libsnapshot_cow/writer_base.cpp",
215        "libsnapshot_cow/writer_v2.cpp",
216        "libsnapshot_cow/writer_v3.cpp",
217    ],
218
219    header_libs: [
220        "libstorage_literals_headers",
221    ],
222    export_include_dirs: ["include"],
223    host_supported: true,
224    recovery_available: true,
225    ramdisk_available: true,
226    vendor_ramdisk_available: true,
227}
228
229cc_library_static {
230    name: "libsnapshot_test_helpers",
231    defaults: ["libsnapshot_defaults"],
232    export_include_dirs: [
233        "include_test",
234    ],
235    srcs: [
236        "android/snapshot/snapshot.proto",
237        "test_helpers.cpp",
238    ],
239    shared_libs: [
240        "android.hardware.boot@1.1",
241        "libcrypto",
242    ],
243    export_shared_lib_headers: [
244        "android.hardware.boot@1.1",
245    ],
246    header_libs: [
247        "libstorage_literals_headers",
248    ],
249    export_header_lib_headers: [
250        "libstorage_literals_headers",
251    ],
252    static_libs: [
253        "libfs_mgr",
254        "libgmock",
255        "libgtest",
256        "libselinux",
257    ],
258}
259
260cc_defaults {
261    name: "libsnapshot_test_defaults",
262    defaults: [
263        "libsnapshot_defaults",
264        "libsnapshot_cow_defaults",
265    ],
266    srcs: [
267        "partition_cow_creator_test.cpp",
268        "snapshot_metadata_updater_test.cpp",
269        "snapshot_test.cpp",
270    ],
271    shared_libs: [
272        "libbinder",
273        "libcrypto",
274        "libhidlbase",
275        "libprotobuf-cpp-lite",
276        "libutils",
277        "libz",
278    ],
279    static_libs: [
280        "android.hardware.boot@1.0",
281        "android.hardware.boot@1.1",
282        "android.hardware.boot-V1-ndk",
283        "libbrotli",
284        "libfs_mgr_binder",
285        "libgflags",
286        "libgsi",
287        "libgmock",
288        "liblp",
289        "libsnapshot_static",
290        "libsnapshot_cow",
291        "libsnapshot_test_helpers",
292        "libsparse",
293    ],
294    header_libs: [
295        "libstorage_literals_headers",
296    ],
297    auto_gen_config: true,
298    require_root: true,
299}
300
301cc_test {
302    name: "vts_libsnapshot_test",
303    defaults: [
304        "libsnapshot_test_defaults",
305        "libsnapshot_hal_deps",
306    ],
307    test_suites: [
308        "vts",
309        "general-tests",
310    ],
311    compile_multilib: "first",
312    test_options: {
313        min_shipping_api_level: 30,
314        test_runner_options: [
315            {
316                name: "force-no-test-error",
317                value: "false",
318            },
319        ],
320    },
321}
322
323cc_test {
324    name: "vab_legacy_tests",
325    defaults: [
326        "libsnapshot_test_defaults",
327        "libsnapshot_hal_deps",
328    ],
329    cppflags: [
330        "-DLIBSNAPSHOT_TEST_VAB_LEGACY",
331    ],
332    test_suites: [
333        "general-tests",
334    ],
335    compile_multilib: "64",
336    test_options: {
337        // Legacy VAB launched in Android R.
338        min_shipping_api_level: 30,
339        test_runner_options: [
340            {
341                name: "force-no-test-error",
342                value: "false",
343            },
344        ],
345    },
346}
347
348cc_test {
349    name: "vts_ota_config_test",
350    srcs: [
351        "vts_ota_config_test.cpp",
352    ],
353    shared_libs: [
354        "libbase",
355    ],
356    test_suites: [
357        "vts",
358    ],
359    test_options: {
360        min_shipping_api_level: 33,
361    },
362    auto_gen_config: true,
363    require_root: true,
364}
365
366cc_binary {
367    name: "snapshotctl",
368    defaults: [
369        "libsnapshot_cow_defaults",
370        "libsnapshot_hal_deps",
371    ],
372    srcs: [
373        "snapshotctl.cpp",
374        "scratch_super.cpp",
375        "android/snapshot/snapshot.proto",
376    ],
377    static_libs: [
378        "libbrotli",
379        "libfstab",
380        "libz",
381        "libavb",
382        "libfs_avb",
383        "libcrypto_static",
384        "update_metadata-protos",
385    ],
386    shared_libs: [
387        "libbase",
388        "libext2_uuid",
389        "libext4_utils",
390        "libfs_mgr_binder",
391        "libhidlbase",
392        "liblog",
393        "liblp",
394        "libprotobuf-cpp-lite",
395        "libsnapshot",
396        "libstatslog",
397        "libutils",
398    ],
399    header_libs: [
400        "libstorage_literals_headers",
401    ],
402    product_variables: {
403        debuggable: {
404            cppflags: [
405                "-DSNAPSHOTCTL_USERDEBUG_OR_ENG",
406            ],
407            shared_libs: [
408                "android.hardware.boot@1.0",
409                "android.hardware.boot@1.1",
410                "android.hardware.boot-V1-ndk",
411                "libboot_control_client",
412            ],
413        },
414    },
415}
416
417cc_test {
418    name: "cow_api_test",
419    defaults: [
420        "fs_mgr_defaults",
421        "libsnapshot_cow_defaults",
422    ],
423    srcs: [
424        "libsnapshot_cow/snapshot_reader_test.cpp",
425        "libsnapshot_cow/test_v2.cpp",
426        "libsnapshot_cow/test_v3.cpp",
427    ],
428    cflags: [
429        "-D_FILE_OFFSET_BITS=64",
430        "-Wall",
431        "-Werror",
432    ],
433    shared_libs: [
434        "libbase",
435        "libcrypto",
436        "liblog",
437        "libz",
438    ],
439    static_libs: [
440        "libbrotli",
441        "libgtest",
442        "libsnapshot_cow",
443    ],
444    header_libs: [
445        "libstorage_literals_headers",
446    ],
447    test_suites: [
448        "general-tests",
449    ],
450    test_options: {
451        min_shipping_api_level: 30,
452    },
453    data: [
454        "tools/testdata/cow_v2",
455        "tools/testdata/incompressible_block",
456    ],
457    auto_gen_config: true,
458    require_root: false,
459    host_supported: true,
460}
461
462cc_binary {
463    name: "inspect_cow",
464    host_supported: true,
465    device_supported: true,
466    defaults: ["libsnapshot_cow_defaults"],
467    cflags: [
468        "-D_FILE_OFFSET_BITS=64",
469        "-Wall",
470        "-Werror",
471    ],
472    static_libs: [
473        "libbase",
474        "libbrotli",
475        "libcrypto_static",
476        "liblog",
477        "libgflags",
478        "libsnapshot_cow",
479        "libz",
480    ],
481    shared_libs: [
482    ],
483    srcs: [
484        "libsnapshot_cow/inspect_cow.cpp",
485    ],
486}
487
488cc_binary {
489    name: "create_snapshot",
490    host_supported: true,
491    device_supported: false,
492
493    srcs: [
494        "libsnapshot_cow/create_cow.cpp",
495        "android/snapshot/snapshot.proto",
496    ],
497
498    cflags: [
499        "-Wall",
500        "-Werror",
501    ],
502
503    static_libs: [
504        "liblog",
505        "libbase",
506        "libfstab",
507        "libext4_utils",
508        "libsnapshot_cow",
509        "libcrypto",
510        "libbrotli",
511        "libz",
512        "libdm",
513        "liblz4",
514        "libzstd",
515        "libgflags",
516        "libavb",
517        "libext2_uuid",
518        "libfs_avb",
519        "libcrypto",
520        "libprotobuf-cpp-lite",
521    ],
522    shared_libs: [
523    ],
524
525    header_libs: [
526        "libstorage_literals_headers",
527    ],
528
529    dist: {
530        targets: [
531            "sdk",
532            "sdk-repo-platform-tools",
533            "sdk_repo",
534        ],
535    },
536    target: {
537        darwin: {
538            enabled: false,
539        },
540        windows: {
541            enabled: false,
542        },
543    },
544    stl: "libc++_static",
545    static_executable: true,
546}
547
548python_library_host {
549    name: "snapshot_proto_python",
550    srcs: [
551        "android/snapshot/snapshot.proto",
552    ],
553    proto: {
554        canonical_path_from_root: false,
555    },
556}
557