summaryrefslogtreecommitdiffstats
path: root/toolkit/components/glean/build_scripts/mach_commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/glean/build_scripts/mach_commands.py')
-rw-r--r--toolkit/components/glean/build_scripts/mach_commands.py59
1 files changed, 56 insertions, 3 deletions
diff --git a/toolkit/components/glean/build_scripts/mach_commands.py b/toolkit/components/glean/build_scripts/mach_commands.py
index 4a0f6dbc68..b8d270c088 100644
--- a/toolkit/components/glean/build_scripts/mach_commands.py
+++ b/toolkit/components/glean/build_scripts/mach_commands.py
@@ -167,9 +167,18 @@ def update_glean(command_context, version):
topsrcdir = Path(command_context.topsrcdir)
replace_in_file_or_die(
- topsrcdir / "build.gradle",
- r'gleanVersion = "[0-9.]+"',
- f'gleanVersion = "{version}"',
+ topsrcdir
+ / "mobile"
+ / "android"
+ / "android-components"
+ / "plugins"
+ / "dependencies"
+ / "src"
+ / "main"
+ / "java"
+ / "DependenciesPlugin.kt",
+ r'mozilla_glean = "[0-9.]+"',
+ f'mozilla_glean = "{version}"',
)
replace_in_file_or_die(
topsrcdir / "toolkit" / "components" / "glean" / "Cargo.toml",
@@ -226,3 +235,47 @@ def update_glean(command_context, version):
"""
print(textwrap.dedent(instructions))
+
+
+@Command(
+ "event-into-legacy",
+ category="misc",
+ description="Create a Legacy Telemetry compatible event definition from an existing Glean Event metric.",
+)
+@CommandArgument(
+ "--append",
+ "-a",
+ action="store_true",
+ help="Append to toolkit/components/telemetry/Events.yaml (note: verify and make any necessary modifications before landing).",
+)
+@CommandArgument("event", default=None, nargs="?", type=str, help="Event name.")
+def event_into_legacy(command_context, event=None, append=False):
+ # Get the metrics_index's list of metrics indices
+ # by loading the index as a module.
+ import sys
+ from os import path
+
+ sys.path.append(path.join(path.dirname(__file__), path.pardir))
+
+ from metrics_index import metrics_yamls
+
+ sys.path.append(path.dirname(__file__))
+
+ from pathlib import Path
+
+ from translate_events import translate_event
+
+ legacy_yaml_path = path.join(
+ Path(command_context.topsrcdir),
+ "toolkit",
+ "components",
+ "telemetry",
+ "Events.yaml",
+ )
+
+ return translate_event(
+ event,
+ append,
+ [Path(command_context.topsrcdir) / x for x in metrics_yamls],
+ legacy_yaml_path,
+ )