1// Copyright (C) 2019 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
15package {
16    default_team: "trendy_team_updatable_sdk_apis",
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20cc_defaults {
21    name: "derive_sdk-defaults",
22    min_sdk_version: "30",
23    shared_libs: ["liblog"],
24    // static c++/libbase for smaller size
25    stl: "c++_static",
26    static_libs: [
27        "libbase",
28        "libmodules-utils-build",
29        "libprotobuf-cpp-lite",
30        "libsdk_proto",
31    ],
32}
33
34cc_library {
35    name: "libderive_sdk",
36    srcs: ["derive_sdk.cpp"],
37    defaults: ["derive_sdk-defaults"],
38    apex_available: ["com.android.sdkext"],
39}
40
41cc_defaults {
42    name: "derive_sdk_binary-defaults",
43    defaults: ["derive_sdk-defaults"],
44    srcs: ["main.cpp"],
45    static_libs: ["libderive_sdk"],
46}
47
48cc_library {
49    name: "libderive_sdk_jni",
50    srcs: ["derive_sdk_jni.cpp"],
51    header_libs: ["libnativehelper_header_only"],
52    shared_libs: [
53        "liblog",
54        "libderive_sdk",
55    ],
56    static_libs: ["libbase"],
57    min_sdk_version: "30",
58    stl: "c++_static",
59}
60
61cc_binary {
62    name: "derive_sdk",
63    defaults: ["derive_sdk_binary-defaults"],
64    apex_available: ["com.android.sdkext"],
65}
66
67// Work around testing using a 64-bit test suite on 32-bit test device by
68// using a prefer32 version of derive_sdk in testing.
69cc_binary {
70    name: "derive_sdk_prefer32",
71    defaults: ["derive_sdk_binary-defaults"],
72    compile_multilib: "prefer32",
73    stem: "derive_sdk",
74    apex_available: ["test_com.android.sdkext"],
75    installable: false,
76}
77
78cc_test {
79    name: "derive_sdk_test",
80    defaults: ["derive_sdk-defaults"],
81    srcs: ["derive_sdk_test.cpp"],
82    require_root: true,
83    static_libs: ["libderive_sdk"],
84    test_suites: ["general-tests"],
85    test_mainline_modules: ["com.google.android.sdkext.apex"],
86}
87
88prebuilt_etc {
89    name: "derive_sdk.rc",
90    src: "derive_sdk.rc",
91    installable: false,
92}
93