1// Copyright (C) 2018 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_applicable_licenses: ["Android-Apache-2.0"], 17} 18 19apexer_tools = [ 20 "apexer", 21 "aapt2", 22 "avbtool", 23 "e2fsdroid", 24 "mke2fs", 25 "resize2fs", 26 "sefcontext_compile", 27 "zipalign", 28 "make_f2fs", 29 "sload_f2fs", 30 // TODO(b/124476339) apex doesn't follow 'required' dependencies so we need to include this 31 // manually for 'avbtool'. 32 "fec", 33] 34 35// TODO(b/157110982): cannot specify "required" dependency on go binary 36apexer_go_tools = [ 37 "merge_zips", 38 "soong_zip", 39] 40 41python_library_host { 42 name: "apex_manifest", 43 srcs: [ 44 "apex_manifest.py", 45 ], 46 version: { 47 py2: { 48 enabled: true, 49 }, 50 py3: { 51 enabled: true, 52 }, 53 }, 54 libs: [ 55 "apex_manifest_proto", 56 ], 57} 58 59python_binary_host { 60 name: "apexer", 61 srcs: [ 62 "apexer.py", 63 ], 64 // TODO(b/157625953) mke2fs.conf can't embedded directly. 65 data: [ 66 ":mke2fs_conf", 67 ], 68 version: { 69 py2: { 70 enabled: true, 71 embedded_launcher: true, 72 }, 73 py3: { 74 enabled: false, 75 }, 76 }, 77 libs: [ 78 "apex_manifest", 79 "apex_build_info_proto", 80 "manifest_utils", 81 ], 82 required: apexer_tools, 83} 84 85python_binary_host { 86 name: "conv_apex_manifest", 87 srcs: [ 88 "conv_apex_manifest.py", 89 ], 90 version: { 91 py2: { 92 enabled: true, 93 embedded_launcher: true, 94 }, 95 py3: { 96 enabled: false, 97 }, 98 }, 99 libs: [ 100 "apex_manifest_proto", 101 ], 102} 103 104apex_key { 105 name: "com.android.support.apexer.key", 106 public_key: "etc/com.android.support.apexer.avbpubkey", 107 private_key: "etc/com.android.support.apexer.pem", 108} 109 110// This is a host-apex that contains all the binaries needed to create new apex's seprate from 111// soong. 112apex_test { 113 name: "com.android.support.apexer", 114 payload_type: "zip", 115 host_supported: true, 116 device_supported: false, 117 manifest: "etc/manifest.json", 118 ignore_system_library_special_case: true, 119 key: "com.android.support.apexer.key", 120 binaries: apexer_tools + apexer_go_tools, 121 updatable: false, 122} 123 124// TODO(b/148659029): this test can't run in TEST_MAPPING. 125python_test_host { 126 name: "apexer_test", 127 main: "apexer_test.py", 128 srcs: [ 129 "apexer_test.py", 130 ], 131 data: [ 132 ":com.android.example.apex", 133 ":com.android.example-legacy.apex", 134 ":com.android.example-logging_parent.apex", 135 ":com.android.example-overridden_package_name.apex", 136 ":apexer_test_host_tools", 137 "testdata/com.android.example.apex.avbpubkey", 138 "testdata/com.android.example.apex.pem", 139 "testdata/com.android.example.apex.pk8", 140 "testdata/com.android.example.apex.x509.pem", 141 ], 142 version: { 143 py2: { 144 enabled: false, 145 }, 146 py3: { 147 enabled: true, 148 }, 149 }, 150 test_suites: ["general-tests"], 151 libs: [ 152 "apex_manifest", 153 ], 154} 155 156apexer_deps_minus_go_tools = apexer_tools + [ 157 "deapexer", 158 "debugfs_static", 159] 160 161apexer_deps_tools = apexer_deps_minus_go_tools + apexer_go_tools 162 163genrule_defaults { 164 name: "apexer_test_host_tools_list", 165 tools: apexer_deps_tools + [ 166 "signapk", 167 ], 168} 169 170genrule { 171 name: "apexer_test_host_tools", 172 srcs: [ 173 ":current_android_jar", 174 ], 175 out: ["apexer_test_host_tools.zip"], 176 tools: apexer_deps_tools + [ 177 // To force signapk.jar generated in out/soong/host 178 "signapk", 179 ], 180 cmd: "HOST_OUT_BIN=$$(dirname $(location apexer)) && " + 181 "HOST_SOONG_OUT=$$(dirname $$HOST_OUT_BIN) && " + 182 "SIGNAPK_JAR=$$(find $${HOST_SOONG_OUT}/framework -name \"signapk*\") && " + 183 "LIBCPLUSPLUS=$$(find $${HOST_SOONG_OUT}/lib64 -name \"libc++.*\") && " + 184 "LIBCONSCRYPT_OPENJDK_JNI=$$(find $${HOST_SOONG_OUT}/lib64 -name \"libconscrypt_openjdk_jni.*\") && " + 185 "BASE=$(genDir)/binary_files && " + 186 "BIN=$$BASE/bin && " + 187 "LIB=$$BASE/lib64 && " + 188 "mkdir -p $$BIN && " + 189 "mkdir -p $$LIB && " + 190 "cp $(in) $$BIN && " + 191 "cp $(location apexer) $$BIN && " + 192 "cp $(location deapexer) $$BIN && " + 193 "cp $(location avbtool) $$BIN && " + 194 "cp $(location aapt2) $$BIN && " + 195 "cp $(location e2fsdroid) $$BIN && " + 196 "cp $(location merge_zips) $$BIN && " + 197 "cp $(location mke2fs) $$BIN && " + 198 "cp $(location resize2fs) $$BIN && " + 199 "cp $(location sefcontext_compile) $$BIN && " + 200 "cp $(location soong_zip) $$BIN && " + 201 "cp $(location fec) $$BIN && " + 202 "cp $(location zipalign) $$BIN && " + 203 "cp $(location debugfs_static) $$BIN && " + 204 "cp $$SIGNAPK_JAR $$BIN && " + 205 "cp $$LIBCPLUSPLUS $$LIB && " + 206 "cp $$LIBCONSCRYPT_OPENJDK_JNI $$LIB && " + 207 "$(location soong_zip) -C $$BASE -D $$BASE -o $(out) && " + 208 "rm -rf $$BASE", 209} 210