[build] Skip macOS-only archive rules on unsupported platforms#16985
[build] Skip macOS-only archive rules on unsupported platforms#16985titusfortner merged 4 commits intotrunkfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Latest suggestions up to 3e48adb
Previous suggestions✅ Suggestions up to commit ac1095c
|
||||||||||||||||||||||||||||||
|
I'm manually kicking off a full CI test: https://github.com/SeleniumHQ/selenium/actions/runs/21271391848 |
There was a problem hiding this comment.
Pull request overview
This PR fixes Bazel query failures on non-macOS platforms by adding platform detection to macOS-specific archive rules. The issue occurred when bazel query deps() tried to resolve macOS browser download rules on Linux/Windows, causing failures because macOS-specific tools (pkgutil, hdiutil) were not available.
Changes:
- Added tool availability checks to
pkg_archiveanddmg_archiverepository rules - Repository rules now create a minimal BUILD.bazel file and return early when required tools are unavailable
- Allows cross-platform Bazel queries without failing on platform-specific repository rules
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| common/private/pkg_archive.bzl | Added pkgutil availability check, creates stub BUILD.bazel on unsupported platforms |
| common/private/dmg_archive.bzl | Added hdiutil availability check, creates stub BUILD.bazel on unsupported platforms |
|
This isn't doing what I need it to. Might have to take a different direction. |
61c89a2 to
09d19d3
Compare
add allow_empty to globs for stub builds
dd0a593 to
3e48adb
Compare
User description
When running bazel query deps(//some:test) on Linux CI, the query tries to resolve all dependencies, including browsers for non-applicable OS.
This error:
This is coming from pkg_archive and dmg_archive rules which attempt to execute
pkgutilandhdiutilrespectively, neither of which are available on Linux.💥 What does this PR do?
🔧 Implementation Notes
Verified this fixes my issue: https://github.com/SeleniumHQ/selenium/actions/runs/21306668754/job/61335755897#step:19:30
🔄 Types of changes
PR Type
Bug fix
Description
Skip macOS-only archive rules when required tools unavailable
Check for
hdiutilandpkgutilbefore executionCreate empty BUILD file and return early on unsupported platforms
Prevents bazel query failures on Linux/Windows CI environments
Diagram Walkthrough
flowchart LR A["Repository Rule Execution"] --> B{"Tool Available?"} B -->|Yes| C["Download & Extract Archive"] B -->|No| D["Create Empty BUILD.bazel"] D --> E["Return Early"]File Walkthrough
dmg_archive.bzl
Add hdiutil availability check to dmg_archivecommon/private/dmg_archive.bzl
hdiutilavailability usingrepository_ctx.which()pkg_archive.bzl
Add pkgutil availability check to pkg_archivecommon/private/pkg_archive.bzl
pkgutilavailability usingrepository_ctx.which()