summaryrefslogtreecommitdiffstats
path: root/toolkit/components/glean/moz.build
blob: f5e7622d226dd8ac22174dc11e77a444cb7d4035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

SPHINX_TREES["/toolkit/components/glean"] = "docs"

# Needed so that we can include IPC things.
include("/ipc/chromium/chromium-config.mozbuild")

FINAL_LIBRARY = "xul"

EXPORTS.mozilla += [
    "ipc/FOGIPC.h",
]

EXPORTS.mozilla.glean += [
    "!GleanMetrics.h",
    "!GleanPings.h",
]

EXPORTS.mozilla.glean.bindings += [
    "!EventGIFFTMap.h",
    "!GleanJSMetricsLookup.h",
    "!GleanJSPingsLookup.h",
    "!HistogramGIFFTMap.h",
    "!ScalarGIFFTMap.h",
    "bindings/Category.h",
    "bindings/Glean.h",
    "bindings/GleanPings.h",
    "bindings/MetricTypes.h",
    "bindings/private/Boolean.h",
    "bindings/private/Common.h",
    "bindings/private/Counter.h",
    "bindings/private/CustomDistribution.h",
    "bindings/private/Datetime.h",
    "bindings/private/Denominator.h",
    "bindings/private/DistributionData.h",
    "bindings/private/Event.h",
    "bindings/private/Labeled.h",
    "bindings/private/MemoryDistribution.h",
    "bindings/private/Numerator.h",
    "bindings/private/Ping.h",
    "bindings/private/Quantity.h",
    "bindings/private/Rate.h",
    "bindings/private/String.h",
    "bindings/private/StringList.h",
    "bindings/private/Text.h",
    "bindings/private/Timespan.h",
    "bindings/private/TimingDistribution.h",
    "bindings/private/Url.h",
    "bindings/private/Uuid.h",
]

EXPORTS.mozilla.glean.bindings.jog += [
    "bindings/jog/JOG.h",
]

if CONFIG["COMPILE_ENVIRONMENT"]:
    EXPORTS.mozilla.glean += [
        "!fog_ffi_generated.h",
    ]

    EXPORTS.mozilla.glean.bindings.jog += [
        "!jog_ffi_generated.h",
    ]

    CbindgenHeader("fog_ffi_generated.h", inputs=["/toolkit/components/glean"])
    CbindgenHeader(
        "jog_ffi_generated.h", inputs=["/toolkit/components/glean/bindings/jog"]
    )

UNIFIED_SOURCES += [
    "bindings/Category.cpp",
    "bindings/Glean.cpp",
    "bindings/GleanPings.cpp",
    "bindings/jog/JOG.cpp",
    "bindings/private/Boolean.cpp",
    "bindings/private/Common.cpp",
    "bindings/private/Counter.cpp",
    "bindings/private/CustomDistribution.cpp",
    "bindings/private/Datetime.cpp",
    "bindings/private/Denominator.cpp",
    "bindings/private/Event.cpp",
    "bindings/private/Labeled.cpp",
    "bindings/private/MemoryDistribution.cpp",
    "bindings/private/Numerator.cpp",
    "bindings/private/Ping.cpp",
    "bindings/private/Quantity.cpp",
    "bindings/private/Rate.cpp",
    "bindings/private/String.cpp",
    "bindings/private/StringList.cpp",
    "bindings/private/Text.cpp",
    "bindings/private/Timespan.cpp",
    "bindings/private/TimingDistribution.cpp",
    "bindings/private/Url.cpp",
    "bindings/private/Uuid.cpp",
    "ipc/FOGIPC.cpp",
    "ipc/Support.cpp",
]

SOURCES += [
    "!EventExtraGIFFTMaps.cpp",
    "!GleanJSMetricsLookup.cpp",
    "!GleanJSPingsLookup.cpp",
]

# Provides us the list of dependent metrics|pings.yaml.
include("metrics_index.py")
# GeneratedFile's `inputs` are relative to our dir.
# The yamls arrays are relative to topsrcdir, so we need to transform:
metrics_yamls = ["../../../" + x for x in metrics_yamls]
pings_yamls = ["../../../" + x for x in pings_yamls]
tags_yamls = ["../../../" + x for x in tags_yamls]
# If you change the length of this deps list, update DEPS_LEN in run_glean_parser.py
deps = [
    "metrics_index.py",
    "build_scripts/glean_parser_ext/cpp.py",
    "build_scripts/glean_parser_ext/jog.py",
    "build_scripts/glean_parser_ext/js.py",
    "build_scripts/glean_parser_ext/run_glean_parser.py",
    "build_scripts/glean_parser_ext/rust.py",
    "build_scripts/glean_parser_ext/string_table.py",
    "build_scripts/glean_parser_ext/util.py",
    "build_scripts/glean_parser_ext/templates/cpp.jinja2",
    "build_scripts/glean_parser_ext/templates/cpp_pings.jinja2",
    "build_scripts/glean_parser_ext/templates/gifft.jinja2",
    "build_scripts/glean_parser_ext/templates/gifft_events.jinja2",
    "build_scripts/glean_parser_ext/templates/jog_factory.jinja2",
    "build_scripts/glean_parser_ext/templates/js.jinja2",
    "build_scripts/glean_parser_ext/templates/js_h.jinja2",
    "build_scripts/glean_parser_ext/templates/js_pings.jinja2",
    "build_scripts/glean_parser_ext/templates/js_pings_h.jinja2",
    "build_scripts/glean_parser_ext/templates/rust.jinja2",
    "build_scripts/glean_parser_ext/templates/rust_pings.jinja2",
]

GeneratedFile(
    "GleanMetrics.h",
    "GleanJSMetricsLookup.h",
    "GleanJSMetricsLookup.cpp",
    "api/src/metrics.rs",
    script="build_scripts/glean_parser_ext/run_glean_parser.py",
    flags=[
        CONFIG["MOZ_APP_VERSION"],
        "GleanJSMetricsLookup.h",
        "GleanJSMetricsLookup.cpp",
        "api/src/metrics.rs",
    ],
    inputs=deps + metrics_yamls + tags_yamls,
)

GeneratedFile(
    "GleanPings.h",
    "GleanJSPingsLookup.h",
    "GleanJSPingsLookup.cpp",
    "api/src/pings.rs",
    script="build_scripts/glean_parser_ext/run_glean_parser.py",
    flags=[
        CONFIG["MOZ_APP_VERSION"],
        "GleanJSPingsLookup.h",
        "GleanJSPingsLookup.cpp",
        "api/src/pings.rs",
    ],
    inputs=deps + pings_yamls + tags_yamls,
)

# Glean Interface For Firefox Telemetry Maps from Glean MetricId to Telemetry ProbeId
# We split it one map per header to avoid unused function warnings on build.
GeneratedFile(
    "EventGIFFTMap.h",
    script="build_scripts/glean_parser_ext/run_glean_parser.py",
    entry_point="gifft_map",
    flags=[CONFIG["MOZ_APP_VERSION"], "Event"],
    inputs=deps + metrics_yamls + tags_yamls,
)

GeneratedFile(
    "HistogramGIFFTMap.h",
    script="build_scripts/glean_parser_ext/run_glean_parser.py",
    entry_point="gifft_map",
    flags=[CONFIG["MOZ_APP_VERSION"], "Histogram"],
    inputs=deps + metrics_yamls + tags_yamls,
)

GeneratedFile(
    "ScalarGIFFTMap.h",
    script="build_scripts/glean_parser_ext/run_glean_parser.py",
    entry_point="gifft_map",
    flags=[CONFIG["MOZ_APP_VERSION"], "Scalar"],
    inputs=deps + metrics_yamls + tags_yamls,
)

# JOG provides both the Rust factory for building runtime-registered metrics
# and pings _and_ the YAML file used at runtime to register those metrics and
# pings for Artifact Builds.
# The factory lives inside the `fog` crate to avoid a circular dependency.
GeneratedFile(
    "api/src/factory.rs",
    script="build_scripts/glean_parser_ext/run_glean_parser.py",
    entry_point="jog_factory",
    flags=[CONFIG["MOZ_APP_VERSION"]],
    inputs=deps + pings_yamls + metrics_yamls + tags_yamls,
)

# Only generate jogfile.json in Artifact Builds since
# its presence triggers main-thread I/O.
if CONFIG["MOZ_ARTIFACT_BUILDS"]:
    GeneratedFile(
        "jogfile.json",
        script="build_scripts/glean_parser_ext/run_glean_parser.py",
        entry_point="jog_file",
        flags=[CONFIG["MOZ_APP_VERSION"]],
        inputs=deps + pings_yamls + metrics_yamls + tags_yamls,
    )
    # Once generated, it needs to be placed in GreD so it can be found.
    FINAL_TARGET_FILES += ["!jogfile.json"]

DIRS += [
    "tests",  # Must be in DIRS, not TEST_DIRS or python-test won't find it.
    "xpcom",
]

with Files("docs/**"):
    SCHEDULES.exclusive = ["docs"]

with Files("**"):
    BUG_COMPONENT = ("Toolkit", "Telemetry")