1/*
2 * Copyright (C) 2021 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_updatable_sdk_apis",
19    default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22python_binary_host {
23    name: "gen_sdk",
24    srcs: ["gen_sdk.py"],
25    libs: ["sdk_proto_python"],
26    version: {
27        py3: {
28            embedded_launcher: true,
29        },
30    },
31}
32
33sh_test_host {
34    name: "gen_sdk_test",
35    src: "gen_sdk_test.sh",
36    data: [
37        "extensions_db.textpb",
38        "testdata/**/*",
39    ],
40    data_bins: [
41        "gen_sdk",
42        "toybox",
43    ],
44    // libcrypto and libz are required by toybox.
45    data_libs: [
46        "libcrypto",
47        "libz",
48    ],
49    test_suites: ["general-tests"],
50}
51
52genrule {
53    name: "extensions_db.pb",
54    srcs: ["extensions_db.textpb"],
55    out: ["extensions_db.pb"],
56    tools: ["gen_sdk"],
57    cmd: "$(location gen_sdk) --action print_binary --database $(location extensions_db.textpb) > $(out)",
58}
59
60prebuilt_etc {
61    name: "extensions_db",
62    src: ":extensions_db.pb",
63    filename: "extensions_db.pb",
64    installable: false,
65}
66