xref: /aosp_15_r20/cts/tests/signature/api-check/system-api/Android.bp (revision b7c941bb3fa97aba169d73cee0bed2de8ac964bf)
1// Copyright (C) 2017 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    // See: http://go/android-license-faq
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21android_test {
22    name: "CtsSystemApiSignatureTestCases",
23    defaults: ["signature-api-check-defaults"],
24    java_resources: [
25        ":CtsSystemApiSignatureTestCases_system-all.api",
26        ":cts-current-api-gz",
27        ":cts-system-current-api-gz",
28        ":cts-system-removed-api-gz",
29    ],
30    test_suites: [
31        "cts",
32        "general-tests",
33    ],
34    sdk_version: "current",
35    dex_preopt: {
36        enabled: false,
37    },
38    optimize: {
39        enabled: false,
40    },
41    use_embedded_native_libs: false,
42}
43
44genrule {
45    name: "CtsSystemApiSignatureTestCases_system-all.api",
46    srcs: [
47        ":prebuilt_sdk_system_api_android_txt",
48    ],
49    tools: [
50        "soong_zip",
51        "metalava",
52    ],
53    out: [
54        "system-all.api.zip",
55    ],
56    cmd: "for f in $(in); do " +
57        "  platformSdkVersion=$$(echo $${f} | awk -F/ '{print $$(3)}') && " +
58        "  if [ $${platformSdkVersion} -lt 28 ]; then continue; fi && " +
59        "  apiLevel=$$(echo $${f} | awk -F/ '{print $$(4)}') && " +
60        "  $(location metalava) -J--add-opens=java.base/java.util=ALL-UNNAMED " +
61        "  signature-to-jdiff $${f} $(genDir)/list/$${platformSdkVersion}-$${apiLevel}.api; " +
62        "done &&" +
63        "$(location soong_zip) -o $(out) -C $(genDir)/list -D $(genDir)/list",
64}
65