From 75458a73caf86968d9a512d01b3f9e260c959aac Mon Sep 17 00:00:00 2001 From: Gabriel Luong Date: Wed, 8 Nov 2023 02:12:55 -0500 Subject: [PATCH] Bug 1862794 - Use function calls instead of const val for version and channel fields in Gecko object --- src/android_components.py | 5 +++++ src/util.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/android_components.py b/src/android_components.py index 31e1e73..a237c8a 100644 --- a/src/android_components.py +++ b/src/android_components.py @@ -92,6 +92,11 @@ def _update_gv_version( f'const val version = "{old_gv_version}"', f'const val version = "{new_gv_version}"', ) + new_content = new_content.replace( + f'fun version() = "{old_gv_version}"', + f'fun version() = "{new_gv_version}"', + ) + if content == new_content: raise Exception( "Update to Gecko.kt resulted in no changes: " diff --git a/src/util.py b/src/util.py index bef1d57..042ec46 100644 --- a/src/util.py +++ b/src/util.py @@ -74,7 +74,7 @@ def get_current_embedded_ac_version(repo, release_branch_name, target_path=""): def match_gv_version(src): """Find the GeckoView version in the contents of the given Gecko.kt file.""" - if match := re.compile(r'version = "([^"]*)"', re.MULTILINE).search(src): + if match := re.compile(r'version\(?\)? = "([^"]*)"', re.MULTILINE).search(src): return validate_gv_version(match[1]) raise Exception("Could not match the version in Gecko.kt") @@ -90,7 +90,7 @@ def get_current_gv_version(ac_repo, release_branch_name, ac_major_version): def match_gv_channel(src): """Find the GeckoView channel in the contents of the given Gecko.kt file.""" if match := re.compile( - r"val channel = GeckoChannel.(NIGHTLY|BETA|RELEASE)", re.MULTILINE + r"channel\(?\)? = GeckoChannel.(NIGHTLY|BETA|RELEASE)", re.MULTILINE ).search(src): return validate_gv_channel(match[1].lower()) raise Exception("Could not match the channel in Gecko.kt")