Jim Tang | ec94b16 | 2018-05-04 07:17:23 +0000 | [diff] [blame] | 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 | |
yangbill | 78ef63e | 2018-08-31 00:11:25 +0800 | [diff] [blame] | 15 | python_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 | |
yangbill | 7a48120 | 2018-10-23 16:20:02 +0800 | [diff] [blame] | 30 | // Remove this defaults after python3 migration is finished. |
| 31 | python_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 | |
Jim Tang | ec94b16 | 2018-05-04 07:17:23 +0000 | [diff] [blame] | 46 | python_binary_host { |
Jim Tang | 82066bb | 2020-04-16 10:34:55 +0800 | [diff] [blame^] | 47 | name: "atest-py2", |
Jim Tang | ec94b16 | 2018-05-04 07:17:23 +0000 | [diff] [blame] | 48 | main: "atest.py", |
| 49 | srcs: [ |
| 50 | "**/*.py", |
| 51 | ], |
| 52 | exclude_srcs: [ |
| 53 | "*_unittest.py", |
| 54 | "*/*_unittest.py", |
yangbill | 763f5ff | 2019-05-07 14:13:42 +0800 | [diff] [blame] | 55 | "asuite_lib_test/*.py", |
yangbill | 58db271 | 2019-02-14 13:59:42 +0800 | [diff] [blame] | 56 | "proto/*_pb2.py", |
kellyhung | 710ce96 | 2018-11-16 14:30:39 +0800 | [diff] [blame] | 57 | "proto/__init__.py", |
Jim Tang | ec94b16 | 2018-05-04 07:17:23 +0000 | [diff] [blame] | 58 | ], |
Jim Tang | ae8eb44 | 2018-10-29 16:42:33 +0800 | [diff] [blame] | 59 | libs: [ |
yangbill | 58db271 | 2019-02-14 13:59:42 +0800 | [diff] [blame] | 60 | "atest_proto", |
Jim Tang | ae8eb44 | 2018-10-29 16:42:33 +0800 | [diff] [blame] | 61 | ], |
Jim Tang | cb71105 | 2019-05-08 16:38:25 +0800 | [diff] [blame] | 62 | data: [ |
| 63 | "tools/updatedb_darwin.sh", |
Jim Tang | 139389a | 2019-09-27 14:48:30 +0800 | [diff] [blame] | 64 | ":asuite_version", |
Jim Tang | cb71105 | 2019-05-08 16:38:25 +0800 | [diff] [blame] | 65 | ], |
Jim Tang | 82066bb | 2020-04-16 10:34:55 +0800 | [diff] [blame^] | 66 | // Make atest's built name to atest-py2-dev |
| 67 | stem: "atest-py2-dev", |
yangbill | 7a48120 | 2018-10-23 16:20:02 +0800 | [diff] [blame] | 68 | defaults: ["atest_py2_default"], |
Colin Cross | 47d81f4 | 2019-10-18 15:45:27 -0700 | [diff] [blame] | 69 | dist: { |
| 70 | targets: ["droidcore"], |
| 71 | }, |
Jim Tang | ec94b16 | 2018-05-04 07:17:23 +0000 | [diff] [blame] | 72 | } |
yangbill | 78ef63e | 2018-08-31 00:11:25 +0800 | [diff] [blame] | 73 | |
| 74 | python_library_host { |
| 75 | name: "atest_module_info", |
| 76 | defaults: ["atest_lib_default"], |
| 77 | srcs: [ |
yangbill | bac1dd6 | 2019-06-03 17:06:40 +0800 | [diff] [blame] | 78 | "atest_error.py", |
yelinhsieh | 686cda9 | 2019-09-11 15:21:42 +0800 | [diff] [blame] | 79 | "atest_decorator.py", |
yangbill | 78ef63e | 2018-08-31 00:11:25 +0800 | [diff] [blame] | 80 | "atest_utils.py", |
| 81 | "constants.py", |
yangbill | bac1dd6 | 2019-06-03 17:06:40 +0800 | [diff] [blame] | 82 | "constants_default.py", |
| 83 | "module_info.py", |
yangbill | 78ef63e | 2018-08-31 00:11:25 +0800 | [diff] [blame] | 84 | ], |
| 85 | } |
Kevin Cheng | 5d6e157 | 2018-10-23 11:43:42 -0700 | [diff] [blame] | 86 | |
| 87 | // Move asuite_default and asuite_metrics to //tools/asuite when atest is |
| 88 | // running as a prebuilt. |
| 89 | python_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 | |
| 104 | python_library_host { |
| 105 | name: "asuite_metrics", |
| 106 | defaults: ["asuite_default"], |
| 107 | srcs: [ |
| 108 | "asuite_metrics.py", |
| 109 | ], |
| 110 | } |
Jim Tang | ae8eb44 | 2018-10-29 16:42:33 +0800 | [diff] [blame] | 111 | |
Jim Tang | cb71105 | 2019-05-08 16:38:25 +0800 | [diff] [blame] | 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. |
Jim Tang | ae8eb44 | 2018-10-29 16:42:33 +0800 | [diff] [blame] | 114 | python_test_host { |
Jim Tang | 82066bb | 2020-04-16 10:34:55 +0800 | [diff] [blame^] | 115 | name: "atest-py2_unittests", |
Jim Tang | ae8eb44 | 2018-10-29 16:42:33 +0800 | [diff] [blame] | 116 | main: "atest_run_unittests.py", |
| 117 | pkg_path: "atest", |
| 118 | srcs: [ |
| 119 | "**/*.py", |
| 120 | ], |
| 121 | data: [ |
Jim Tang | cb71105 | 2019-05-08 16:38:25 +0800 | [diff] [blame] | 122 | "tools/updatedb_darwin.sh", |
Jim Tang | ae8eb44 | 2018-10-29 16:42:33 +0800 | [diff] [blame] | 123 | "unittest_data/**/*", |
| 124 | "unittest_data/**/.*", |
| 125 | ], |
kellyhung | 710ce96 | 2018-11-16 14:30:39 +0800 | [diff] [blame] | 126 | exclude_srcs: [ |
yangbill | 763f5ff | 2019-05-07 14:13:42 +0800 | [diff] [blame] | 127 | "asuite_lib_test/*.py", |
kellyhung | 710ce96 | 2018-11-16 14:30:39 +0800 | [diff] [blame] | 128 | "proto/*_pb2.py", |
| 129 | "proto/__init__.py", |
Jim Tang | cb71105 | 2019-05-08 16:38:25 +0800 | [diff] [blame] | 130 | "tools/atest_updatedb_unittest.py", |
kellyhung | 710ce96 | 2018-11-16 14:30:39 +0800 | [diff] [blame] | 131 | ], |
| 132 | libs: [ |
| 133 | "py-mock", |
| 134 | "atest_proto", |
| 135 | ], |
Jim Tang | ae8eb44 | 2018-10-29 16:42:33 +0800 | [diff] [blame] | 136 | test_config: "atest_unittests.xml", |
| 137 | test_suites: ["general-tests"], |
| 138 | defaults: ["atest_py2_default"], |
| 139 | } |
kellyhung | 710ce96 | 2018-11-16 14:30:39 +0800 | [diff] [blame] | 140 | |
| 141 | python_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 | } |
kellyhung | 5161d93 | 2019-04-23 16:23:59 +0800 | [diff] [blame] | 151 | |
Julien Desprez | f7f52e8 | 2019-05-24 13:33:10 -0700 | [diff] [blame] | 152 | java_library_host { |
| 153 | name: "asuite_proto_java", |
| 154 | srcs: [ |
| 155 | "proto/*.proto", |
| 156 | ], |
Julien Desprez | f7f52e8 | 2019-05-24 13:33:10 -0700 | [diff] [blame] | 157 | proto: { |
Colin Cross | 4698acf | 2019-10-25 18:20:47 -0700 | [diff] [blame] | 158 | type: "full", |
Julien Desprez | f7f52e8 | 2019-05-24 13:33:10 -0700 | [diff] [blame] | 159 | canonical_path_from_root: false, |
| 160 | include_dirs: ["external/protobuf/src"], |
| 161 | }, |
| 162 | } |
| 163 | |
kellyhung | 5161d93 | 2019-04-23 16:23:59 +0800 | [diff] [blame] | 164 | python_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 | |
| 175 | python_library_host { |
| 176 | name: "asuite_cc_client", |
| 177 | defaults: ["asuite_default"], |
| 178 | srcs: [ |
yangbill | bac1dd6 | 2019-06-03 17:06:40 +0800 | [diff] [blame] | 179 | "atest_error.py", |
yelinhsieh | 686cda9 | 2019-09-11 15:21:42 +0800 | [diff] [blame] | 180 | "atest_decorator.py", |
kellyhung | 5161d93 | 2019-04-23 16:23:59 +0800 | [diff] [blame] | 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 | } |
yangbill | 763f5ff | 2019-05-07 14:13:42 +0800 | [diff] [blame] | 191 | |
Jim Tang | 139389a | 2019-09-27 14:48:30 +0800 | [diff] [blame] | 192 | genrule { |
| 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 | } |