1// Copyright 2019 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// Set of error prone rules to ensure code quality 16// PackageLocation check requires the androidCompatible=false otherwise it does not do anything. 17package { 18 default_applicable_licenses: ["Android-Apache-2.0"], 19} 20 21// Attributes common to both atest binaries and unittests. 22python_defaults { 23 name: "atest_defaults", 24 pkg_path: "atest", 25 srcs: [ 26 "**/*.py", 27 ], 28 libs: [ 29 "asuite_proto", 30 "tradefed-protos-py", 31 "py-google-api-python-client", 32 "py-oauth2client", 33 "pyyaml", 34 "ca_certs_locater", 35 ], 36 exclude_srcs: [ 37 "asuite_lib_test/*.py", 38 "proto/*.py", 39 "tf_proto/*.py", 40 "cc_test_filter_generator.py", 41 "cc_test_filter_generator_test.py", 42 "java_test_filter_generator.py", 43 "java_test_filter_generator_test.py", 44 ], 45 version: { 46 py3: { 47 embedded_launcher: true, 48 }, 49 }, 50} 51 52// Attributes common to atest binaries. 53python_defaults { 54 name: "atest_binary_defaults", 55 defaults: ["atest_defaults"], 56 data: [ 57 "bazel/resources/**/*", 58 ], 59 exclude_srcs: [ 60 "integration_tests/*.py", 61 "*_unittest.py", 62 "**/*_unittest.py", 63 ], 64} 65 66python_binary_host { 67 name: "atest", 68 defaults: ["atest_binary_defaults"], 69 main: "atest_main.py", 70 data: [ 71 ":adte-owners-files", 72 ":atest_flag_list_for_completion", 73 ":atest_log_uploader", 74 ], 75 // Make atest's built name be atest-dev 76 stem: "atest-dev", 77 dist: { 78 targets: ["droidcore"], 79 }, 80} 81 82python_binary_host { 83 name: "atest_log_uploader", 84 defaults: ["atest_binary_defaults"], 85 main: "logstorage/log_uploader.py", 86} 87 88// A helper binary used to generate the atest_flag_list_for_completion.txt 89// file, it should never be run outside of the build. It's the same 90// as atest except it has atest_flag_list_generator.py as it's main python 91// file. The atest_flag_list_for_completion.txt file is extracted from the 92// atest binary during autocompletion. 93python_binary_host { 94 name: "atest_flag_list_generator", 95 defaults: ["atest_binary_defaults"], 96 main: "atest_flag_list_generator.py", 97} 98 99genrule { 100 name: "atest_flag_list_for_completion", 101 out: ["atest_flag_list_for_completion.txt"], 102 tools: ["atest_flag_list_generator"], 103 cmd: "$(location atest_flag_list_generator) > $(out)", 104} 105 106python_library_host { 107 name: "atest_module_info", 108 pkg_path: "atest", 109 srcs: [ 110 "atest_error.py", 111 "atest_decorator.py", 112 "atest_utils.py", 113 "constants.py", 114 "constants_default.py", 115 "module_info.py", 116 ], 117 libs: [ 118 "tradefed-protos-py", 119 ], 120} 121 122python_library_host { 123 name: "asuite_cc_client", 124 pkg_path: "atest", 125 srcs: [ 126 "atest_enum.py", 127 "metrics/*.py", 128 "coverage/*.py", 129 ], 130 libs: [ 131 "asuite_proto", 132 "atest_module_info", 133 ], 134} 135 136python_test_host { 137 name: "atest_unittests", 138 main: "atest_run_unittests.py", 139 defaults: ["atest_defaults"], 140 test_options: { 141 unit_test: true, 142 }, 143 data: [ 144 "unittest_data/**/*", 145 "unittest_data/**/.*", 146 ], 147 exclude_srcs: [ 148 "tools/atest_updatedb_unittest.py", 149 ], 150 libs: [ 151 "pyfakefs", 152 "py-httplib2", 153 ], 154 test_config: "atest_unittests.xml", 155 test_suites: ["general-tests"], 156} 157