1// Copyright (C) 2022 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//
16// Module-specific defaults.
17//
18// For module X, if we need to build it both as a library and an executable:
19//  - A default rule `releasetools_X_defaults` is created, which lists `srcs`, `libs` and
20//    `required` properties.
21//  - `python_library_host` and `python_binary_host` are created by listing
22//    `releasetools_X_defaults` in their defaults.
23//
24
25package {
26    // See: http://go/android-license-faq
27    // A large-scale-change added 'default_applicable_licenses' to import
28    // all of the 'license_kinds' from "system_update_engine_license"
29    // to get the below license kinds:
30    //   SPDX-license-identifier-Apache-2.0
31    default_applicable_licenses: ["system_update_engine_license"],
32}
33
34filegroup {
35    name: "update_device_script",
36    srcs: [
37        "**/*.py",
38    ],
39    path: ".",
40}
41
42python_library_host {
43    name: "update_payload",
44
45    srcs: [
46        "update_payload/__init__.py",
47        "update_payload/payload.py",
48        "update_payload/checker.py",
49        "update_payload/common.py",
50        "update_payload/error.py",
51        "update_payload/histogram.py",
52        "update_payload/format_utils.py",
53    ],
54    proto: {
55        canonical_path_from_root: false,
56    },
57    libs: [
58        "update_metadata-protos-python",
59    ],
60}
61
62python_binary_host {
63    name: "update_device",
64    srcs: [
65        "update_device.py",
66    ],
67    main: "update_device.py",
68    libs: [
69        "update_payload",
70    ],
71    version: {
72        py2: {
73            enabled: false,
74        },
75        py3: {
76            enabled: true,
77        },
78    },
79}
80