diff --git a/CHANGELOG.md b/CHANGELOG.md index bb36485c..fbcc7011 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +- Revert updating Kotlin template import statement as part of removing `service-glean` from Android Components. + This change was BREAKING. It will be reintroduced in a major release afterwards ([#744](https://github.com/mozilla/glean_parser/pull/744)) + ## 14.5.1 - BUGFIX: Rust object metrics: Accept `null` in place of empty arrays diff --git a/glean_parser/templates/kotlin.geckoview.jinja2 b/glean_parser/templates/kotlin.geckoview.jinja2 index 359460dc..f58c788e 100644 --- a/glean_parser/templates/kotlin.geckoview.jinja2 +++ b/glean_parser/templates/kotlin.geckoview.jinja2 @@ -15,7 +15,7 @@ package {{ namespace }} import {{ glean_namespace }}.private.BooleanMetricType // ktlint-disable import-ordering no-unused-imports import {{ glean_namespace }}.private.CounterMetricType // ktlint-disable import-ordering no-unused-imports -import {{ glean_namespace }}.private.HistogramBase // ktlint-disable import-ordering no-unused-imports +import {{ glean_namespace }}.private.HistogramMetricBase // ktlint-disable import-ordering no-unused-imports import {{ glean_namespace }}.private.LabeledMetricType // ktlint-disable import-ordering no-unused-imports import {{ glean_namespace }}.private.QuantityMetricType // ktlint-disable import-ordering no-unused-imports import {{ glean_namespace }}.private.StringMetricType // ktlint-disable import-ordering no-unused-imports @@ -28,7 +28,7 @@ internal object GleanGeckoMetricsMapping { // Support exfiltration of Gecko histograms from products using both the // Glean SDK and GeckoView. See bug 1566356 for more context. @Suppress("UNUSED_PARAMETER") - fun getHistogram(geckoMetricName: String): HistogramBase? { + fun getHistogram(geckoMetricName: String): HistogramMetricBase? { {% if 'histograms' in gecko_metrics %} return when (geckoMetricName) { {% for category in gecko_metrics['histograms'].keys()|sort %} diff --git a/tests/test_kotlin.py b/tests/test_kotlin.py index 07440687..79d5139f 100644 --- a/tests/test_kotlin.py +++ b/tests/test_kotlin.py @@ -274,13 +274,13 @@ def test_gecko_datapoints(tmp_path): with (tmp_path / "GleanGeckoMetricsMapping.kt").open("r", encoding="utf-8") as fd: content = fd.read() # Make sure we're adding the relevant Glean SDK import, once. - assert content.count("import Bar.private.HistogramBase") == 1 + assert content.count("import Bar.private.HistogramMetricBase") == 1 # Validate the generated Gecko metric mapper Kotlin functions. # NOTE: Indentation, whitespaces and text formatting of the block # below are important. Do not change them unless the file format # changes, otherwise validation will fail. - expected_func = """ fun getHistogram(geckoMetricName: String): HistogramBase? { + expected_func = """ fun getHistogram(geckoMetricName: String): HistogramMetricBase? { return when (geckoMetricName) { // From GfxContentCheckerboard.kt "CHECKERBOARD_DURATION" -> GfxContentCheckerboard.duration @@ -338,7 +338,7 @@ def test_gecko_datapoints(tmp_path): for file_name in metrics_files: with (tmp_path / file_name).open("r", encoding="utf-8") as fd: content = fd.read() - assert "HistogramBase" not in content + assert "HistogramMetricBase" not in content run_linters(tmp_path.glob("*.kt"))