Skip to content

Commit

Permalink
Bug 1862794 - Use function calls instead of const val for version and…
Browse files Browse the repository at this point in the history
… channel fields in Gecko object
  • Loading branch information
gabrielluong committed Nov 14, 2023
1 parent 0bc1f9e commit 59c0410
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/android_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: "
Expand Down
4 changes: 2 additions & 2 deletions src/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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")
Expand Down

0 comments on commit 59c0410

Please sign in to comment.