diff --git a/MODULE.bazel b/MODULE.bazel index fa2b2ef0a3b22..0512dc7148fff 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,6 +5,7 @@ bazel_dep(name = "aspect_rules_esbuild", version = "0.18.0") bazel_dep(name = "aspect_rules_js", version = "1.35.0") bazel_dep(name = "aspect_rules_ts", version = "2.1.0") bazel_dep(name = "bazel_features", version = "1.9.0") +bazel_dep(name = "bazel_skylib", version = "1.5.0") bazel_dep(name = "buildifier_prebuilt", version = "6.4.0") bazel_dep(name = "contrib_rules_jvm", version = "0.24.0") bazel_dep(name = "platforms", version = "0.0.8") @@ -327,4 +328,31 @@ crate.from_cargo( use_repo(crate, "crates") selenium_manager_artifacts = use_extension("//common:selenium_manager.bzl", "selenium_manager_artifacts") -use_repo(selenium_manager_artifacts, "download_sm_linux", "download_sm_macos", "download_sm_windows") +use_repo( + selenium_manager_artifacts, + "download_sm_linux", + "download_sm_macos", + "download_sm_windows", +) + +pin_browsers_extension = use_extension("//common:repositories.bzl", "pin_browsers_extension") +use_repo( + pin_browsers_extension, + "linux_firefox", + "mac_firefox", + "linux_beta_firefox", + "mac_beta_firefox", + "linux_geckodriver", + "mac_geckodriver", + "linux_edge", + "mac_edge", + "linux_edgedriver", + "mac_edgedriver", + "linux_chrome", + "mac_chrome", + "linux_chromedriver", + "mac_chromedriver", +) + +local_drivers = use_repo_rule("//common/private:drivers.bzl", "local_drivers") +local_drivers(name = "local_drivers") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 21b140207aee4..ab40a2bcb7097 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,6 +1,6 @@ { "lockFileVersion": 6, - "moduleFileHash": "5033931fac34032b67be998a839cabd443081a8434d3d754633f12717453ad77", + "moduleFileHash": "2c27cdea1dfa8abf9ac2025db3c201b35029e652b5f70761ff54c4ba9a6e9622", "flags": { "cmdRegistries": [ "https://bcr.bazel.build/" @@ -806,6 +806,66 @@ "tags": [], "hasDevUseExtension": false, "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@selenium//common:repositories.bzl", + "extensionName": "pin_browsers_extension", + "usingModule": "", + "location": { + "file": "@@//:MODULE.bazel", + "line": 339, + "column": 39 + }, + "imports": { + "linux_firefox": "linux_firefox", + "mac_firefox": "mac_firefox", + "linux_beta_firefox": "linux_beta_firefox", + "mac_beta_firefox": "mac_beta_firefox", + "linux_geckodriver": "linux_geckodriver", + "mac_geckodriver": "mac_geckodriver", + "linux_edge": "linux_edge", + "mac_edge": "mac_edge", + "linux_edgedriver": "linux_edgedriver", + "mac_edgedriver": "mac_edgedriver", + "linux_chrome": "linux_chrome", + "mac_chrome": "mac_chrome", + "linux_chromedriver": "linux_chromedriver", + "mac_chromedriver": "mac_chromedriver" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "//:MODULE.bazel", + "extensionName": "_repo_rules", + "usingModule": "", + "location": { + "file": "@@//:MODULE.bazel", + "line": 0, + "column": 0 + }, + "imports": { + "local_drivers": "local_drivers" + }, + "devImports": [], + "tags": [ + { + "tagName": "//common/private:drivers.bzl%local_drivers", + "attributeValues": { + "name": "local_drivers" + }, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 359, + "column": 14 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true } ], "deps": { @@ -814,6 +874,7 @@ "aspect_rules_js": "aspect_rules_js@1.35.0", "aspect_rules_ts": "aspect_rules_ts@2.1.0", "bazel_features": "bazel_features@1.9.0", + "bazel_skylib": "bazel_skylib@1.5.0", "buildifier_prebuilt": "buildifier_prebuilt@6.4.0", "contrib_rules_jvm": "contrib_rules_jvm@0.24.0", "platforms": "platforms@0.0.8", @@ -1132,6 +1193,36 @@ } } }, + "bazel_skylib@1.5.0": { + "name": "bazel_skylib", + "version": "1.5.0", + "key": "bazel_skylib@1.5.0", + "repoName": "bazel_skylib", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "//toolchains/unittest:cmd_toolchain", + "//toolchains/unittest:bash_toolchain" + ], + "extensionUsages": [], + "deps": { + "platforms": "platforms@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz" + ], + "integrity": "sha256-zVWgYudjuTSZIfD124w5MyiNyLpPdt2UFqrGis7jy5Q=", + "strip_prefix": "", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, "buildifier_prebuilt@6.4.0": { "name": "buildifier_prebuilt", "version": "6.4.0", @@ -2819,36 +2910,6 @@ "bazel_tools": "bazel_tools@_" } }, - "bazel_skylib@1.5.0": { - "name": "bazel_skylib", - "version": "1.5.0", - "key": "bazel_skylib@1.5.0", - "repoName": "bazel_skylib", - "executionPlatformsToRegister": [], - "toolchainsToRegister": [ - "//toolchains/unittest:cmd_toolchain", - "//toolchains/unittest:bash_toolchain" - ], - "extensionUsages": [], - "deps": { - "platforms": "platforms@0.0.8", - "bazel_tools": "bazel_tools@_", - "local_config_platform": "local_config_platform@_" - }, - "repoSpec": { - "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", - "ruleClassName": "http_archive", - "attributes": { - "urls": [ - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz" - ], - "integrity": "sha256-zVWgYudjuTSZIfD124w5MyiNyLpPdt2UFqrGis7jy5Q=", - "strip_prefix": "", - "remote_patches": {}, - "remote_patch_strip": 0 - } - } - }, "stardoc@0.5.6": { "name": "stardoc", "version": "0.5.6", @@ -3847,6 +3908,164 @@ } }, "moduleExtensions": { + "//common:repositories.bzl%pin_browsers_extension": { + "general": { + "bzlTransitiveDigest": "tHosGh8SYCIDfZiHs/NMTUHi7Z9rUOw4NNR9wblyLm4=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "local_drivers": { + "bzlFile": "@@//common/private:drivers.bzl", + "ruleClassName": "local_drivers", + "attributes": {} + }, + "mac_chromedriver": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.58/mac-x64/chromedriver-mac-x64.zip", + "sha256": "c912db7b7c65d0bfcf7d17150782c0e89783bcba60521b4a66201fc81daffd91", + "strip_prefix": "chromedriver-mac-x64", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"chromedriver\"])\n\njs_library(\n name = \"chromedriver-js\",\n data = [\"chromedriver\"],\n)\n" + } + }, + "linux_edgedriver": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://msedgedriver.azureedge.net/122.0.2365.92/edgedriver_linux64.zip", + "sha256": "d3b45a768e8ff7c9665c657fe121d1e90e8b6d224e3a705c7120d302a00271ad", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"msedgedriver\"])\n\njs_library(\n name = \"msedgedriver-js\",\n data = [\"msedgedriver\"],\n)\n" + } + }, + "mac_edgedriver": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://msedgedriver.azureedge.net/122.0.2365.92/edgedriver_mac64.zip", + "sha256": "5ad0a70fcf89b9ef8e9b22cba5582c24f87790ff064e2154562e7239b62ebab6", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"msedgedriver\"])\n\njs_library(\n name = \"msedgedriver-js\",\n data = [\"msedgedriver\"],\n)\n" + } + }, + "mac_firefox": { + "bzlFile": "@@//common/private:dmg_archive.bzl", + "ruleClassName": "dmg_archive", + "attributes": { + "url": "https://ftp.mozilla.org/pub/firefox/releases/124.0.1/mac/en-US/Firefox%20124.0.1.dmg", + "sha256": "b7b260287296cf65193e76c20488fa75f98ff858ea1c2be4337ce5c1226ebcfa", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"Firefox.app\"])\n\njs_library(\n name = \"firefox-js\",\n data = glob([\"Firefox.app/**/*\"]),\n)\n" + } + }, + "mac_geckodriver": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-macos.tar.gz", + "sha256": "9cec1546585b532959782c8220599aa97c1f99265bb2d75ad00cd56ef98f650c", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"geckodriver\"])\n\njs_library(\n name = \"geckodriver-js\",\n data = [\"geckodriver\"],\n)\n" + } + }, + "linux_beta_firefox": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://ftp.mozilla.org/pub/firefox/releases/125.0b3/linux-x86_64/en-US/firefox-125.0b3.tar.bz2", + "sha256": "6cdebd362dbfbf207bad3d82e529f570d7785e5889420f1645c47773107c299f", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nfilegroup(\n name = \"files\",\n srcs = glob([\"**/*\"]),\n)\n\nexports_files([\"firefox/firefox\"])\n\njs_library(\n name = \"firefox-js\",\n data = [\":files\"],\n)\n" + } + }, + "linux_firefox": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://ftp.mozilla.org/pub/firefox/releases/124.0.1/linux-x86_64/en-US/firefox-124.0.1.tar.bz2", + "sha256": "b419cb0a10f6f601b1066d75f57b10e378f56b961be8c9dc1c7f73b869ecf82d", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nfilegroup(\n name = \"files\",\n srcs = glob([\"**/*\"]),\n)\n\nexports_files([\"firefox/firefox\"])\n\njs_library(\n name = \"firefox-js\",\n data = [\":files\"],\n)\n" + } + }, + "linux_chrome": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.58/linux64/chrome-linux64.zip", + "sha256": "b020645b262a85d2cf9bc1e7be139afa175e6b7c18d38525cc4122d5ddf89771", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nfilegroup(\n name = \"files\",\n srcs = glob([\"**/*\"]),\n)\n\nexports_files([\"chrome-linux64/chrome\"])\n\njs_library(\n name = \"chrome-js\",\n data = [\":files\"],\n)\n" + } + }, + "mac_beta_firefox": { + "bzlFile": "@@//common/private:dmg_archive.bzl", + "ruleClassName": "dmg_archive", + "attributes": { + "url": "https://ftp.mozilla.org/pub/firefox/releases/125.0b3/mac/en-US/Firefox%20125.0b3.dmg", + "sha256": "16f3f7e66fd46fede4545312b8c776576cc4935e4a41ce27527252ec5ab0a18c", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"Firefox.app\"])\n\njs_library(\n name = \"firefox-js\",\n data = glob([\"Firefox.app/**/*\"]),\n)\n" + } + }, + "linux_geckodriver": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz", + "sha256": "79b2e77edd02c0ec890395140d7cdc04a7ff0ec64503e62a0b74f88674ef1313", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"geckodriver\"])\n\njs_library(\n name = \"geckodriver-js\",\n data = [\"geckodriver\"],\n)\n" + } + }, + "mac_edge": { + "bzlFile": "@@//common/private:pkg_archive.bzl", + "ruleClassName": "pkg_archive", + "attributes": { + "url": "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/61b13da3-c921-482a-9166-743689310b71/MicrosoftEdge-122.0.2365.92.pkg", + "sha256": "304243a7ef631781b707c0d9cb8fd35e718cebad91c29078e389bb4e813afef9", + "move": { + "MicrosoftEdge-122.0.2365.92.pkg/Payload/Microsoft Edge.app": "Edge.app" + }, + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"Edge.app\"])\n\njs_library(\n name = \"edge-js\",\n data = glob([\"Edge.app/**/*\"]),\n)\n" + } + }, + "mac_chrome": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.58/mac-x64/chrome-mac-x64.zip", + "sha256": "5ac1cf013fa9f27b56d8671ae41b09f31011ef7fd23879d80a4d9e94d0c6d0c0", + "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": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"Chrome.app\"])\n\njs_library(\n name = \"chrome-js\",\n data = glob([\"Chrome.app/**/*\"]),\n)\n" + } + }, + "linux_chromedriver": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "url": "https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.58/linux64/chromedriver-linux64.zip", + "sha256": "accdaeb00d330d9d5a5ef91bbe6fa5d316a5562109231bbc65866fa1390d8a2b", + "strip_prefix": "chromedriver-linux64", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"chromedriver\"])\n\njs_library(\n name = \"chromedriver-js\",\n data = [\"chromedriver\"],\n)\n" + } + }, + "linux_edge": { + "bzlFile": "@@//common/private:deb_archive.bzl", + "ruleClassName": "deb_archive", + "attributes": { + "url": "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_123.0.2420.53-1_amd64.deb", + "sha256": "ec2eb0642211a1da962a299b9d4977d933a18b3b2213753f6deded96948db6dd", + "build_file_content": "\nload(\"@aspect_rules_js//js:defs.bzl\", \"js_library\")\npackage(default_visibility = [\"//visibility:public\"])\n\nfilegroup(\n name = \"files\",\n srcs = glob([\"**/*\"]),\n)\n\nexports_files([\"opt/microsoft/msedge/microsoft-edge\"])\n\njs_library(\n name = \"edge-js\",\n data = [\":files\"],\n)\n" + } + } + }, + "recordedRepoMappingEntries": [ + [ + "", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, "//common:selenium_manager.bzl%selenium_manager_artifacts": { "general": { "bzlTransitiveDigest": "Yz54SfSuut4/+OMYy+rksIRgHlNIF+uwxnKXHdyUbiM=", diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod index 8baad6369411d..4599359298530 100644 --- a/WORKSPACE.bzlmod +++ b/WORKSPACE.bzlmod @@ -24,7 +24,3 @@ load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_depende rules_closure_dependencies() rules_closure_toolchains() - -load("//common:repositories.bzl", "pin_browsers") - -pin_browsers() diff --git a/common/private/drivers.bzl b/common/private/drivers.bzl index 0d1972be5a63a..f1c81fe6fc8a2 100644 --- a/common/private/drivers.bzl +++ b/common/private/drivers.bzl @@ -28,9 +28,6 @@ def _local_drivers_impl(repository_ctx): repository_ctx.file("BUILD.bazel", "\n".join(contents)) -_local_drivers = repository_rule( +local_drivers = repository_rule( _local_drivers_impl, ) - -def local_drivers(): - _local_drivers(name = "local_drivers") diff --git a/common/repositories.bzl b/common/repositories.bzl index f0ab92261ba02..bc07fba00aba6 100644 --- a/common/repositories.bzl +++ b/common/repositories.bzl @@ -7,21 +7,26 @@ load("//common/private:drivers.bzl", "local_drivers") load("//common/private:pkg_archive.bzl", "pkg_archive") def pin_browsers(): - local_drivers() + local_drivers(name = "local_drivers") http_archive( name = "linux_firefox", url = "https://ftp.mozilla.org/pub/firefox/releases/125.0.1/linux-x86_64/en-US/firefox-125.0.1.tar.bz2", sha256 = "0f702f7690b02953e336fac27874276d9d471c9d264dc0feb7fcc6693d63bd4b", build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + filegroup( name = "files", srcs = glob(["**/*"]), - visibility = ["//visibility:public"], ) -exports_files( - ["firefox/firefox"], +exports_files(["firefox/firefox"]) + +js_library( + name = "firefox-js", + data = [":files"], ) """, ) @@ -30,7 +35,17 @@ exports_files( name = "mac_firefox", url = "https://ftp.mozilla.org/pub/firefox/releases/125.0.1/mac/en-US/Firefox%20125.0.1.dmg", sha256 = "3f431079d423e5397987a4120a63948217252426219f23348cb6b6bbded3acf3", - build_file_content = "exports_files([\"Firefox.app\"])", + build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["Firefox.app"]) + +js_library( + name = "firefox-js", + data = glob(["Firefox.app/**/*"]), +) +""", ) http_archive( @@ -38,14 +53,19 @@ exports_files( url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b2/linux-x86_64/en-US/firefox-126.0b2.tar.bz2", sha256 = "915ad101d26acf80a0ac18b4e787277b3d8c2d1371cc1796bd2cba641810390a", build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + filegroup( name = "files", srcs = glob(["**/*"]), - visibility = ["//visibility:public"], ) -exports_files( - ["firefox/firefox"], +exports_files(["firefox/firefox"]) + +js_library( + name = "firefox-js", + data = [":files"], ) """, ) @@ -54,21 +74,51 @@ exports_files( name = "mac_beta_firefox", url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b2/mac/en-US/Firefox%20126.0b2.dmg", sha256 = "d49b5260d15ee137388e1e3b4dd5a102047794ccd6ef6de62dc0a48a41bb7785", - build_file_content = "exports_files([\"Firefox.app\"])", + build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["Firefox.app"]) + +js_library( + name = "firefox-js", + data = glob(["Firefox.app/**/*"]), +) +""", ) http_archive( name = "linux_geckodriver", url = "https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz", sha256 = "79b2e77edd02c0ec890395140d7cdc04a7ff0ec64503e62a0b74f88674ef1313", - build_file_content = "exports_files([\"geckodriver\"])", + build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["geckodriver"]) + +js_library( + name = "geckodriver-js", + data = ["geckodriver"], +) +""", ) http_archive( name = "mac_geckodriver", url = "https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-macos.tar.gz", sha256 = "9cec1546585b532959782c8220599aa97c1f99265bb2d75ad00cd56ef98f650c", - build_file_content = "exports_files([\"geckodriver\"])", + build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["geckodriver"]) + +js_library( + name = "geckodriver-js", + data = ["geckodriver"], +) +""", ) pkg_archive( @@ -78,7 +128,17 @@ exports_files( move = { "MicrosoftEdge-123.0.2420.97.pkg/Payload/Microsoft Edge.app": "Edge.app", }, - build_file_content = "exports_files([\"Edge.app\"])", + build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["Edge.app"]) + +js_library( + name = "edge-js", + data = glob(["Edge.app/**/*"]), +) +""", ) deb_archive( @@ -86,14 +146,19 @@ exports_files( url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_123.0.2420.97-1_amd64.deb", sha256 = "abb3dc6e2d0942bff0bca22b82e783f5fd99eafd433280f66dc449286a83623b", build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + filegroup( name = "files", srcs = glob(["**/*"]), - visibility = ["//visibility:public"], ) -exports_files( - ["opt/microsoft/msedge/microsoft-edge"], +exports_files(["opt/microsoft/msedge/microsoft-edge"]) + +js_library( + name = "edge-js", + data = [":files"], ) """, ) @@ -102,14 +167,34 @@ exports_files( name = "linux_edgedriver", url = "https://msedgedriver.azureedge.net/123.0.2420.97/edgedriver_linux64.zip", sha256 = "5256f95f54e0f3024d4531ce421951396b035dec8473336c830fa299f31384c9", - build_file_content = "exports_files([\"msedgedriver\"])", + build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["msedgedriver"]) + +js_library( + name = "msedgedriver-js", + data = ["msedgedriver"], +) +""", ) http_archive( name = "mac_edgedriver", url = "https://msedgedriver.azureedge.net/123.0.2420.97/edgedriver_mac64.zip", sha256 = "f1e118edb4100ae542a96d1db840cb3bb5cf41f4fb0aa6af3f66b5431b99f983", - build_file_content = "exports_files([\"msedgedriver\"])", + build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["msedgedriver"]) + +js_library( + name = "msedgedriver-js", + data = ["msedgedriver"], +) +""", ) http_archive( @@ -117,14 +202,19 @@ exports_files( url = "https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.122/linux64/chrome-linux64.zip", sha256 = "97d7925c795786f235f86973d1f60a70ad9613e96b22fee084720b3c6ba0701b", build_file_content = """ +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + filegroup( name = "files", srcs = glob(["**/*"]), - visibility = ["//visibility:public"], ) -exports_files( - ["chrome-linux64/chrome"], +exports_files(["chrome-linux64/chrome"]) + +js_library( + name = "chrome-js", + data = [":files"], ) """, ) @@ -138,7 +228,17 @@ exports_files( "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 = "exports_files([\"Chrome.app\"])", + 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( @@ -146,7 +246,17 @@ exports_files( url = "https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.122/linux64/chromedriver-linux64.zip", sha256 = "8a29aadfb75c11c636b2e5bbddaea58601ee35aa2ab736c06421e440ff6ba3f6", strip_prefix = "chromedriver-linux64", - build_file_content = "exports_files([\"chromedriver\"])", + 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( @@ -154,5 +264,22 @@ exports_files( url = "https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.122/mac-x64/chromedriver-mac-x64.zip", sha256 = "3e62d5fbe14ae9a0af76134d85bd9902644bba6afe55116f37eec807289e1199", strip_prefix = "chromedriver-mac-x64", - build_file_content = "exports_files([\"chromedriver\"])", + 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_extension = module_extension( + implementation = _pin_browsers_extension_impl, +) diff --git a/scripts/pinned_browsers.py b/scripts/pinned_browsers.py index 39aad6a4c6617..924782ca1aaba 100755 --- a/scripts/pinned_browsers.py +++ b/scripts/pinned_browsers.py @@ -63,7 +63,17 @@ def chromedriver(selected_version): url = "%s", sha256 = "%s", strip_prefix = "chromedriver-linux64", - build_file_content = "exports_files([\\"chromedriver\\"])", + 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"], +) +\"\"\", ) """ % (linux, sha) @@ -79,7 +89,17 @@ def chromedriver(selected_version): url = "%s", sha256 = "%s", strip_prefix = "chromedriver-mac-x64", - build_file_content = "exports_files([\\"chromedriver\\"])", + 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"], +) +\"\"\", ) """ % (mac, sha) @@ -100,14 +120,19 @@ def chrome(selected_version): url = "%s", sha256 = "%s", build_file_content = \"\"\" +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + filegroup( name = "files", srcs = glob(["**/*"]), - visibility = ["//visibility:public"], ) -exports_files( - ["chrome-linux64/chrome"], +exports_files(["chrome-linux64/chrome"]) + +js_library( + name = "chrome-js", + data = [":files"], ) \"\"\", ) @@ -129,7 +154,17 @@ def chrome(selected_version): "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 = "exports_files([\\"Chrome.app\\"])", + 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/**/*"]), +) +\"\"\", ) """ % ( @@ -176,7 +211,17 @@ def edge(): move = { "MicrosoftEdge-%s.pkg/Payload/Microsoft Edge.app": "Edge.app", }, - build_file_content = "exports_files([\\"Edge.app\\"])", + build_file_content = \"\"\" +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["Edge.app"]) + +js_library( + name = "edge-js", + data = glob(["Edge.app/**/*"]), +) +\"\"\" ) """ % ( mac, @@ -191,14 +236,19 @@ def edge(): url = "%s", sha256 = "%s", build_file_content = \"\"\" +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + filegroup( name = "files", srcs = glob(["**/*"]), - visibility = ["//visibility:public"], ) -exports_files( - ["opt/microsoft/msedge/microsoft-edge"], +exports_files(["opt/microsoft/msedge/microsoft-edge"]) + +js_library( + name = "edge-js", + data = [":files"], ) \"\"\", ) @@ -225,7 +275,17 @@ def edgedriver(): name = "linux_edgedriver", url = "%s", sha256 = "%s", - build_file_content = "exports_files([\\"msedgedriver\\"])", + build_file_content = \"\"\" +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["msedgedriver"]) + +js_library( + name = "msedgedriver-js", + data = ["msedgedriver"], +) +\"\"\", ) """ % (linux, sha) @@ -240,7 +300,17 @@ def edgedriver(): name = "mac_edgedriver", url = "%s", sha256 = "%s", - build_file_content = "exports_files([\\"msedgedriver\\"])", + build_file_content = \"\"\" +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["msedgedriver"]) + +js_library( + name = "msedgedriver-js", + data = ["msedgedriver"], +) +\"\"\", ) """ % (mac, sha) @@ -262,7 +332,17 @@ def geckodriver(): name = "linux_geckodriver", url = "%s", sha256 = "%s", - build_file_content = "exports_files([\\"geckodriver\\"])", + build_file_content = \"\"\" +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["geckodriver"]) + +js_library( + name = "geckodriver-js", + data = ["geckodriver"], +) +\"\"\", ) """ % (url, sha) @@ -278,7 +358,17 @@ def geckodriver(): name = "mac_geckodriver", url = "%s", sha256 = "%s", - build_file_content = "exports_files([\\"geckodriver\\"])", + build_file_content = \"\"\" +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["geckodriver"]) + +js_library( + name = "geckodriver-js", + data = ["geckodriver"], +) +\"\"\", ) """ % (url, sha) @@ -324,14 +414,19 @@ def print_firefox(version, workspace_name, sha_linux, sha_mac): url = "{firefox_linux(version)}", sha256 = "{sha_linux}", build_file_content = \"\"\" +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + filegroup( name = "files", srcs = glob(["**/*"]), - visibility = ["//visibility:public"], ) -exports_files( - ["firefox/firefox"], +exports_files(["firefox/firefox"]) + +js_library( + name = "firefox-js", + data = [":files"], ) \"\"\", ) @@ -345,7 +440,17 @@ def print_firefox(version, workspace_name, sha_linux, sha_mac): name = "mac_{workspace_name}firefox", url = "{firefox_mac(version)}", sha256 = "{sha_mac}", - build_file_content = "exports_files([\\"Firefox.app\\"])", + build_file_content = \"\"\" +load("@aspect_rules_js//js:defs.bzl", "js_library") +package(default_visibility = ["//visibility:public"]) + +exports_files(["Firefox.app"]) + +js_library( + name = "firefox-js", + data = glob(["Firefox.app/**/*"]), +) +\"\"\", ) """ @@ -364,7 +469,7 @@ def print_firefox(version, workspace_name, sha_linux, sha_mac): load("//common/private:pkg_archive.bzl", "pkg_archive") def pin_browsers(): - local_drivers() + local_drivers(name = "local_drivers") """ content = content + firefox() @@ -374,6 +479,14 @@ def pin_browsers(): chrome_milestone = get_chrome_milestone() content = content + chrome(chrome_milestone) content = content + chromedriver(chrome_milestone) + content += """ +def _pin_browsers_extension_impl(_ctx): + pin_browsers() + +pin_browsers_extension = module_extension( + implementation = _pin_browsers_extension_impl, +) +""" current_script_dir = Path(os.path.realpath(__file__)).parent target_file_path = current_script_dir.parent / "common/repositories.bzl"