test: remove Bazel schematics integration test (#37190)

This commit removes the integration test for schematics in
`@angular/bazel` that is used to generate a Bazel builder. The Bazel
builder has been deprecated.

PR Close #37190
This commit is contained in:
Keen Yee Liau 2020-05-18 16:23:14 -07:00 committed by Matias Niemelä
parent e7930fcc15
commit 1fc7891add
7 changed files with 9 additions and 8514 deletions

View File

@ -33,15 +33,6 @@ INTEGRATION_TESTS = {
"no-ivy-aot",
],
},
"bazel-schematics": {
"tags": [
# Bazel-in-bazel tests are resource intensive and should not be over-parallized
# as they will complete for the resources of other parallel tests slowing
# everything down. Ask Bazel to allocate multiple CPUs for these tests with "cpu:n" tag.
"cpu:3",
"no-ivy-aot",
],
},
"cli-hello-world": {"commands": "payload_size_tracking"},
"cli-hello-world-ivy-compat": {"commands": "payload_size_tracking"},
"cli-hello-world-ivy-i18n": {

View File

@ -1 +0,0 @@
/demo

View File

@ -1,35 +0,0 @@
{
"name": "bazel-schematics",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular",
"@angular/animations": "file:../../dist/packages-dist/animations",
"@angular/bazel": "file:../../dist/packages-dist/bazel",
"@angular/cli": "file:../../node_modules/@angular/cli",
"@angular/common": "file:../../dist/packages-dist/common",
"@angular/compiler": "file:../../dist/packages-dist/compiler",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/core": "file:../../dist/packages-dist/core",
"@angular/forms": "file:../../dist/packages-dist/forms",
"@angular/language-service": "file:../../dist/packages-dist/language-service",
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
"@angular/router": "file:../../dist/packages-dist/router",
"@types/node": "file:../../node_modules/@types/node",
"patch-package": "^6.2.1",
"protractor": "file:../../node_modules/protractor",
"puppeteer": "file:../../node_modules/puppeteer",
"typescript": "file:../../node_modules/typescript",
"tslib": "file:../../node_modules/tslib"
},
"//resolutions-comment": "Ensure a single version of webdriver-manager which comes from root node_modules that has already run webdriver-manager update",
"resolutions": {
"**/webdriver-manager": "file:../../node_modules/webdriver-manager"
},
"scripts": {
"test": "./test.sh",
"postinstall": "patch-package"
}
}

View File

@ -1,25 +0,0 @@
diff --git a/node_modules/@angular/bazel/src/builders/files/WORKSPACE.template b/node_modules/@angular/bazel/src/builders/files/WORKSPACE.template
index 9aad043..e767dc6 100755
--- a/node_modules/@angular/bazel/src/builders/files/WORKSPACE.template
+++ b/node_modules/@angular/bazel/src/builders/files/WORKSPACE.template
@@ -10,7 +10,7 @@
# imports also make sense when referencing the published package.
workspace(
name = "project",
- managed_directories = {"@npm": ["node_modules"]},
+ # managed_directories = {"@npm": ["node_modules"]},
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
@@ -67,6 +67,11 @@ node_repositories(
yarn_install(
name = "npm",
package_json = "//:package.json",
+ # Turn off symlink_node_modules here as it causes flakiness with missing
+ # files in node_modules.
+ # TODO: track down the root cause of the flakiness; current suspect is that
+ # it is an issue with managed_directories when resources are limited
+ symlink_node_modules = False,
yarn_lock = "//:yarn.lock",
)

View File

@ -1,94 +0,0 @@
#!/usr/bin/env bash
set -eux -o pipefail
# sedi makes `sed -i` work on both OSX & Linux
# See https://stackoverflow.com/questions/2320564/i-need-my-sed-i-command-for-in-place-editing-to-work-with-both-gnu-sed-and-bsd
function sedi () {
case $(uname) in
Darwin*) sedi=('-i' '') ;;
*) sedi='-i' ;;
esac
sed "${sedi[@]}" "$@"
}
function installLocalPackages() {
# Install Angular packages that are built locally from HEAD.
# This also gets around the bug whereby yarn caches local `file://` urls.
# See https://github.com/yarnpkg/yarn/issues/2165
readonly pwd=$(pwd)
readonly packages=(
animations common compiler core forms platform-browser
platform-browser-dynamic router bazel compiler-cli language-service
)
local local_packages=()
for package in "${packages[@]}"; do
local_packages+=("@angular/${package}@file:${pwd}/../node_modules/@angular/${package}")
done
# keep protractor, typescript, tslib, and @types/node versions in sync with the ones used in this repo
local_packages+=("protractor@file:${pwd}/../node_modules/protractor")
local_packages+=("typescript@file:${pwd}/../node_modules/typescript")
local_packages+=("tslib@file:${pwd}/../node_modules/tslib")
local_packages+=("@types/node@file:${pwd}/../node_modules/@types/node")
# add protractor, puppeteer & webdriver-manager so we get the chrome & chromedriver binaries
# that have already been downloaded at the root
local_packages+=("puppeteer@file:${pwd}/../node_modules/puppeteer")
local_packages+=("webdriver-manager@file:${pwd}/../node_modules/webdriver-manager")
yarn add --ignore-scripts --silent "${local_packages[@]}" --cache-folder ./.yarn_local_cache
}
function patchKarmaConf() {
sedi "s#module.exports#process.env.CHROME_BIN = require\('puppeteer'\).executablePath\(\); module.exports#" ./karma.conf.js
sedi "s#browsers\: \['Chrome'\],#customLaunchers\: \{ ChromeHeadlessNoSandbox\: \{ base\: 'ChromeHeadless', flags\: \['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio'\] \} \}, browsers\: \['ChromeHeadlessNoSandbox'\],#" ./karma.conf.js
}
function patchProtractorConf() {
sedi "s#browserName\: 'chrome'#browserName\: 'chrome', chromeOptions\: \{ binary: require\('puppeteer'\).executablePath\(\), args: \['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio'\] \},#" ./e2e/protractor.conf.js
}
function testBazel() {
# Set up
ng version
rm -rf demo
# Create project
ng new demo --collection=@angular/bazel --routing --skip-git --skip-install --style=scss
cd demo
# Use a local yarn cache folder so we don't access the global yarn cache
mkdir .yarn_local_cache
patchKarmaConf
patchProtractorConf
installLocalPackages
ng generate component widget --style=css
ng build
ng test
ng e2e
ng e2e --prod
if [ -e 'WORKSPACE' ] || [ -e 'BUILD.bazel' ]; then
echo 'WORKSPACE / BUILD.bazel file should not exist in project'
exit 1
fi
}
function testNonBazel() {
# Replace angular.json that uses Bazel builder with the default generated by CLI
mv ./angular.json.bak ./angular.json
rm -rf dist src/main.dev.ts src/main.prod.ts
# disable CLI's version check (if version is 0.0.0, then no version check happens)
yarn --cwd node_modules/@angular/cli version --new-version 0.0.0 --no-git-tag-version
# re-add build-angular
yarn add --dev file:../node_modules/@angular-devkit/build-angular --cache-folder ./.yarn_local_cache
ng build --progress=false
ng test --progress=false --watch=false
ng e2e --port 0 --configuration=production --webdriver-update=false
}
testBazel
# this test verifies that users can undo bazel - the value of this is questionable
# because there are way too many manual steps and it would be easier for users to
# just revert the diff created by `ng add @angular/bazel`
testNonBazel

File diff suppressed because it is too large Load Diff

View File

@ -2,16 +2,19 @@
Bazel builder for Angular CLI has been deprecated.
The schematics for Bazel builder have been in Angular Labs for some time,
but over the course of its evaluation the Angular team has found that they did
not meet our expectation of providing a smooth experience to get users onboard.
**tl;dr: We have deprecated the the Bazel builder and schematics for Angular CLI. As of Angular v10 we removed the ability to call `ng add @angular/bazel` to convert existing Angular CLI projects to use Bazel. We believe that some Angular projects can greatly benefit from using Bazel - these projects should use Bazel Web directly as documented in the [canonical example in the Bazel Web repo](https://github.com/bazelbuild/rules_nodejs/tree/master/examples/angular).**
The schematics for Bazel builder have been in Angular Labs for some time. Via labs we have been able to experiment with wrapping Bazel into the CLI and make it's use in the CLI invisible to developers using Angular CLI.
Through this experiment we, the Angular team have found that wrapping Bazel into Angular CLI does currently not meet our expectation of providing a great experience to developers using Angular.
There are multiple factors:
1. Bazel ecosystem for Javascript is still evolving at a rapid pace.
2. The introduction of Ivy compiler enables new ways to use Bazel in a faster
1. Bazel ecosystem for the Web is still evolving at a rapid pace.
2. The introduction of the Angular Ivy compiler enables new ways to use Bazel in a faster
and more efficient manner.
3. Feature parity with Angular CLI is difficult to achieve.
3. Feature parity with Webpack based Angular CLI is currently difficult to achieve without trade offs that would not be acceptable for many Angular users.
For users who are currently using Bazel builder, there are a few migration
options.