Bug 1885565 - Part 1: Add mozac_ic_avatar_circle_24 to ui-icons r=android-reviewers...
[gecko.git] / toolkit / components / telemetry / moz.build
blob718120cf784a869d1b507a1927248b5aae5013dd
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 include("/ipc/chromium/chromium-config.mozbuild")
9 FINAL_LIBRARY = "xul"
11 DIRS = [
12     "pingsender",
15 if CONFIG["COMPILE_ENVIRONMENT"]:
16     EXPORTS.mozilla += ["!dap_ffi_generated.h"]
18     CbindgenHeader("dap_ffi_generated.h", inputs=["dap/ffi"])
20 DEFINES["MOZ_APP_VERSION"] = '"%s"' % CONFIG["MOZ_APP_VERSION"]
22 LOCAL_INCLUDES += [
23     "/xpcom/build",
24     "/xpcom/threads",
27 SPHINX_TREES["/toolkit/components/telemetry"] = "docs"
29 with Files("docs/**"):
30     SCHEDULES.exclusive = ["docs"]
32 if CONFIG["ENABLE_TESTS"]:
33     # We used to need GeckoView tests as a separate directory. This
34     # is no longer true and we could probably move it to tests/gtest.
35     DIRS += ["geckoview/gtest", "tests/gtest"]
37 TEST_DIRS += ["tests", "dap/ffi-gtest"]
39 XPCSHELL_TESTS_MANIFESTS += [
40     "dap/tests/xpcshell/xpcshell.toml",
41     "tests/unit/xpcshell.toml",
43 BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.toml"]
45 XPIDL_SOURCES += [
46     "core/nsITelemetry.idl",
47     "dap/nsIDAPTelemetry.idl",
50 XPIDL_MODULE = "telemetry"
52 EXPORTS.mozilla += [
53     "!TelemetryEventEnums.h",
54     "!TelemetryHistogramEnums.h",
55     "!TelemetryProcessEnums.h",
56     "!TelemetryScalarEnums.h",
57     "core/ipc/TelemetryComms.h",
58     "core/ipc/TelemetryIPC.h",
59     "core/Telemetry.h",
60     "dap/DAPTelemetry.h",
61     "dap/DAPTelemetryBindings.h",
62     "other/CombinedStacks.h",
63     "other/ProcessedStack.h",
66 EXPORTS.mozilla.telemetry += [
67     "core/Stopwatch.h",
70 SOURCES += [
71     "core/ipc/TelemetryIPC.cpp",
72     "core/ipc/TelemetryIPCAccumulator.cpp",
73     "core/Stopwatch.cpp",
74     "core/Telemetry.cpp",
75     "core/TelemetryCommon.cpp",
76     "core/TelemetryEvent.cpp",
77     "core/TelemetryHistogram.cpp",
78     "core/TelemetryScalar.cpp",
79     "core/TelemetryUserInteraction.cpp",
80     "dap/DAPTelemetry.cpp",
81     "geckoview/streaming/GeckoViewStreamingTelemetry.cpp",
82     "other/CombinedStacks.cpp",
83     "other/ProcessedStack.cpp",
84     "other/TelemetryIOInterposeObserver.cpp",
87 if CONFIG["OS_ARCH"] == "WINNT":
88     SOURCES += [
89         "other/UntrustedModules.cpp",
90         "other/UntrustedModulesBackupService.cpp",
91         "other/UntrustedModulesDataSerializer.cpp",
92     ]
94 XPCOM_MANIFESTS += [
95     "components.conf",
96     "core/components.conf",
97     "dap/components.conf",
100 EXTRA_COMPONENTS += ["TelemetryStartup.manifest"]
102 EXTRA_JS_MODULES += [
103     "app/ClientID.sys.mjs",
104     "app/TelemetryArchive.sys.mjs",
105     "app/TelemetryController.sys.mjs",
106     "app/TelemetryControllerBase.sys.mjs",
107     "app/TelemetryControllerContent.sys.mjs",
108     "app/TelemetryControllerParent.sys.mjs",
109     "app/TelemetryEnvironment.sys.mjs",
110     "app/TelemetryReportingPolicy.sys.mjs",
111     "app/TelemetryScheduler.sys.mjs",
112     "app/TelemetrySend.sys.mjs",
113     "app/TelemetryStorage.sys.mjs",
114     "app/TelemetryTimestamps.sys.mjs",
115     "app/TelemetryUtils.sys.mjs",
116     "dap/DAPTelemetrySender.sys.mjs",
117     "dap/DAPVisitCounter.sys.mjs",
118     "pings/CoveragePing.sys.mjs",
119     "pings/EventPing.sys.mjs",
120     "pings/HealthPing.sys.mjs",
121     "pings/ModulesPing.sys.mjs",
122     "pings/TelemetrySession.sys.mjs",
123     "pings/UntrustedModulesPing.sys.mjs",
124     "pings/UpdatePing.sys.mjs",
125     "TelemetryStartup.sys.mjs",
128 EXTRA_JS_MODULES.backgroundtasks += [
129     "pings/BackgroundTask_pingsender.sys.mjs",
132 if CONFIG["OS_ARCH"] == "WINNT":
133     EXTRA_JS_MODULES += [
134         "pings/UninstallPing.sys.mjs",
135     ]
137 TESTING_JS_MODULES += [
138     "tests/unit/TelemetryArchiveTesting.sys.mjs",
139     "tests/unit/TelemetryEnvironmentTesting.sys.mjs",
142 PYTHON_UNITTEST_MANIFESTS += [
143     "tests/integration/tests/python.toml",
144     "tests/python/python.toml",
147 # Generate histogram files.
148 histogram_files = [
149     "Histograms.json",
151 if CONFIG["MOZ_TELEMETRY_EXTRA_HISTOGRAM_FILES"]:
152     histogram_files.extend(CONFIG["MOZ_TELEMETRY_EXTRA_HISTOGRAM_FILES"])
154 GeneratedFile(
155     "TelemetryHistogramData.inc",
156     script="build_scripts/gen_histogram_data.py",
157     inputs=histogram_files,
159 GeneratedFile(
160     "TelemetryHistogramEnums.h",
161     script="build_scripts/gen_histogram_enum.py",
162     inputs=histogram_files,
164 GeneratedFile(
165     "TelemetryHistogramNameMap.h",
166     script="build_scripts/gen_histogram_phf.py",
167     inputs=histogram_files,
170 # Generate scalar files.
171 scalar_files = [
172     "Scalars.yaml",
174 if CONFIG["MOZ_TELEMETRY_EXTRA_SCALAR_FILES"]:
175     scalar_files.extend(CONFIG["MOZ_TELEMETRY_EXTRA_SCALAR_FILES"])
177 GeneratedFile(
178     "TelemetryScalarData.h",
179     script="build_scripts/gen_scalar_data.py",
180     inputs=scalar_files,
182 GeneratedFile(
183     "TelemetryScalarEnums.h",
184     script="build_scripts/gen_scalar_enum.py",
185     inputs=scalar_files,
188 # Generate the JSON scalar definitions. They will only be
189 # used in artifact or "build faster" builds.
190 GeneratedFile(
191     "ScalarArtifactDefinitions.json",
192     script="build_scripts/gen_scalar_data.py",
193     entry_point="generate_JSON_definitions",
194     inputs=scalar_files,
197 # Move the scalars JSON file to the directory where the Firefox binary is.
198 FINAL_TARGET_FILES += ["!ScalarArtifactDefinitions.json"]
200 # Generate event files.
201 event_files = [
202     "Events.yaml",
204 if CONFIG["MOZ_TELEMETRY_EXTRA_EVENT_FILES"]:
205     event_files.extend(CONFIG["MOZ_TELEMETRY_EXTRA_EVENT_FILES"])
207 GeneratedFile(
208     "TelemetryEventData.h", script="build_scripts/gen_event_data.py", inputs=event_files
211 GeneratedFile(
212     "TelemetryEventEnums.h",
213     script="build_scripts/gen_event_enum.py",
214     inputs=event_files,
217 # Generate the JSON event definitions. They will only be
218 # used in artifact or "build faster" builds.
219 GeneratedFile(
220     "EventArtifactDefinitions.json",
221     script="build_scripts/gen_event_data.py",
222     entry_point="generate_JSON_definitions",
223     inputs=event_files,
226 # Move the events JSON file to the directory where the Firefox binary is.
227 FINAL_TARGET_FILES += ["!EventArtifactDefinitions.json"]
229 # Generate data from Processes.yaml
230 processes_files = [
231     "Processes.yaml",
234 GeneratedFile(
235     "TelemetryProcessEnums.h",
236     script="build_scripts/gen_process_enum.py",
237     inputs=processes_files,
241 GeneratedFile(
242     "TelemetryProcessData.h",
243     script="build_scripts/gen_process_data.py",
244     inputs=processes_files,
247 # Ensure that the GeckoView metrics file parses correctly prior to it
248 # being released in Android components. This triggers glean_parser by
249 # pretending to generate a file named 'glean_checks'.
250 # While this currently only applies to Android, in the medium-term it
251 # is going to generate code for Firefox as well (project FOG).
252 # Prior art for this was in bug 1063728, within SpiderMonkey tests.
253 GeneratedFile(
254     "glean_checks",
255     script="build_scripts/run_glean_parser.py",
256     inputs=["geckoview/streaming/metrics.yaml"],
259 # Generate UserInteraction file
260 userinteraction_files = [
261     "UserInteractions.yaml",
263 GeneratedFile(
264     "TelemetryUserInteractionData.h",
265     script="build_scripts/gen_userinteraction_data.py",
266     inputs=userinteraction_files,
268 GeneratedFile(
269     "TelemetryUserInteractionNameMap.h",
270     script="build_scripts/gen_userinteraction_phf.py",
271     inputs=userinteraction_files,
274 with Files("**"):
275     BUG_COMPONENT = ("Toolkit", "Telemetry")