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 15python_defaults { 16 name: "atest_lib_default", 17 pkg_path: "atest", 18 version: { 19 py2: { 20 enabled: false, 21 embedded_launcher: false, 22 }, 23 py3: { 24 enabled: true, 25 embedded_launcher: false, 26 }, 27 }, 28} 29 30// Remove this defaults after python3 migration is finished. 31python_defaults { 32 name: "atest_py2_default", 33 pkg_path: "atest", 34 version: { 35 py2: { 36 enabled: true, 37 embedded_launcher: false, 38 }, 39 py3: { 40 enabled: false, 41 embedded_launcher: false, 42 }, 43 }, 44} 45 46python_binary_host { 47 name: "atest-py2", 48 main: "atest.py", 49 srcs: [ 50 "**/*.py", 51 ], 52 exclude_srcs: [ 53 "*_unittest.py", 54 "*/*_unittest.py", 55 "asuite_lib_test/*.py", 56 "proto/*_pb2.py", 57 "proto/__init__.py", 58 ], 59 libs: [ 60 "atest_proto", 61 ], 62 data: [ 63 "tools/updatedb_darwin.sh", 64 ":asuite_version", 65 ], 66 // Make atest's built name to atest-py2-dev 67 stem: "atest-py2-dev", 68 defaults: ["atest_py2_default"], 69 dist: { 70 targets: ["droidcore"], 71 }, 72} 73 74python_library_host { 75 name: "atest_module_info", 76 defaults: ["atest_lib_default"], 77 srcs: [ 78 "atest_error.py", 79 "atest_decorator.py", 80 "atest_utils.py", 81 "constants.py", 82 "constants_default.py", 83 "module_info.py", 84 ], 85} 86 87// Move asuite_default and asuite_metrics to //tools/asuite when atest is 88// running as a prebuilt. 89python_defaults { 90 name: "asuite_default", 91 pkg_path: "asuite", 92 version: { 93 py2: { 94 enabled: true, 95 embedded_launcher: false, 96 }, 97 py3: { 98 enabled: true, 99 embedded_launcher: false, 100 }, 101 }, 102} 103 104python_library_host { 105 name: "asuite_metrics", 106 defaults: ["asuite_default"], 107 srcs: [ 108 "asuite_metrics.py", 109 ], 110} 111 112// Exclude atest_updatedb_unittest due to it's a test for ATest's wrapper of updatedb, but there's 113// no updatedb binary on test server. 114python_test_host { 115 name: "atest-py2_unittests", 116 main: "atest_run_unittests.py", 117 pkg_path: "atest", 118 srcs: [ 119 "**/*.py", 120 ], 121 data: [ 122 "tools/updatedb_darwin.sh", 123 "unittest_data/**/*", 124 "unittest_data/**/.*", 125 ], 126 exclude_srcs: [ 127 "asuite_lib_test/*.py", 128 "proto/*_pb2.py", 129 "proto/__init__.py", 130 "tools/atest_updatedb_unittest.py", 131 ], 132 libs: [ 133 "py-mock", 134 "atest_proto", 135 ], 136 test_config: "atest_unittests.xml", 137 test_suites: ["general-tests"], 138 defaults: ["atest_py2_default"], 139} 140 141python_library_host { 142 name: "atest_proto", 143 defaults: ["atest_py2_default"], 144 srcs: [ 145 "proto/*.proto", 146 ], 147 proto: { 148 canonical_path_from_root: false, 149 }, 150} 151 152java_library_host { 153 name: "asuite_proto_java", 154 srcs: [ 155 "proto/*.proto", 156 ], 157 proto: { 158 type: "full", 159 canonical_path_from_root: false, 160 include_dirs: ["external/protobuf/src"], 161 }, 162} 163 164python_library_host { 165 name: "asuite_proto", 166 defaults: ["asuite_default"], 167 srcs: [ 168 "proto/*.proto", 169 ], 170 proto: { 171 canonical_path_from_root: false, 172 }, 173} 174 175python_library_host { 176 name: "asuite_cc_client", 177 defaults: ["asuite_default"], 178 srcs: [ 179 "atest_error.py", 180 "atest_decorator.py", 181 "atest_utils.py", 182 "constants.py", 183 "constants_default.py", 184 "metrics/*.py", 185 ], 186 libs: [ 187 "asuite_proto", 188 "asuite_metrics", 189 ], 190} 191 192genrule { 193 name: "asuite_version", 194 cmd: "DATETIME=$$(TZ='America/Log_Angelos' date +'%F');" + 195 "if [[ -n $$BUILD_NUMBER ]]; then" + 196 " echo $${DATETIME}_$${BUILD_NUMBER} > $(out);" + 197 "else" + 198 " echo $$(date +'%F_%R') > $(out);" + 199 "fi", 200 out: [ 201 "VERSION", 202 ], 203} 204