xref: /aosp_15_r20/tools/external_updater/Android.bp (revision 3c875a214f382db1236d28570d1304ce57138f32)
1*3c875a21SAndroid Build Coastguard Worker// Copyright (C) 2018 The Android Open Source Project
2*3c875a21SAndroid Build Coastguard Worker//
3*3c875a21SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*3c875a21SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*3c875a21SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*3c875a21SAndroid Build Coastguard Worker//
7*3c875a21SAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*3c875a21SAndroid Build Coastguard Worker//
9*3c875a21SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*3c875a21SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*3c875a21SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*3c875a21SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*3c875a21SAndroid Build Coastguard Worker// limitations under the License.
14*3c875a21SAndroid Build Coastguard Worker
15*3c875a21SAndroid Build Coastguard Workerpackage {
16*3c875a21SAndroid Build Coastguard Worker    default_team: "trendy_team_native_tools_libraries",
17*3c875a21SAndroid Build Coastguard Worker    default_applicable_licenses: ["Android-Apache-2.0"],
18*3c875a21SAndroid Build Coastguard Worker}
19*3c875a21SAndroid Build Coastguard Worker
20*3c875a21SAndroid Build Coastguard Workerpython_binary_host {
21*3c875a21SAndroid Build Coastguard Worker    name: "external_updater",
22*3c875a21SAndroid Build Coastguard Worker    main: "external_updater.py",
23*3c875a21SAndroid Build Coastguard Worker    srcs: ["external_updater.py"],
24*3c875a21SAndroid Build Coastguard Worker    libs: ["external_updater_lib"],
25*3c875a21SAndroid Build Coastguard Worker    required: ["cargo_embargo"],
26*3c875a21SAndroid Build Coastguard Worker    data: [":bpfmt"],
27*3c875a21SAndroid Build Coastguard Worker    version: {
28*3c875a21SAndroid Build Coastguard Worker        py3: {
29*3c875a21SAndroid Build Coastguard Worker            embedded_launcher: false,
30*3c875a21SAndroid Build Coastguard Worker        },
31*3c875a21SAndroid Build Coastguard Worker    },
32*3c875a21SAndroid Build Coastguard Worker}
33*3c875a21SAndroid Build Coastguard Worker
34*3c875a21SAndroid Build Coastguard Workerpython_binary_host {
35*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_notifier",
36*3c875a21SAndroid Build Coastguard Worker    main: "notifier.py",
37*3c875a21SAndroid Build Coastguard Worker    srcs: ["notifier.py"],
38*3c875a21SAndroid Build Coastguard Worker}
39*3c875a21SAndroid Build Coastguard Worker
40*3c875a21SAndroid Build Coastguard Workerpython_library_host {
41*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_lib",
42*3c875a21SAndroid Build Coastguard Worker    srcs: [
43*3c875a21SAndroid Build Coastguard Worker        "archive_utils.py",
44*3c875a21SAndroid Build Coastguard Worker        "base_updater.py",
45*3c875a21SAndroid Build Coastguard Worker        "color.py",
46*3c875a21SAndroid Build Coastguard Worker        "crates_updater.py",
47*3c875a21SAndroid Build Coastguard Worker        "fileutils.py",
48*3c875a21SAndroid Build Coastguard Worker        "git_updater.py",
49*3c875a21SAndroid Build Coastguard Worker        "git_utils.py",
50*3c875a21SAndroid Build Coastguard Worker        "github_archive_updater.py",
51*3c875a21SAndroid Build Coastguard Worker        "hashtags.py",
52*3c875a21SAndroid Build Coastguard Worker        "manifest.py",
53*3c875a21SAndroid Build Coastguard Worker        "metadata.proto",
54*3c875a21SAndroid Build Coastguard Worker        "reviewers.py",
55*3c875a21SAndroid Build Coastguard Worker        "updater_utils.py",
56*3c875a21SAndroid Build Coastguard Worker    ],
57*3c875a21SAndroid Build Coastguard Worker    libs: [
58*3c875a21SAndroid Build Coastguard Worker        "libprotobuf-python",
59*3c875a21SAndroid Build Coastguard Worker    ],
60*3c875a21SAndroid Build Coastguard Worker    proto: {
61*3c875a21SAndroid Build Coastguard Worker        canonical_path_from_root: false,
62*3c875a21SAndroid Build Coastguard Worker    },
63*3c875a21SAndroid Build Coastguard Worker    data: [
64*3c875a21SAndroid Build Coastguard Worker        "update_package.sh",
65*3c875a21SAndroid Build Coastguard Worker        "regen_bp.sh",
66*3c875a21SAndroid Build Coastguard Worker    ],
67*3c875a21SAndroid Build Coastguard Worker}
68*3c875a21SAndroid Build Coastguard Worker
69*3c875a21SAndroid Build Coastguard Workerpython_defaults {
70*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_test_defaults",
71*3c875a21SAndroid Build Coastguard Worker    version: {
72*3c875a21SAndroid Build Coastguard Worker        py3: {
73*3c875a21SAndroid Build Coastguard Worker            embedded_launcher: true,
74*3c875a21SAndroid Build Coastguard Worker        },
75*3c875a21SAndroid Build Coastguard Worker    },
76*3c875a21SAndroid Build Coastguard Worker}
77*3c875a21SAndroid Build Coastguard Worker
78*3c875a21SAndroid Build Coastguard Workerpython_library_host {
79*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_test_lib",
80*3c875a21SAndroid Build Coastguard Worker    srcs: [
81*3c875a21SAndroid Build Coastguard Worker        "tests/gitrepo.py",
82*3c875a21SAndroid Build Coastguard Worker    ],
83*3c875a21SAndroid Build Coastguard Worker    proto: {
84*3c875a21SAndroid Build Coastguard Worker        canonical_path_from_root: false,
85*3c875a21SAndroid Build Coastguard Worker    },
86*3c875a21SAndroid Build Coastguard Worker}
87*3c875a21SAndroid Build Coastguard Worker
88*3c875a21SAndroid Build Coastguard Workerpython_test_host {
89*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_fileutils_test",
90*3c875a21SAndroid Build Coastguard Worker    defaults: ["external_updater_test_defaults"],
91*3c875a21SAndroid Build Coastguard Worker    main: "test_fileutils.py",
92*3c875a21SAndroid Build Coastguard Worker    srcs: ["test_fileutils.py"],
93*3c875a21SAndroid Build Coastguard Worker    libs: ["external_updater_lib"],
94*3c875a21SAndroid Build Coastguard Worker    test_options: {
95*3c875a21SAndroid Build Coastguard Worker        unit_test: true,
96*3c875a21SAndroid Build Coastguard Worker    },
97*3c875a21SAndroid Build Coastguard Worker}
98*3c875a21SAndroid Build Coastguard Worker
99*3c875a21SAndroid Build Coastguard Workerpython_test_host {
100*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_github_archive_updater_test",
101*3c875a21SAndroid Build Coastguard Worker    defaults: ["external_updater_test_defaults"],
102*3c875a21SAndroid Build Coastguard Worker    main: "test_github_archive_updater.py",
103*3c875a21SAndroid Build Coastguard Worker    srcs: ["test_github_archive_updater.py"],
104*3c875a21SAndroid Build Coastguard Worker    libs: ["external_updater_lib"],
105*3c875a21SAndroid Build Coastguard Worker    test_options: {
106*3c875a21SAndroid Build Coastguard Worker        unit_test: true,
107*3c875a21SAndroid Build Coastguard Worker    },
108*3c875a21SAndroid Build Coastguard Worker}
109*3c875a21SAndroid Build Coastguard Worker
110*3c875a21SAndroid Build Coastguard Workerpython_test_host {
111*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_reviewers_test",
112*3c875a21SAndroid Build Coastguard Worker    defaults: ["external_updater_test_defaults"],
113*3c875a21SAndroid Build Coastguard Worker    main: "external_updater_reviewers_test.py",
114*3c875a21SAndroid Build Coastguard Worker    srcs: ["external_updater_reviewers_test.py"],
115*3c875a21SAndroid Build Coastguard Worker    libs: ["external_updater_lib"],
116*3c875a21SAndroid Build Coastguard Worker    test_options: {
117*3c875a21SAndroid Build Coastguard Worker        unit_test: true,
118*3c875a21SAndroid Build Coastguard Worker    },
119*3c875a21SAndroid Build Coastguard Worker}
120*3c875a21SAndroid Build Coastguard Worker
121*3c875a21SAndroid Build Coastguard Workerpython_test_host {
122*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_git_utils_test",
123*3c875a21SAndroid Build Coastguard Worker    defaults: ["external_updater_test_defaults"],
124*3c875a21SAndroid Build Coastguard Worker    main: "tests/test_git_utils.py",
125*3c875a21SAndroid Build Coastguard Worker    srcs: ["tests/test_git_utils.py"],
126*3c875a21SAndroid Build Coastguard Worker    libs: [
127*3c875a21SAndroid Build Coastguard Worker        "external_updater_lib",
128*3c875a21SAndroid Build Coastguard Worker        "external_updater_test_lib",
129*3c875a21SAndroid Build Coastguard Worker    ],
130*3c875a21SAndroid Build Coastguard Worker    test_options: {
131*3c875a21SAndroid Build Coastguard Worker        unit_test: true,
132*3c875a21SAndroid Build Coastguard Worker    },
133*3c875a21SAndroid Build Coastguard Worker}
134*3c875a21SAndroid Build Coastguard Worker
135*3c875a21SAndroid Build Coastguard Workerpython_test_host {
136*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_gitrepo_test",
137*3c875a21SAndroid Build Coastguard Worker    defaults: ["external_updater_test_defaults"],
138*3c875a21SAndroid Build Coastguard Worker    main: "tests/test_gitrepo.py",
139*3c875a21SAndroid Build Coastguard Worker    srcs: ["tests/test_gitrepo.py"],
140*3c875a21SAndroid Build Coastguard Worker    libs: [
141*3c875a21SAndroid Build Coastguard Worker        "external_updater_test_lib",
142*3c875a21SAndroid Build Coastguard Worker    ],
143*3c875a21SAndroid Build Coastguard Worker    test_options: {
144*3c875a21SAndroid Build Coastguard Worker        unit_test: true,
145*3c875a21SAndroid Build Coastguard Worker    },
146*3c875a21SAndroid Build Coastguard Worker}
147*3c875a21SAndroid Build Coastguard Worker
148*3c875a21SAndroid Build Coastguard Worker// This test is intentionally not in the tests/ directory. Everything in the
149*3c875a21SAndroid Build Coastguard Worker// tests/ directory should be runnable with pytest, and this file is not because
150*3c875a21SAndroid Build Coastguard Worker// it depends on the generated protobuf modules.
151*3c875a21SAndroid Build Coastguard Workerpython_test_host {
152*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_base_updater_test",
153*3c875a21SAndroid Build Coastguard Worker    defaults: ["external_updater_test_defaults"],
154*3c875a21SAndroid Build Coastguard Worker    main: "test_base_updater.py",
155*3c875a21SAndroid Build Coastguard Worker    srcs: ["test_base_updater.py"],
156*3c875a21SAndroid Build Coastguard Worker    libs: [
157*3c875a21SAndroid Build Coastguard Worker        "external_updater_lib",
158*3c875a21SAndroid Build Coastguard Worker        "external_updater_test_lib",
159*3c875a21SAndroid Build Coastguard Worker    ],
160*3c875a21SAndroid Build Coastguard Worker    test_options: {
161*3c875a21SAndroid Build Coastguard Worker        unit_test: true,
162*3c875a21SAndroid Build Coastguard Worker    },
163*3c875a21SAndroid Build Coastguard Worker}
164*3c875a21SAndroid Build Coastguard Worker
165*3c875a21SAndroid Build Coastguard Worker// Same as above. Needs protobuf.
166*3c875a21SAndroid Build Coastguard Workerpython_test_host {
167*3c875a21SAndroid Build Coastguard Worker    name: "external_updater_updater_utils_test",
168*3c875a21SAndroid Build Coastguard Worker    defaults: ["external_updater_test_defaults"],
169*3c875a21SAndroid Build Coastguard Worker    main: "test_updater_utils.py",
170*3c875a21SAndroid Build Coastguard Worker    srcs: ["test_updater_utils.py"],
171*3c875a21SAndroid Build Coastguard Worker    libs: [
172*3c875a21SAndroid Build Coastguard Worker        "external_updater_lib",
173*3c875a21SAndroid Build Coastguard Worker        "external_updater_test_lib",
174*3c875a21SAndroid Build Coastguard Worker    ],
175*3c875a21SAndroid Build Coastguard Worker    test_options: {
176*3c875a21SAndroid Build Coastguard Worker        unit_test: true,
177*3c875a21SAndroid Build Coastguard Worker    },
178*3c875a21SAndroid Build Coastguard Worker}
179*3c875a21SAndroid Build Coastguard Worker
180*3c875a21SAndroid Build Coastguard Worker// The tests in tests/endtoend are not built as a Soong module because we can't
181*3c875a21SAndroid Build Coastguard Worker// run those tests via python_test_host. It's an end-to-end test so it needs to
182*3c875a21SAndroid Build Coastguard Worker// run `repo`, but `repo init` will try to clone the real repo source (the thing
183*3c875a21SAndroid Build Coastguard Worker// in PATH is just a launcher), which our Python can't do (the SSL module's
184*3c875a21SAndroid Build Coastguard Worker// certificate validation is not configured for that). Run those tests with
185*3c875a21SAndroid Build Coastguard Worker// `pytest tests/endtoend`.
186