forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* patch for build_bazel_rules_nodejs from bazel-contrib/rules_nodejs#1320 * patch for @bazel/protractor from bazel-contrib/rules_nodejs#1320 * work-around for rules_webtesting cross-platform RBE issues
- Loading branch information
1 parent
1d429b2
commit 8d0832a
Showing
19 changed files
with
657 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
packages/examples/service-worker/registration-options/BUILD.bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
diff --git a/node_modules/@bazel/protractor/protractor.conf.js b/node_modules/@bazel/protractor/protractor.conf.js | ||
index 6f81d40..7a7cc86 100755 | ||
--- a/node_modules/@bazel/protractor/protractor.conf.js | ||
+++ b/node_modules/@bazel/protractor/protractor.conf.js | ||
@@ -15,6 +15,7 @@ | ||
* limitations under the License. | ||
*/ | ||
const path = require('path'); | ||
+const child_process = require('child_process'); | ||
|
||
function log_verbose(...m) { | ||
// This is a template file so we use __filename to output the actual filename | ||
@@ -43,6 +44,50 @@ function setConf(conf, name, value, msg) { | ||
conf[name] = value; | ||
} | ||
|
||
+/** | ||
+ * Helper function to find a particular namedFile | ||
+ * within the webTestMetadata webTestFiles | ||
+ */ | ||
+function findNamedFile(webTestMetadata, key) { | ||
+ let result; | ||
+ webTestMetadata['webTestFiles'].forEach(entry => { | ||
+ const webTestNamedFiles = entry['namedFiles']; | ||
+ if (webTestNamedFiles && webTestNamedFiles[key]) { | ||
+ if (entry['archiveFile']) { | ||
+ const extractExe = findNamedFile(webTestMetadata, 'EXTRACT_EXE'); | ||
+ result = extractWebArchive(extractExe, entry['archiveFile'], webTestNamedFiles[key]); | ||
+ } else { | ||
+ result = require.resolve(webTestNamedFiles[key]); | ||
+ } | ||
+ } | ||
+ }); | ||
+ return result; | ||
+} | ||
+ | ||
+/** | ||
+ * Helper function to extract a browser archive | ||
+ * and return the path to extract executable | ||
+ */ | ||
+function extractWebArchive(extractExe, archiveFile, executablePath) { | ||
+ try { | ||
+ // Paths are relative to the root runfiles folder | ||
+ extractExe = extractExe ? path.join('..', extractExe) : extractExe; | ||
+ archiveFile = path.join('..', archiveFile); | ||
+ const extractedExecutablePath = path.join(process.cwd(), executablePath); | ||
+ if (!extractExe) { | ||
+ throw new Error('No EXTRACT_EXE found'); | ||
+ } | ||
+ child_process.execFileSync( | ||
+ extractExe, [archiveFile, '.'], {stdio: [process.stdin, process.stdout, process.stderr]}); | ||
+ log_verbose( | ||
+ `Extracting web archive ${archiveFile} with ${extractExe} to ${extractedExecutablePath}`); | ||
+ return extractedExecutablePath; | ||
+ } catch (e) { | ||
+ console.error(`Failed to extract ${archiveFile}`); | ||
+ throw e; | ||
+ } | ||
+} | ||
+ | ||
function mergeCapabilities(conf, capabilities) { | ||
if (conf.capabilities) { | ||
if (conf.capabilities.browserName === capabilities.browserName) { | ||
@@ -139,12 +184,11 @@ if (process.env['WEB_TEST_METADATA']) { | ||
// "@io_bazel_rules_webtesting//browsers:firefox-local" | ||
// then the 'environment' will equal 'local' and | ||
// 'webTestFiles' will contain the path to the binary to use | ||
- const webTestNamedFiles = webTestMetadata['webTestFiles'][0]['namedFiles']; | ||
const headless = !process.env['DISPLAY']; | ||
- if (webTestNamedFiles['CHROMIUM']) { | ||
- const chromeBin = require.resolve(webTestNamedFiles['CHROMIUM']); | ||
- const chromeDriver = require.resolve(webTestNamedFiles['CHROMEDRIVER']); | ||
- | ||
+ const chromeBin = findNamedFile(webTestMetadata, 'CHROMIUM'); | ||
+ const chromeDriver = findNamedFile(webTestMetadata, 'CHROMEDRIVER'); | ||
+ console.error(JSON.stringify(webTestMetadata, null, 2)) | ||
+ if (chromeBin && chromeDriver) { | ||
// The sandbox needs to be disabled, because it causes Chrome to crash on some environments. | ||
// See: http://chromedriver.chromium.org/help/chrome-doesn-t-start | ||
const args = ['--no-sandbox']; | ||
@@ -161,25 +205,9 @@ if (process.env['WEB_TEST_METADATA']) { | ||
} | ||
}); | ||
} | ||
- if (webTestNamedFiles['FIREFOX']) { | ||
- // TODO(gmagolan): implement firefox support for protractor | ||
- throw new Error('Firefox not yet support by protractor_web_test_suite'); | ||
- | ||
- // const firefoxBin = require.resolve(webTestNamedFiles['FIREFOX']) | ||
- // const args = []; | ||
- // if (headless) { | ||
- // args.push("--headless") | ||
- // args.push("--marionette") | ||
- // } | ||
- // setConf(conf, 'seleniumAddress', process.env.WEB_TEST_HTTP_SERVER.trim() + "/wd/hub", 'is | ||
- // configured by Bazel for firefox browser') | ||
- // mergeCapabilities(conf, { | ||
- // browserName: "firefox", | ||
- // 'moz:firefoxOptions': { | ||
- // binary: firefoxBin, | ||
- // args: args, | ||
- // } | ||
- // }, 'is determined by the browsers attribute'); | ||
+ else { | ||
+ // TODO(gmagolan): implement support for other browsers | ||
+ throw new Error('Only chrome supported by protractor_web_test_suite'); | ||
} | ||
} else { | ||
console.warn(`Unknown WEB_TEST_METADATA environment '${webTestMetadata['environment']}'`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Copyright 2016 Google Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
################################################################################ | ||
# | ||
load("@io_bazel_rules_webtesting//web:web.bzl", "browser", "web_test_archive") | ||
|
||
# Override of chromium web_test_archive so that extract can be set to run | ||
# and so that the archive is selected based on platform | ||
web_test_archive( | ||
name = "chromium_archive", | ||
testonly = True, | ||
archive = select({ | ||
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_chromium_chromium_amd64//file", | ||
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_chromium_chromium_macos//file", | ||
"@io_bazel_rules_webtesting//common/conditions:windows": "@org_chromium_chromium_windows//file", | ||
}), | ||
extract = "run", | ||
named_files = select({ | ||
"@io_bazel_rules_webtesting//common/conditions:linux": {"CHROMIUM": "chrome-linux/chrome"}, | ||
"@io_bazel_rules_webtesting//common/conditions:mac": {"CHROMIUM": "chrome-mac/Chromium.app/Contents/MacOS/chromium"}, | ||
"@io_bazel_rules_webtesting//common/conditions:windows": {"CHROMIUM": "chrome-win/chrome.exe"}, | ||
}), | ||
visibility = ["//tools/browsers:__subpackages__"], | ||
) | ||
|
||
# Override of chromium web_test_archive so that extract can be set to run | ||
# and so that the archive is selected based on platform | ||
web_test_archive( | ||
name = "chromedriver_archive", | ||
testonly = True, | ||
archive = select({ | ||
"@io_bazel_rules_webtesting//common/conditions:linux": "@org_chromium_chromedriver_amd64//file", | ||
"@io_bazel_rules_webtesting//common/conditions:mac": "@org_chromium_chromedriver_macos//file", | ||
"@io_bazel_rules_webtesting//common/conditions:windows": "@org_chromium_chromedriver_windows//file", | ||
}), | ||
extract = "run", | ||
named_files = select({ | ||
"@io_bazel_rules_webtesting//common/conditions:linux": { | ||
"CHROMEDRIVER": "chromedriver_linux64/chromedriver", | ||
}, | ||
"@io_bazel_rules_webtesting//common/conditions:mac": { | ||
"CHROMEDRIVER": "chromedriver_mac64/chromedriver", | ||
}, | ||
"@io_bazel_rules_webtesting//common/conditions:windows": { | ||
"CHROMEDRIVER": "chromedriver_win32/chromedriver.exe", | ||
}, | ||
}), | ||
visibility = ["//tools/browsers:__subpackages__"], | ||
) | ||
|
||
browser( | ||
name = "chromium", | ||
metadata = "chromium.json", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":chromedriver_archive", | ||
":chromium_archive", | ||
"@io_bazel_rules_webtesting//go/wsl", | ||
], | ||
) |
Oops, something went wrong.