summaryrefslogtreecommitdiffstats
path: root/toolkit/components/telemetry/moz.build
blob: 718120cf784a869d1b507a1927248b5aae5013dd (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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# -*- 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/.

include("/ipc/chromium/chromium-config.mozbuild")

FINAL_LIBRARY = "xul"

DIRS = [
    "pingsender",
]

if CONFIG["COMPILE_ENVIRONMENT"]:
    EXPORTS.mozilla += ["!dap_ffi_generated.h"]

    CbindgenHeader("dap_ffi_generated.h", inputs=["dap/ffi"])

DEFINES["MOZ_APP_VERSION"] = '"%s"' % CONFIG["MOZ_APP_VERSION"]

LOCAL_INCLUDES += [
    "/xpcom/build",
    "/xpcom/threads",
]

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

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

if CONFIG["ENABLE_TESTS"]:
    # We used to need GeckoView tests as a separate directory. This
    # is no longer true and we could probably move it to tests/gtest.
    DIRS += ["geckoview/gtest", "tests/gtest"]

TEST_DIRS += ["tests", "dap/ffi-gtest"]

XPCSHELL_TESTS_MANIFESTS += [
    "dap/tests/xpcshell/xpcshell.toml",
    "tests/unit/xpcshell.toml",
]
BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.toml"]

XPIDL_SOURCES += [
    "core/nsITelemetry.idl",
    "dap/nsIDAPTelemetry.idl",
]

XPIDL_MODULE = "telemetry"

EXPORTS.mozilla += [
    "!TelemetryEventEnums.h",
    "!TelemetryHistogramEnums.h",
    "!TelemetryProcessEnums.h",
    "!TelemetryScalarEnums.h",
    "core/ipc/TelemetryComms.h",
    "core/ipc/TelemetryIPC.h",
    "core/Telemetry.h",
    "dap/DAPTelemetry.h",
    "dap/DAPTelemetryBindings.h",
    "other/CombinedStacks.h",
    "other/ProcessedStack.h",
]

EXPORTS.mozilla.telemetry += [
    "core/Stopwatch.h",
]

SOURCES += [
    "core/ipc/TelemetryIPC.cpp",
    "core/ipc/TelemetryIPCAccumulator.cpp",
    "core/Stopwatch.cpp",
    "core/Telemetry.cpp",
    "core/TelemetryCommon.cpp",
    "core/TelemetryEvent.cpp",
    "core/TelemetryHistogram.cpp",
    "core/TelemetryScalar.cpp",
    "core/TelemetryUserInteraction.cpp",
    "dap/DAPTelemetry.cpp",
    "geckoview/streaming/GeckoViewStreamingTelemetry.cpp",
    "other/CombinedStacks.cpp",
    "other/ProcessedStack.cpp",
    "other/TelemetryIOInterposeObserver.cpp",
]

if CONFIG["OS_ARCH"] == "WINNT":
    SOURCES += [
        "other/UntrustedModules.cpp",
        "other/UntrustedModulesBackupService.cpp",
        "other/UntrustedModulesDataSerializer.cpp",
    ]

XPCOM_MANIFESTS += [
    "components.conf",
    "core/components.conf",
    "dap/components.conf",
]

EXTRA_COMPONENTS += ["TelemetryStartup.manifest"]

EXTRA_JS_MODULES += [
    "app/ClientID.sys.mjs",
    "app/TelemetryArchive.sys.mjs",
    "app/TelemetryController.sys.mjs",
    "app/TelemetryControllerBase.sys.mjs",
    "app/TelemetryControllerContent.sys.mjs",
    "app/TelemetryControllerParent.sys.mjs",
    "app/TelemetryEnvironment.sys.mjs",
    "app/TelemetryReportingPolicy.sys.mjs",
    "app/TelemetryScheduler.sys.mjs",
    "app/TelemetrySend.sys.mjs",
    "app/TelemetryStorage.sys.mjs",
    "app/TelemetryTimestamps.sys.mjs",
    "app/TelemetryUtils.sys.mjs",
    "dap/DAPTelemetrySender.sys.mjs",
    "dap/DAPVisitCounter.sys.mjs",
    "pings/CoveragePing.sys.mjs",
    "pings/EventPing.sys.mjs",
    "pings/HealthPing.sys.mjs",
    "pings/ModulesPing.sys.mjs",
    "pings/TelemetrySession.sys.mjs",
    "pings/UntrustedModulesPing.sys.mjs",
    "pings/UpdatePing.sys.mjs",
    "TelemetryStartup.sys.mjs",
]

EXTRA_JS_MODULES.backgroundtasks += [
    "pings/BackgroundTask_pingsender.sys.mjs",
]

if CONFIG["OS_ARCH"] == "WINNT":
    EXTRA_JS_MODULES += [
        "pings/UninstallPing.sys.mjs",
    ]

TESTING_JS_MODULES += [
    "tests/unit/TelemetryArchiveTesting.sys.mjs",
    "tests/unit/TelemetryEnvironmentTesting.sys.mjs",
]

PYTHON_UNITTEST_MANIFESTS += [
    "tests/integration/tests/python.toml",
    "tests/python/python.toml",
]

# Generate histogram files.
histogram_files = [
    "Histograms.json",
]
if CONFIG["MOZ_TELEMETRY_EXTRA_HISTOGRAM_FILES"]:
    histogram_files.extend(CONFIG["MOZ_TELEMETRY_EXTRA_HISTOGRAM_FILES"])

GeneratedFile(
    "TelemetryHistogramData.inc",
    script="build_scripts/gen_histogram_data.py",
    inputs=histogram_files,
)
GeneratedFile(
    "TelemetryHistogramEnums.h",
    script="build_scripts/gen_histogram_enum.py",
    inputs=histogram_files,
)
GeneratedFile(
    "TelemetryHistogramNameMap.h",
    script="build_scripts/gen_histogram_phf.py",
    inputs=histogram_files,
)

# Generate scalar files.
scalar_files = [
    "Scalars.yaml",
]
if CONFIG["MOZ_TELEMETRY_EXTRA_SCALAR_FILES"]:
    scalar_files.extend(CONFIG["MOZ_TELEMETRY_EXTRA_SCALAR_FILES"])

GeneratedFile(
    "TelemetryScalarData.h",
    script="build_scripts/gen_scalar_data.py",
    inputs=scalar_files,
)
GeneratedFile(
    "TelemetryScalarEnums.h",
    script="build_scripts/gen_scalar_enum.py",
    inputs=scalar_files,
)

# Generate the JSON scalar definitions. They will only be
# used in artifact or "build faster" builds.
GeneratedFile(
    "ScalarArtifactDefinitions.json",
    script="build_scripts/gen_scalar_data.py",
    entry_point="generate_JSON_definitions",
    inputs=scalar_files,
)

# Move the scalars JSON file to the directory where the Firefox binary is.
FINAL_TARGET_FILES += ["!ScalarArtifactDefinitions.json"]

# Generate event files.
event_files = [
    "Events.yaml",
]
if CONFIG["MOZ_TELEMETRY_EXTRA_EVENT_FILES"]:
    event_files.extend(CONFIG["MOZ_TELEMETRY_EXTRA_EVENT_FILES"])

GeneratedFile(
    "TelemetryEventData.h", script="build_scripts/gen_event_data.py", inputs=event_files
)

GeneratedFile(
    "TelemetryEventEnums.h",
    script="build_scripts/gen_event_enum.py",
    inputs=event_files,
)

# Generate the JSON event definitions. They will only be
# used in artifact or "build faster" builds.
GeneratedFile(
    "EventArtifactDefinitions.json",
    script="build_scripts/gen_event_data.py",
    entry_point="generate_JSON_definitions",
    inputs=event_files,
)

# Move the events JSON file to the directory where the Firefox binary is.
FINAL_TARGET_FILES += ["!EventArtifactDefinitions.json"]

# Generate data from Processes.yaml
processes_files = [
    "Processes.yaml",
]

GeneratedFile(
    "TelemetryProcessEnums.h",
    script="build_scripts/gen_process_enum.py",
    inputs=processes_files,
)


GeneratedFile(
    "TelemetryProcessData.h",
    script="build_scripts/gen_process_data.py",
    inputs=processes_files,
)

# Ensure that the GeckoView metrics file parses correctly prior to it
# being released in Android components. This triggers glean_parser by
# pretending to generate a file named 'glean_checks'.
# While this currently only applies to Android, in the medium-term it
# is going to generate code for Firefox as well (project FOG).
# Prior art for this was in bug 1063728, within SpiderMonkey tests.
GeneratedFile(
    "glean_checks",
    script="build_scripts/run_glean_parser.py",
    inputs=["geckoview/streaming/metrics.yaml"],
)

# Generate UserInteraction file
userinteraction_files = [
    "UserInteractions.yaml",
]
GeneratedFile(
    "TelemetryUserInteractionData.h",
    script="build_scripts/gen_userinteraction_data.py",
    inputs=userinteraction_files,
)
GeneratedFile(
    "TelemetryUserInteractionNameMap.h",
    script="build_scripts/gen_userinteraction_phf.py",
    inputs=userinteraction_files,
)

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