Skip to content
Open
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
165 changes: 127 additions & 38 deletions common/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ load("//common/private:dmg_archive.bzl", "dmg_archive")
load("//common/private:drivers.bzl", "local_drivers")
load("//common/private:pkg_archive.bzl", "pkg_archive")

def pin_browsers():
def pin_browsers(arch):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. pin_browsers() signature changed 📘 Rule violation ✓ Correctness

The public Starlark symbol pin_browsers was changed from no-args to requiring arch, which can
break any external loads/callers still invoking pin_browsers() with the previous signature.
Agent Prompt
## Issue description
`pin_browsers` changed from no-arg to requiring `arch`, which can break existing Bazel/Starlark callers that still invoke `pin_browsers()`.

## Issue Context
This is a build/module interface surface (`common/repositories.bzl`). Even if this repo currently calls it only from the module extension, external consumers may load and call it.

## Fix Focus Areas
- common/repositories.bzl[9-16]
- common/repositories.bzl[445-446]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

local_drivers(name = "local_drivers")

if arch == "x86_64":
chrome_arch = "x64"
else:
chrome_arch = "arm64"

Comment on lines +9 to +16
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Generator not updated 🐞 Bug ⚙ Maintainability

common/repositories.bzl is generated by scripts/pinned_browsers.py, but this PR changes the
generated output shape (pin_browsers now takes arch and extension passes _ctx.os.arch) without
updating the generator, so regenerating will overwrite and remove the arch-aware pinning.
Agent Prompt
## Issue description
`common/repositories.bzl` is generated, but the generator (`scripts/pinned_browsers.py`) still generates the old `pin_browsers()` signature and extension call. Re-running `bazel run scripts:pinned_browsers` will overwrite the PR’s new arch-aware Mac Chrome/Chromedriver pinning.

## Issue Context
The repo relies on `scripts/pinned_browsers.py` to regenerate `common/repositories.bzl` when pinned versions change.

## Fix Focus Areas
- scripts/pinned_browsers.py[537-570]
- common/repositories.bzl[1-16]
- common/repositories.bzl[445-446]

## What to change
- Teach `scripts/pinned_browsers.py` to generate `def pin_browsers(arch):` and emit the `chrome_arch` mapping logic.
- Update the generated extension impl to call `pin_browsers(arch = _ctx.os.arch)`.
- Ensure the generated output matches the committed `common/repositories.bzl` so regeneration is idempotent.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

http_archive(
name = "linux_firefox",
url = "https://ftp.mozilla.org/pub/firefox/releases/149.0/linux-x86_64/en-US/firefox-149.0.tar.xz",
Expand Down Expand Up @@ -218,16 +223,17 @@ js_library(
)
""",
)
http_archive(
name = "mac_chrome",
url = "https://storage.googleapis.com/chrome-for-testing-public/146.0.7680.165/mac-arm64/chrome-mac-arm64.zip",
sha256 = "41f692f646dd3ce07ed377d71a15f90e8f2f9a3e3af383c5dde0718f034d6b52",
strip_prefix = "chrome-mac-arm64",
patch_cmds = [
"mv 'Google Chrome for Testing.app' Chrome.app",
"mv 'Chrome.app/Contents/MacOS/Google Chrome for Testing' Chrome.app/Contents/MacOS/Chrome",
],
build_file_content = """
if chrome_arch == "x64":
http_archive(
name = "mac_chrome",
url = "https://storage.googleapis.com/chrome-for-testing-public/146.0.7680.165/mac-x64/chrome-mac-x64.zip",
sha256 = "266fe088699a2bdaec210ecb5a4951d9f6047ab5a54d58b220d9602ca0b00a5f",
strip_prefix = "chrome-mac-x64",
patch_cmds = [
"mv 'Google Chrome for Testing.app' Chrome.app",
"mv 'Chrome.app/Contents/MacOS/Google Chrome for Testing' Chrome.app/Contents/MacOS/Chrome",
],
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])

Expand All @@ -238,7 +244,29 @@ js_library(
data = glob(["Chrome.app/**/*"]),
)
""",
)
)
else:
http_archive(
name = "mac_chrome",
url = "https://storage.googleapis.com/chrome-for-testing-public/146.0.7680.165/mac-arm64/chrome-mac-arm64.zip",
sha256 = "41f692f646dd3ce07ed377d71a15f90e8f2f9a3e3af383c5dde0718f034d6b52",
strip_prefix = "chrome-mac-arm64",
patch_cmds = [
"mv 'Google Chrome for Testing.app' Chrome.app",
"mv 'Chrome.app/Contents/MacOS/Google Chrome for Testing' Chrome.app/Contents/MacOS/Chrome",
],
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])

exports_files(["Chrome.app"])

js_library(
name = "chrome-js",
data = glob(["Chrome.app/**/*"]),
)
""",
)
http_archive(
name = "linux_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/146.0.7680.165/linux64/chromedriver-linux64.zip",
Expand All @@ -257,12 +285,13 @@ js_library(
""",
)

http_archive(
name = "mac_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/146.0.7680.165/mac-arm64/chromedriver-mac-arm64.zip",
sha256 = "43115f874f6590de5525eadf1eb441a02cb1cb907f2a3973f820ca808425d8d6",
strip_prefix = "chromedriver-mac-arm64",
build_file_content = """
if chrome_arch == "x64":
http_archive(
name = "mac_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/146.0.7680.165/mac-x64/chromedriver-mac-x64.zip",
sha256 = "691fa9d77ec37cf6f7b0d10331dbe433a41e9f7fad810996956423dd820369e3",
strip_prefix = "chromedriver-mac-x64",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])

Expand All @@ -273,7 +302,25 @@ js_library(
data = ["chromedriver"],
)
""",
)
)
else:
http_archive(
name = "mac_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/146.0.7680.165/mac-arm64/chromedriver-mac-arm64.zip",
sha256 = "43115f874f6590de5525eadf1eb441a02cb1cb907f2a3973f820ca808425d8d6",
strip_prefix = "chromedriver-mac-arm64",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])

exports_files(["chromedriver"])

js_library(
name = "chromedriver-js",
data = ["chromedriver"],
)
""",
)

http_archive(
name = "linux_beta_chrome",
Expand All @@ -296,16 +343,17 @@ js_library(
)
""",
)
http_archive(
name = "mac_beta_chrome",
url = "https://storage.googleapis.com/chrome-for-testing-public/147.0.7727.24/mac-arm64/chrome-mac-arm64.zip",
sha256 = "37da2605bae9b5d349546eb9b6700ee6af27aa9b643ee4c58d7bc22d1209a03f",
strip_prefix = "chrome-mac-arm64",
patch_cmds = [
"mv 'Google Chrome for Testing.app' Chrome.app",
"mv 'Chrome.app/Contents/MacOS/Google Chrome for Testing' Chrome.app/Contents/MacOS/Chrome",
],
build_file_content = """
if chrome_arch == "x64":
http_archive(
name = "mac_beta_chrome",
url = "https://storage.googleapis.com/chrome-for-testing-public/147.0.7727.24/mac-x64/chrome-mac-x64.zip",
sha256 = "02a0a7ff74a3994fb6bdb6391c1f20319b102af569828f15248d1398c3e414a2",
strip_prefix = "chrome-mac-x64",
patch_cmds = [
"mv 'Google Chrome for Testing.app' Chrome.app",
"mv 'Chrome.app/Contents/MacOS/Google Chrome for Testing' Chrome.app/Contents/MacOS/Chrome",
],
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])

Expand All @@ -316,7 +364,29 @@ js_library(
data = glob(["Chrome.app/**/*"]),
)
""",
)
)
else:
http_archive(
name = "mac_beta_chrome",
url = "https://storage.googleapis.com/chrome-for-testing-public/147.0.7727.24/mac-arm64/chrome-mac-arm64.zip",
sha256 = "37da2605bae9b5d349546eb9b6700ee6af27aa9b643ee4c58d7bc22d1209a03f",
strip_prefix = "chrome-mac-arm64",
patch_cmds = [
"mv 'Google Chrome for Testing.app' Chrome.app",
"mv 'Chrome.app/Contents/MacOS/Google Chrome for Testing' Chrome.app/Contents/MacOS/Chrome",
],
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])

exports_files(["Chrome.app"])

js_library(
name = "chrome-js",
data = glob(["Chrome.app/**/*"]),
)
""",
)
http_archive(
name = "linux_beta_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/147.0.7727.24/linux64/chromedriver-linux64.zip",
Expand All @@ -335,12 +405,13 @@ js_library(
""",
)

http_archive(
name = "mac_beta_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/147.0.7727.24/mac-arm64/chromedriver-mac-arm64.zip",
sha256 = "76cc4a27016387fbe8fa0905bd73e1c715905b6f1240053103299ee293cfde9c",
strip_prefix = "chromedriver-mac-arm64",
build_file_content = """
if chrome_arch == "x64":
http_archive(
name = "mac_beta_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/147.0.7727.24/mac-x64/chromedriver-mac-x64.zip",
sha256 = "c1f1520e8ea57b8c49f18310448929ca4503df596df76415a748ddeeaabe6d7d",
strip_prefix = "chromedriver-mac-x64",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])

Expand All @@ -351,10 +422,28 @@ js_library(
data = ["chromedriver"],
)
""",
)
)
else:
http_archive(
name = "mac_beta_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/147.0.7727.24/mac-arm64/chromedriver-mac-arm64.zip",
sha256 = "76cc4a27016387fbe8fa0905bd73e1c715905b6f1240053103299ee293cfde9c",
strip_prefix = "chromedriver-mac-arm64",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])

exports_files(["chromedriver"])

js_library(
name = "chromedriver-js",
data = ["chromedriver"],
)
""",
)

def _pin_browsers_extension_impl(_ctx):
pin_browsers()
pin_browsers(arch = _ctx.os.arch)

pin_browsers_extension = module_extension(
implementation = _pin_browsers_extension_impl,
Expand Down
Loading