| # Copyright 2017 The Chromium Authors | 
 | # Use of this source code is governed by a BSD-style license that can be | 
 | # found in the LICENSE file. | 
 |  | 
 | import("//build/config/gclient_args.gni") | 
 | import("//tools/json_to_struct/json_to_struct.gni") | 
 | import("//tools/metrics/histograms/histograms_xml_files.gni") | 
 |  | 
 | # Only include histograms_xml if we have access to dirmd data, which | 
 | # is used to populate ownership information. This is only set to false | 
 | # for non-git checkouts. | 
 | # TODO(crbug.com/329080012): Remove this once dirmd works in non-git | 
 | # checkouts. | 
 | if (generate_location_tags) { | 
 |   action("histograms_xml") { | 
 |     script = "histograms/merge_xml.py" | 
 |     output = "$root_out_dir/histograms.xml" | 
 |     outputs = [ output ] | 
 |     inputs = histograms_xml_files | 
 |     args = [ | 
 |       "--output", | 
 |       rebase_path(output, root_build_dir), | 
 |     ] | 
 |   } | 
 | } | 
 |  | 
 | copy("actions_xml") { | 
 |   sources = [ "actions/actions.xml" ] | 
 |   outputs = [ "$root_out_dir/actions.xml" ] | 
 | } | 
 |  | 
 | copy("ukm_xml") { | 
 |   sources = [ "ukm/ukm.xml" ] | 
 |   outputs = [ "$root_out_dir/ukm.xml" ] | 
 | } | 
 |  | 
 | group("metrics_metadata") { | 
 |   deps = [ | 
 |     ":actions_xml", | 
 |     ":ukm_xml", | 
 |   ] | 
 |  | 
 |   # Only include histograms_xml if we have access to dirmd data, which | 
 |   # is used to populate ownership information. This is only set to false | 
 |   # for non-git checkouts. | 
 |   # TODO(crbug.com/329080012): Remove this once dirmd works in non-git | 
 |   # checkouts. | 
 |   if (generate_location_tags) { | 
 |     deps += [ ":histograms_xml" ] | 
 |   } | 
 | } | 
 |  | 
 | # This group defines the isolate files needed to run metrics_python_tests.py on | 
 | # on bots. This also tells the build system when the tests should be re-run - | 
 | # when one of the dependent files changes. | 
 | # | 
 | # When adding new entries to this test suite, you can test things locally with | 
 | # isolation using the following command: | 
 | # | 
 | #  tools/mb/mb.py run out/gn metrics_python_tests -- \ | 
 | #    --isolated-script-test-output=/tmp/output.json | 
 | # | 
 | group("metrics_python_tests") { | 
 |   data = [ | 
 |     # The run_isolated_script_test.py script and its dependencies. | 
 |     "//testing/scripts/run_isolated_script_test.py", | 
 |     "//testing/scripts/common.py", | 
 |     "//third_party/catapult/third_party/typ/", | 
 |  | 
 |     # Scripts we depend on. Their unit tests are also included. | 
 |     "//tools/json_comment_eater/json_comment_eater.py", | 
 |     "//tools/json_comment_eater/json_comment_eater_test.py", | 
 |     "//tools/json_comment_eater/everything.json", | 
 |     "//tools/json_comment_eater/everything_expected.json", | 
 |  | 
 |     # The metrics_python_tests.py runner and its dependencies. | 
 |     "//tools/metrics/metrics_python_tests.py", | 
 |  | 
 |     "//tools/metrics/actions/action_utils.py", | 
 |     "//tools/metrics/actions/actions_model.py", | 
 |     "//tools/metrics/actions/actions_model_test.py", | 
 |     "//tools/metrics/actions/extract_actions.py", | 
 |     "//tools/metrics/actions/extract_actions_test.py", | 
 |  | 
 |     "//tools/metrics/common/codegen_shared_test.py", | 
 |     "//tools/metrics/common/codegen_shared.py", | 
 |     "//tools/metrics/common/diff_util.py", | 
 |     "//tools/metrics/common/model_shared.py", | 
 |     "//tools/metrics/common/models.py", | 
 |     "//tools/metrics/common/path_util.py", | 
 |     "//tools/metrics/common/presubmit_util.py", | 
 |     "//tools/metrics/common/pretty_print_xml.py", | 
 |     "//tools/metrics/common/etree_util.py", | 
 |  | 
 |     "//tools/metrics/private_metrics/builders_template.py", | 
 |     "//tools/metrics/private_metrics/decode_template.py", | 
 |     "//tools/metrics/private_metrics/dwa.xml", | 
 |     "//tools/metrics/private_metrics/codegen.py", | 
 |     "//tools/metrics/private_metrics/dwa_model.py", | 
 |     "//tools/metrics/private_metrics/dwa_model_test.py", | 
 |     "//tools/metrics/private_metrics/dwa_xml_validations.py", | 
 |     "//tools/metrics/private_metrics/dwa_xml_validations_test.py", | 
 |     "//tools/metrics/private_metrics/gen_builders.py", | 
 |     "//tools/metrics/private_metrics/gen_builders_test.py", | 
 |  | 
 |     "//tools/metrics/histograms/test_data/enums.xml", | 
 |     "//tools/metrics/histograms/test_data/histograms.xml", | 
 |     "//tools/metrics/histograms/test_data/ukm.xml", | 
 |     "//tools/metrics/histograms/enums.xml", | 
 |     "//tools/metrics/histograms/expand_owners.py", | 
 |     "//tools/metrics/histograms/expand_owners_unittest.py", | 
 |     "//tools/metrics/histograms/extract_histograms.py", | 
 |     "//tools/metrics/histograms/extract_histograms_test.py", | 
 |     "//tools/metrics/histograms/generate_expired_histograms_array.py", | 
 |     "//tools/metrics/histograms/generate_expired_histograms_array_unittest.py", | 
 |     "//tools/metrics/histograms/generate_allowlist_from_histograms_file.py", | 
 |     "//tools/metrics/histograms/generate_allowlist_from_histograms_file_unittest.py", | 
 |     "//tools/metrics/histograms/generate_flag_enums.py", | 
 |     "//tools/metrics/histograms/generate_flag_enums_test.py", | 
 |     "//tools/metrics/histograms/histogram_ownership.py", | 
 |     "//tools/metrics/histograms/histogram_configuration_model.py", | 
 |     "//tools/metrics/histograms/histogram_configuration_model_test_enums.py", | 
 |     "//tools/metrics/histograms/histogram_configuration_model_test_histograms.py", | 
 |     "//tools/metrics/histograms/histogram_paths.py", | 
 |     "//tools/metrics/histograms/merge_xml.py", | 
 |     "//tools/metrics/histograms/merge_xml_test.py", | 
 |     "//tools/metrics/histograms/populate_enums.py", | 
 |     "//tools/metrics/histograms/PRESUBMIT_test.py", | 
 |     "//tools/metrics/histograms/pretty_print.py", | 
 |     "//tools/metrics/histograms/pretty_print_test.py", | 
 |     "//tools/metrics/histograms/validate_token.py", | 
 |     "//tools/metrics/histograms/validate_token_test.py", | 
 |  | 
 |     "//tools/metrics/structured/codegen_unittest.py", | 
 |     "//tools/metrics/structured/sync/model_unittest.py", | 
 |  | 
 |     "//tools/metrics/ukm/ukm.xml", | 
 |     "//tools/metrics/ukm/codegen.py", | 
 |     "//tools/metrics/ukm/builders_template.py", | 
 |     "//tools/metrics/ukm/decode_template.py", | 
 |     "//tools/metrics/ukm/gen_builders.py", | 
 |     "//tools/metrics/ukm/gen_builders_test.py", | 
 |     "//tools/metrics/ukm/ukm_model.py", | 
 |     "//tools/metrics/ukm/ukm_model_test.py", | 
 |     "//tools/metrics/ukm/xml_validations.py", | 
 |     "//tools/metrics/ukm/xml_validations_test.py", | 
 |  | 
 |     "//tools/python/google/path_utils.py", | 
 |  | 
 |     "//tools/variations/fieldtrial_to_struct_unittest.py", | 
 |     "//tools/variations/fieldtrial_to_struct.py", | 
 |     "//tools/variations/fieldtrial_util_unittest.py", | 
 |     "//tools/variations/fieldtrial_util.py", | 
 |     "//tools/variations/split_variations_cmd_unittest.py", | 
 |     "//tools/variations/split_variations_cmd.py", | 
 |     "//tools/variations/unittest_data/expected_output.cc", | 
 |     "//tools/variations/unittest_data/expected_output.h", | 
 |     "//tools/variations/unittest_data/test_config.json", | 
 |     "//tools/variations/unittest_data/variations_cmd.txt", | 
 |     "//components/variations/field_trial_config/field_trial_testing_config_schema.json", | 
 |     "//components/variations/service/generate_ui_string_overrider.py", | 
 |     "//components/variations/service/generate_ui_string_overrider_unittest.py", | 
 |   ] | 
 |  | 
 |   data += JSON_TO_STRUCT_FILES + JSON_TO_STRUCT_TEST_FILES | 
 |  | 
 |   # Add platform-specific dependencies for dirmd. | 
 |   if (is_win) { | 
 |     data += [ | 
 |       "//third_party/depot_tools/dirmd.bat", | 
 |       "//third_party/depot_tools/cipd_bin_setup.bat", | 
 |       "//third_party/depot_tools/cipd_manifest.txt", | 
 |     ] | 
 |     if (host_os == "win") { | 
 |       data += [ "//third_party/depot_tools/.cipd_bin/dirmd.exe" ] | 
 |     } | 
 |   } else { | 
 |     data += [ | 
 |       "//third_party/depot_tools/dirmd", | 
 |       "//third_party/depot_tools/cipd_bin_setup.sh", | 
 |       "//third_party/depot_tools/cipd_manifest.txt", | 
 |     ] | 
 |     if (host_os != "win") { | 
 |       data += [ "//third_party/depot_tools/.cipd_bin/dirmd" ] | 
 |     } | 
 |   } | 
 |  | 
 |   data_deps = [ "//testing:test_scripts_shared" ] | 
 | } |