xref: /aosp_15_r20/external/cronet/components/metrics/generate_expired_histograms_array.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2017 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//tools/metrics/histograms/histograms_xml_files.gni")
6
7# Runs the resources map generation script other the given header files to
8# produce an output file and a source_set to build it.
9#
10# Parameters:
11#   inputs:
12#     List of file name to read. Each file should be a .xml file with
13#     histogram descriptions and should be a path starting with
14#     //tools/metrics/histograms/
15#
16#   namespace (optional):
17#     Namespace in which the generated code should be scoped. If left empty,
18#     the code will be in the global namespace.
19#
20#   header_filename:
21#     Name of the generated header file.
22#
23#   major_branch_date_filepath:
24#     A path to the file with the base date.
25#
26#   milestone_filepath:
27#     A path to the file with the milestone information.
28#
29template("generate_expired_histograms_array") {
30  action(target_name) {
31    header_filename = "$target_gen_dir/" + invoker.header_filename
32
33    script = "//tools/metrics/histograms/generate_expired_histograms_array.py"
34    outputs = [ header_filename ]
35
36    inputs = histograms_xml_files
37
38    major_branch_date_filepath = invoker.major_branch_date_filepath
39    milestone_filepath = invoker.milestone_filepath
40
41    args = []
42
43    if (defined(invoker.namespace) && invoker.namespace != "") {
44      args += [ "-n" + invoker.namespace ]
45    }
46
47    args += [
48              "-o" + rebase_path(root_gen_dir, root_build_dir),
49              "-H" + rebase_path(header_filename, root_gen_dir),
50              "-d" + rebase_path(major_branch_date_filepath, root_build_dir),
51              "-m" + rebase_path(milestone_filepath, root_build_dir),
52            ] + rebase_path(inputs, root_build_dir)
53  }
54}
55