|
| 1 | +"""Depednencies for `wasm_bindgen_test` rules""" |
| 2 | + |
| 3 | +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") |
| 4 | +load("//private/webdrivers:webdriver_utils.bzl", "build_file_repository", "webdriver_repository") |
| 5 | + |
| 6 | +# A snippet from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json |
| 7 | +# but modified to included `integrity` |
| 8 | +CHROME_DATA = { |
| 9 | + "downloads": { |
| 10 | + "chrome": [ |
| 11 | + { |
| 12 | + "integrity": "sha256-fm2efJlMZRGqLP7dgfMqhz6CKY/qVJrO6lfDZLLhA/k=", |
| 13 | + "platform": "linux64", |
| 14 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/linux64/chrome-linux64.zip", |
| 15 | + }, |
| 16 | + { |
| 17 | + "integrity": "sha256-uROIJ56CjR6ZyjiwPCAB7n21aSoA3Wi6TluPnAch8YM=", |
| 18 | + "platform": "mac-arm64", |
| 19 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/mac-arm64/chrome-mac-arm64.zip", |
| 20 | + }, |
| 21 | + { |
| 22 | + "integrity": "sha256-e9rzOOF8n43J5IpwvBQjnKyGc26QnBcTygpALtGDCK0=", |
| 23 | + "platform": "mac-x64", |
| 24 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/mac-x64/chrome-mac-x64.zip", |
| 25 | + }, |
| 26 | + { |
| 27 | + "integrity": "sha256-tp67N9Iy0WPqRBqCPG66ow/TTEcBuSuS/XsJwms253Q=", |
| 28 | + "platform": "win32", |
| 29 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/win32/chrome-win32.zip", |
| 30 | + }, |
| 31 | + { |
| 32 | + "integrity": "sha256-GhiJkB9FcXIxdIqWf2gsJh0jYLWzx2V2r3wWLRcwSSk=", |
| 33 | + "platform": "win64", |
| 34 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/win64/chrome-win64.zip", |
| 35 | + }, |
| 36 | + ], |
| 37 | + "chrome-headless-shell": [ |
| 38 | + { |
| 39 | + "integrity": "sha256-ZfahmT+jnxYV7e6e62Fj5W32FPJryOgAmhVDjNDp0Hk=", |
| 40 | + "platform": "linux64", |
| 41 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/linux64/chrome-headless-shell-linux64.zip", |
| 42 | + }, |
| 43 | + { |
| 44 | + "integrity": "sha256-Rfdu/e4raKeTCvh5FgK4H6rrAG14KRWK4fAzoOrqUBQ=", |
| 45 | + "platform": "mac-arm64", |
| 46 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/mac-arm64/chrome-headless-shell-mac-arm64.zip", |
| 47 | + }, |
| 48 | + { |
| 49 | + "integrity": "sha256-TWHvAfeYDKifKQD95rSantkCtpR3vLKraP41VnlGFmA=", |
| 50 | + "platform": "mac-x64", |
| 51 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/mac-x64/chrome-headless-shell-mac-x64.zip", |
| 52 | + }, |
| 53 | + { |
| 54 | + "integrity": "sha256-KuWJUK12L+K4sQwRRecq0qrqz4CLDqPkN3c31vpMLXI=", |
| 55 | + "platform": "win32", |
| 56 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/win32/chrome-headless-shell-win32.zip", |
| 57 | + }, |
| 58 | + { |
| 59 | + "integrity": "sha256-9ZoAYNyG2yu/QQLNqVjbBMjrj5WtaSm62Ydp8u4BXqk=", |
| 60 | + "platform": "win64", |
| 61 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/win64/chrome-headless-shell-win64.zip", |
| 62 | + }, |
| 63 | + ], |
| 64 | + "chromedriver": [ |
| 65 | + { |
| 66 | + "integrity": "sha256-FB1JYbgukDV7/PngapsD7b09XcqO5h01VFtTGPq6has=", |
| 67 | + "platform": "linux64", |
| 68 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/linux64/chromedriver-linux64.zip", |
| 69 | + }, |
| 70 | + { |
| 71 | + "integrity": "sha256-ZATjVJV7PsswgvgdT7zQeeC6pgflX6qcrQmHxwY+/xE=", |
| 72 | + "platform": "mac-arm64", |
| 73 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/mac-arm64/chromedriver-mac-arm64.zip", |
| 74 | + }, |
| 75 | + { |
| 76 | + "integrity": "sha256-8IsY85x99wA1VtRY5K1vB9hB0tJtzPgfNJaLYEUk7mw=", |
| 77 | + "platform": "mac-x64", |
| 78 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/mac-x64/chromedriver-mac-x64.zip", |
| 79 | + }, |
| 80 | + { |
| 81 | + "integrity": "sha256-HYamG2SqvfrCLbxaQIc8CI5x1KnZ/XkJ0Y3RKwmFaDo=", |
| 82 | + "platform": "win32", |
| 83 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/win32/chromedriver-win32.zip", |
| 84 | + }, |
| 85 | + { |
| 86 | + "integrity": "sha256-IxvDZCKGBTZkYDT/M7XQOfI/DaQxA9yYPJ0PB5XniVQ=", |
| 87 | + "platform": "win64", |
| 88 | + "url": "https://storage.googleapis.com/chrome-for-testing-public/136.0.7055.0/win64/chromedriver-win64.zip", |
| 89 | + }, |
| 90 | + ], |
| 91 | + }, |
| 92 | + "revision": "1429446", |
| 93 | + "version": "136.0.7055.0", |
| 94 | +} |
| 95 | + |
| 96 | +def chrome_deps(): |
| 97 | + """Download chromedriver dependencies |
| 98 | +
|
| 99 | + Returns: |
| 100 | + A list of repositories crated |
| 101 | + """ |
| 102 | + |
| 103 | + direct_deps = [] |
| 104 | + for data in CHROME_DATA["downloads"]["chromedriver"]: |
| 105 | + platform = data["platform"] |
| 106 | + name = "chromedriver_{}".format(platform.replace("-", "_")) |
| 107 | + direct_deps.append(struct(repo = name)) |
| 108 | + tool = "chromedriver" |
| 109 | + if platform.startswith("win"): |
| 110 | + tool = "chromedriver.exe" |
| 111 | + maybe( |
| 112 | + webdriver_repository, |
| 113 | + name = name, |
| 114 | + original_name = name, |
| 115 | + urls = [data["url"]], |
| 116 | + strip_prefix = "chromedriver-{}".format(platform), |
| 117 | + integrity = data.get("integrity", ""), |
| 118 | + tool = tool, |
| 119 | + ) |
| 120 | + |
| 121 | + for data in CHROME_DATA["downloads"]["chrome-headless-shell"]: |
| 122 | + platform = data["platform"] |
| 123 | + name = "chrome_headless_shell_{}".format(platform.replace("-", "_")) |
| 124 | + direct_deps.append(struct(repo = name)) |
| 125 | + tool = "chrome-headless-shell" |
| 126 | + if platform.startswith("win"): |
| 127 | + tool = "chrome-headless-shell.exe" |
| 128 | + maybe( |
| 129 | + webdriver_repository, |
| 130 | + name = name, |
| 131 | + original_name = name, |
| 132 | + urls = [data["url"]], |
| 133 | + strip_prefix = "chrome-headless-shell-{}".format(platform), |
| 134 | + integrity = data.get("integrity", ""), |
| 135 | + tool = tool, |
| 136 | + ) |
| 137 | + |
| 138 | + for data in CHROME_DATA["downloads"]["chrome"]: |
| 139 | + platform = data["platform"] |
| 140 | + name = "chrome_{}".format(platform.replace("-", "_")) |
| 141 | + direct_deps.append(struct(repo = name)) |
| 142 | + |
| 143 | + if platform.startswith("win"): |
| 144 | + tool = "chrome.exe" |
| 145 | + elif platform.startswith("mac"): |
| 146 | + tool = "Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing" |
| 147 | + else: |
| 148 | + tool = "chrome" |
| 149 | + maybe( |
| 150 | + webdriver_repository, |
| 151 | + name = name, |
| 152 | + original_name = name, |
| 153 | + urls = [data["url"]], |
| 154 | + strip_prefix = "chrome-{}".format(platform), |
| 155 | + integrity = data.get("integrity", ""), |
| 156 | + tool = tool, |
| 157 | + ) |
| 158 | + |
| 159 | + direct_deps.append(struct(repo = "chromedriver")) |
| 160 | + maybe( |
| 161 | + build_file_repository, |
| 162 | + name = "chromedriver", |
| 163 | + build_file = Label("//private/webdrivers/chrome:BUILD.chromedriver.bazel"), |
| 164 | + ) |
| 165 | + |
| 166 | + direct_deps.append(struct(repo = "chrome_headless_shell")) |
| 167 | + maybe( |
| 168 | + build_file_repository, |
| 169 | + name = "chrome_headless_shell", |
| 170 | + build_file = Label("//private/webdrivers/chrome:BUILD.chrome_headless_shell.bazel"), |
| 171 | + ) |
| 172 | + |
| 173 | + direct_deps.append(struct(repo = "chrome")) |
| 174 | + maybe( |
| 175 | + build_file_repository, |
| 176 | + name = "chrome", |
| 177 | + build_file = Label("//private/webdrivers/chrome:BUILD.chrome.bazel"), |
| 178 | + ) |
| 179 | + |
| 180 | + return direct_deps |
0 commit comments