1// Copyright (C) 2020 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 15// A rule to collect apps for debugging purpose. See ApkVerityTestAppPrebuilt/README.md. 16package { 17 default_applicable_licenses: ["Android-Apache-2.0"], 18} 19 20genrule { 21 name: "CtsApkVerityTestDebugFiles", 22 srcs: [ 23 ":CtsApkVerityTestApp", 24 ":CtsApkVerityTestAppApkIdSig", 25 ":CtsApkVerityTestAppFsvSig", 26 ":CtsApkVerityTestAppDm", 27 ":CtsApkVerityTestAppDmFsvSig", 28 ":CtsApkVerityTestAppSplit", 29 ":CtsApkVerityTestAppSplitFsvSig", 30 ":CtsApkVerityTestAppSplitDm", 31 ":CtsApkVerityTestAppSplitDmFsvSig", 32 ], 33 cmd: "echo $(in) > $(out)", 34 out: ["CtsApkVerityTestDebugFiles.txt"], 35} 36 37// This is a rather complicated way to keep only APKs. 38// exclude_srcs does not work because it uses paths local to Android.bp. 39genrule { 40 name: "CtsApkVerityTestAppApk", 41 srcs: [":CtsApkVerityTestApp"], 42 cmd: "for file in $(in); do " + 43 " if [[ $$file == *.apk ]]; then " + 44 " cp $$file $(out); " + 45 " fi " + 46 " done", 47 out: ["CtsApkVerityTestApp.apk"], 48} 49 50filegroup { 51 name: "CtsApkVerityTestAppDm", 52 srcs: ["CtsApkVerityTestApp.dm"], 53} 54 55filegroup { 56 name: "CtsApkVerityTestAppSplitDm", 57 srcs: ["CtsApkVerityTestAppSplit.dm"], 58} 59 60filegroup { 61 name: "fsverity-debug-key", 62 srcs: ["fsverity-debug-key.pem"], 63} 64 65filegroup { 66 name: "fsverity-debug-cert", 67 srcs: ["fsverity-debug.x509.pem"], 68} 69 70genrule_defaults { 71 name: "cts_apk_verity_sig_gen_default", 72 tools: ["fsverity"], 73 tool_files: [ 74 ":fsverity-debug-key", 75 ":fsverity-debug-cert", 76 ], 77 cmd: "$(location fsverity) sign $(in) $(out) " + 78 "--key=$(location :fsverity-debug-key) " + 79 "--cert=$(location :fsverity-debug-cert) " + 80 "> /dev/null", 81} 82 83genrule { 84 name: "CtsApkVerityTestAppFsvSig", 85 defaults: ["cts_apk_verity_sig_gen_default"], 86 srcs: [":CtsApkVerityTestAppApk"], 87 out: ["CtsApkVerityTestApp.apk.fsv_sig"], 88} 89 90genrule { 91 name: "CtsApkVerityTestAppDmFsvSig", 92 defaults: ["cts_apk_verity_sig_gen_default"], 93 srcs: [":CtsApkVerityTestAppDm"], 94 out: ["CtsApkVerityTestApp.dm.fsv_sig"], 95} 96 97genrule { 98 name: "CtsApkVerityTestAppSplitFsvSig", 99 defaults: ["cts_apk_verity_sig_gen_default"], 100 srcs: [":CtsApkVerityTestAppSplit"], 101 out: ["CtsApkVerityTestAppSplit.apk.fsv_sig"], 102} 103 104genrule { 105 name: "CtsApkVerityTestAppSplitDmFsvSig", 106 defaults: ["cts_apk_verity_sig_gen_default"], 107 srcs: [":CtsApkVerityTestAppSplitDm"], 108 out: ["CtsApkVerityTestAppSplit.dm.fsv_sig"], 109} 110