Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1912724 - Revert "Bug 1906941 - Update kotlin jinja template import statement (#740)" #744

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions glean_parser/templates/kotlin.geckoview.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 %}
Expand Down
6 changes: 3 additions & 3 deletions tests/test_kotlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"))

Expand Down