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