Skip to content

Commit b4014e9

Browse files
gregmagolanjasonaden
authored andcommitted
build(bazel): update to latest stable chromium 74 on osx and linux for karma under bazel (angular#30502)
We were on 69 for both of these platforms which is fairly old. This update also requires a temporary patch to the @bazel/karma npm package to disable chrome sandboxing on OSX as it is broken under Bazel as of chromium 73. Windows is still on Chromium 66 but updating this will require upstream changes to rules_webtesting as the archive name & executable name has changed as of 72 for Windows and hard-coded paths in rules_webtesting break things. PR Close angular#30502
1 parent 73e3f56 commit b4014e9

File tree

3 files changed

+138
-17
lines changed

3 files changed

+138
-17
lines changed

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ web_test_repositories()
9696

9797
# Temporary work-around for https://github.com/angular/angular/issues/28681
9898
# TODO(gregmagolan): go back to @io_bazel_rules_webtesting browser_repositories
99-
load("@npm_bazel_karma//:browser_repositories.bzl", "browser_repositories")
99+
load("//:browser_repositories.bzl", "browser_repositories")
100100

101101
browser_repositories()
102102

browser_repositories.bzl

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Copyright 2018 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Pinned browser versions for karma testing
16+
"""
17+
18+
load("@io_bazel_rules_webtesting//web/internal:platform_http_file.bzl", "platform_http_file")
19+
20+
def browser_repositories():
21+
"""Load pinned rules_webtesting browser versions."""
22+
23+
platform_http_file(
24+
name = "org_chromium_chromium",
25+
amd64_sha256 =
26+
"eb6754c7918da5eab42a42bbda7efdf7f1661eaa3802b8940841f0c2c312299f",
27+
amd64_urls = [
28+
# Chromium 74.0.3729.0 (2019-03-08 snaphot 638880)
29+
# https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/638880/
30+
# Current linux stable as of 2019-05-15
31+
# https://www.chromium.org/developers/calendar
32+
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/638880/chrome-linux.zip",
33+
],
34+
licenses = ["notice"], # BSD 3-clause (maybe more?)
35+
macos_sha256 =
36+
"c48bdffac6a91c85c17a848012b1a45fbf36e3a2d4aaac5b6ded8ac65b1d96e3",
37+
macos_urls = [
38+
# Chromium 74.0.3729.0 (2019-03-08 snaphot 638880)
39+
# https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/638880/
40+
# Current mac stable as of 2019-05-15
41+
# https://www.chromium.org/developers/calendar
42+
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/638880/chrome-mac.zip",
43+
],
44+
windows_sha256 =
45+
"d1bb728118c12ea436d8ea07dba980789e7d860aa664dd1fad78bc20e8d9391c",
46+
windows_urls = [
47+
# Chromium 66.0.3359.0 (2018-03-01 snaphot 540270)
48+
# https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win_x64/612439/
49+
# NOTE: There is an issue with chromium 68-71 with Windows: https://bugs.chromium.org/p/chromium/issues/detail?id=540270
50+
# and pinning to 72 is not possible as the archive name has changed to chrome-win.zip which breaks
51+
# as the executable path the hard-coded in rules_webtesting and includes the archive name.
52+
"https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/540270/chrome-win32.zip",
53+
],
54+
)
55+
56+
platform_http_file(
57+
name = "org_chromium_chromedriver",
58+
amd64_sha256 =
59+
"ec9dbe021338f0befaecca702abc576cb7cc31a2f5a852c2c41e94721af5d3ad",
60+
amd64_urls = [
61+
# ChromeDriver 74.0.3729.6 supports Chrome 74
62+
# http://chromedriver.chromium.org/downloads
63+
"https://chromedriver.storage.googleapis.com/74.0.3729.6/chromedriver_linux64.zip",
64+
],
65+
licenses = ["reciprocal"], # BSD 3-clause, ICU, MPL 1.1, libpng (BSD/MIT-like), Academic Free License v. 2.0, BSD 2-clause, MIT
66+
macos_sha256 =
67+
"b4b73681404d231d81a9b7ab9d4f0cb090f3e69240296eca2eb46e2629519152",
68+
macos_urls = [
69+
# ChromeDriver 74.0.3729.6 supports Chrome 74
70+
# http://chromedriver.chromium.org/downloads
71+
"https://chromedriver.storage.googleapis.com/74.0.3729.6/chromedriver_mac64.zip",
72+
],
73+
windows_sha256 =
74+
"a8fa028acebef7b931ef9cb093f02865f9f7495e49351f556e919f7be77f072e",
75+
windows_urls = [
76+
# ChromeDriver 2.38 supports Chrome v65-67
77+
# http://chromedriver.chromium.org/downloads
78+
"https://chromedriver.storage.googleapis.com/2.38/chromedriver_win32.zip",
79+
],
80+
)
81+
82+
platform_http_file(
83+
name = "org_mozilla_firefox",
84+
amd64_sha256 =
85+
"3a729ddcb1e0f5d63933177a35177ac6172f12edbf9fbbbf45305f49333608de",
86+
amd64_urls = [
87+
"https://mirror.bazel.build/ftp.mozilla.org/pub/firefox/releases/61.0.2/linux-x86_64/en-US/firefox-61.0.2.tar.bz2",
88+
"https://ftp.mozilla.org/pub/firefox/releases/61.0.2/linux-x86_64/en-US/firefox-61.0.2.tar.bz2",
89+
],
90+
licenses = ["reciprocal"], # MPL 2.0
91+
macos_sha256 =
92+
"bf23f659ae34832605dd0576affcca060d1077b7bf7395bc9874f62b84936dc5",
93+
macos_urls = [
94+
"https://mirror.bazel.build/ftp.mozilla.org/pub/firefox/releases/61.0.2/mac/en-US/Firefox%2061.0.2.dmg",
95+
"https://ftp.mozilla.org/pub/firefox/releases/61.0.2/mac/en-US/Firefox%2061.0.2.dmg",
96+
],
97+
)
98+
99+
platform_http_file(
100+
name = "org_mozilla_geckodriver",
101+
amd64_sha256 =
102+
"c9ae92348cf00aa719be6337a608fae8304691a95668e8e338d92623ba9e0ec6",
103+
amd64_urls = [
104+
"https://mirror.bazel.build/github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-linux64.tar.gz",
105+
"https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-linux64.tar.gz",
106+
],
107+
licenses = ["reciprocal"], # MPL 2.0
108+
macos_sha256 =
109+
"ce4a3e9d706db94e8760988de1ad562630412fa8cf898819572522be584f01ce",
110+
macos_urls = [
111+
"https://mirror.bazel.build/github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-macos.tar.gz",
112+
"https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-macos.tar.gz",
113+
],
114+
)

tools/postinstall-patches.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,28 @@ const log = console.log;
2727
// COMMENTED OUT BECAUSE WE CURRENTLY REQUIRE NO PATCHES
2828
// UNCOMMENT TO REENABLE PATCHING AND LOG OUTPUT
2929
//
30-
// log('===== about to run the postinstall-patches.js script =====');
31-
// // fail on first error
32-
// set('-e');
33-
// // print commands as being executed
34-
// set('-v');
35-
// // jump to project root
36-
// cd(path.join(__dirname, '../'));
30+
log('===== about to run the postinstall-patches.js script =====');
31+
// fail on first error
32+
set('-e');
33+
// print commands as being executed
34+
set('-v');
35+
// jump to project root
36+
cd(path.join(__dirname, '../'));
3737

38-
// /* EXAMPLE PATCH:
39-
// // https://github.com/ReactiveX/rxjs/pull/3302
40-
// // make node_modules/rxjs compilable with Typescript 2.7
41-
// // remove when we update to rxjs v6
42-
// log('\n# patch: reactivex/rxjs#3302 make node_modules/rxjs compilable with Typescript 2.7');
43-
// sed('-i', '(\'response\' in xhr)', '(\'response\' in (xhr as any))',
44-
// 'node_modules/rxjs/src/observable/dom/AjaxObservable.ts');
45-
// */
38+
/* EXAMPLE PATCH:
39+
// https://github.com/ReactiveX/rxjs/pull/3302
40+
// make node_modules/rxjs compilable with Typescript 2.7
41+
// remove when we update to rxjs v6
42+
log('\n# patch: reactivex/rxjs#3302 make node_modules/rxjs compilable with Typescript 2.7');
43+
sed('-i', '(\'response\' in xhr)', '(\'response\' in (xhr as any))',
44+
'node_modules/rxjs/src/observable/dom/AjaxObservable.ts');
45+
*/
4646

47-
// log('===== finished running the postinstall-patches.js script =====');
47+
// make chrome 74 work on OSX with karma under bazel
48+
// remove when we update to the next @bazel/karma release
49+
log('\n# patch: @bazel/karma 0.29.0 to disable chrome sandbox for OSX');
50+
sed('-i', 'process.platform !== \'linux\'',
51+
'process.platform !== \'linux\' && process.platform !== \'darwin\'',
52+
'node_modules/@bazel/karma/karma.conf.js');
53+
54+
log('===== finished running the postinstall-patches.js script =====');

0 commit comments

Comments
 (0)