// Copyright (C) 2020 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // A rule to collect apps for debugging purpose. See ApkVerityTestAppPrebuilt/README.md. package { default_team: "trendy_team_framework_android_packages", default_applicable_licenses: ["Android-Apache-2.0"], } genrule { name: "CtsApkVerityTestDebugFiles", srcs: [ ":CtsApkVerityTestApp", ":CtsApkVerityTestAppApkIdSig", ":CtsApkVerityTestAppFsvSig", ":CtsApkVerityTestAppDm", ":CtsApkVerityTestAppDmFsvSig", ":CtsApkVerityTestAppSplit", ":CtsApkVerityTestAppSplitFsvSig", ":CtsApkVerityTestAppSplitDm", ":CtsApkVerityTestAppSplitDmFsvSig", ], cmd: "echo $(in) > $(out)", out: ["CtsApkVerityTestDebugFiles.txt"], } // This is a rather complicated way to keep only APKs. // exclude_srcs does not work because it uses paths local to Android.bp. genrule { name: "CtsApkVerityTestAppApk", srcs: [":CtsApkVerityTestApp"], cmd: "for file in $(in); do " + " if [[ $$file == *.apk ]]; then " + " cp $$file $(out); " + " fi " + " done", out: ["CtsApkVerityTestApp.apk"], } filegroup { name: "CtsApkVerityTestAppDm", srcs: ["CtsApkVerityTestApp.dm"], } filegroup { name: "CtsApkVerityTestAppSplitDm", srcs: ["CtsApkVerityTestAppSplit.dm"], } filegroup { name: "fsverity-debug-key", srcs: ["fsverity-debug-key.pem"], } filegroup { name: "fsverity-debug-cert", srcs: ["fsverity-debug.x509.pem"], } genrule_defaults { name: "cts_apk_verity_sig_gen_default", tools: ["fsverity"], tool_files: [ ":fsverity-debug-key", ":fsverity-debug-cert", ], cmd: "$(location fsverity) sign $(in) $(out) " + "--key=$(location :fsverity-debug-key) " + "--cert=$(location :fsverity-debug-cert) " + "> /dev/null", } genrule { name: "CtsApkVerityTestAppFsvSig", defaults: ["cts_apk_verity_sig_gen_default"], srcs: [":CtsApkVerityTestAppApk"], out: ["CtsApkVerityTestApp.apk.fsv_sig"], } genrule { name: "CtsApkVerityTestAppDmFsvSig", defaults: ["cts_apk_verity_sig_gen_default"], srcs: [":CtsApkVerityTestAppDm"], out: ["CtsApkVerityTestApp.dm.fsv_sig"], } genrule { name: "CtsApkVerityTestAppSplitFsvSig", defaults: ["cts_apk_verity_sig_gen_default"], srcs: [":CtsApkVerityTestAppSplit"], out: ["CtsApkVerityTestAppSplit.apk.fsv_sig"], } genrule { name: "CtsApkVerityTestAppSplitDmFsvSig", defaults: ["cts_apk_verity_sig_gen_default"], srcs: [":CtsApkVerityTestAppSplitDm"], out: ["CtsApkVerityTestAppSplit.dm.fsv_sig"], }