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 1862794 - Use function calls instead of const val for version and channel fields in Gecko object #108

Merged
merged 1 commit into from
Nov 14, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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