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} 46 47// Attributes common to atest binaries. 48python_defaults { 49 name: "atest_binary_defaults", 50 defaults: ["atest_defaults"], 51 data: [ 52 "bazel/resources/**/*", 53 ], 54 exclude_srcs: [ 55 "integration_tests/*.py", 56 "*_unittest.py", 57 "**/*_unittest.py", 58 ], 59} 60 61python_binary_host { 62 name: "atest", 63 defaults: ["atest_binary_defaults"], 64 main: "atest_main.py", 65 data: [ 66 ":adte-owners-files", 67 ":atest_flag_list_for_completion", 68 ":atest_log_uploader", 69 ], 70 // Make atest's built name be atest-dev 71 stem: "atest-dev", 72 dist: { 73 targets: ["droidcore"], 74 }, 75} 76 77python_binary_host { 78 name: "atest_log_uploader", 79 defaults: ["atest_binary_defaults"], 80 main: "logstorage/log_uploader.py", 81} 82 83// A helper binary used to generate the atest_flag_list_for_completion.txt 84// file, it should never be run outside of the build. It's the same 85// as atest except it has atest_flag_list_generator.py as it's main python 86// file. The atest_flag_list_for_completion.txt file is extracted from the 87// atest binary during autocompletion. 88python_binary_host { 89 name: "atest_flag_list_generator", 90 defaults: ["atest_binary_defaults"], 91 main: "atest_flag_list_generator.py", 92} 93 94genrule { 95 name: "atest_flag_list_for_completion", 96 out: ["atest_flag_list_for_completion.txt"], 97 tools: ["atest_flag_list_generator"], 98 cmd: "$(location atest_flag_list_generator) > $(out)", 99} 100 101python_library_host { 102 name: "atest_module_info", 103 pkg_path: "atest", 104 srcs: [ 105 "atest_error.py", 106 "atest_decorator.py", 107 "atest_utils.py", 108 "constants.py", 109 "constants_default.py", 110 "module_info.py", 111 ], 112 libs: [ 113 "tradefed-protos-py", 114 ], 115} 116 117python_library_host { 118 name: "asuite_cc_client", 119 pkg_path: "atest", 120 srcs: [ 121 "atest_enum.py", 122 "metrics/*.py", 123 "coverage/*.py", 124 ], 125 libs: [ 126 "asuite_proto", 127 "atest_module_info", 128 ], 129} 130 131python_test_host { 132 name: "atest_unittests", 133 main: "atest_run_unittests.py", 134 defaults: ["atest_defaults"], 135 test_options: { 136 unit_test: true, 137 }, 138 data: [ 139 "unittest_data/**/*", 140 "unittest_data/**/.*", 141 ], 142 exclude_srcs: [ 143 "tools/atest_updatedb_unittest.py", 144 ], 145 libs: [ 146 "pyfakefs", 147 "py-httplib2", 148 ], 149 test_config: "atest_unittests.xml", 150 test_suites: ["general-tests"], 151} 152