Source code

Revision control

Copy as Markdown

Other Tools

# -*- 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")