2018-12-12 18:39:14 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux -o pipefail
|
|
|
|
|
2018-12-18 18:44:13 -05:00
|
|
|
function testBazel() {
|
2018-12-12 18:39:14 -05:00
|
|
|
# Set up
|
|
|
|
bazel version
|
|
|
|
rm -rf demo
|
|
|
|
# Create project
|
|
|
|
ng new demo --collection=@angular/bazel --defaults --skip-git
|
2019-01-10 19:04:05 -05:00
|
|
|
node replace_angular_repo.js "./demo/WORKSPACE"
|
2018-12-12 18:39:14 -05:00
|
|
|
cd demo
|
2019-01-10 19:04:05 -05:00
|
|
|
# TODO(kyliau) Remove this once the type annotations are added to AppPage
|
|
|
|
# https://github.com/angular/angular-cli/pull/13406
|
|
|
|
cp ../app.po.ts ./e2e/src/
|
2018-12-12 18:39:14 -05:00
|
|
|
# Run build
|
2018-12-17 16:17:13 -05:00
|
|
|
# TODO(kyliau): Use `bazel build` for now. Running `ng build` requires
|
|
|
|
# node_modules to be available in project directory.
|
2018-12-12 18:39:14 -05:00
|
|
|
bazel build //src:bundle
|
|
|
|
# Run test
|
2018-12-17 16:17:13 -05:00
|
|
|
ng test
|
|
|
|
ng e2e
|
2018-12-12 18:39:14 -05:00
|
|
|
}
|
|
|
|
|
2018-12-18 18:44:13 -05:00
|
|
|
function testNonBazel() {
|
|
|
|
# Replace angular.json that uses Bazel builder with the default generated by CLI
|
|
|
|
cp ../angular.json.original ./angular.json
|
|
|
|
# TODO(kyliau) Remove this once the additional assertion is added to CLI
|
|
|
|
cp ../app.e2e-spec.ts ./e2e/src/
|
|
|
|
# TODO(kyliau) Remove this once web_package rule is in use
|
|
|
|
cp ../index.html ./src/
|
|
|
|
rm -rf dist src/main.dev.ts src/main.prod.ts
|
|
|
|
# Just make a symlink instead of full yarn install to expose node_modules
|
|
|
|
ln -s $(bazel info output_base)/external/npm/node_modules node_modules
|
2019-01-04 13:27:09 -05:00
|
|
|
ng build --progress=false
|
|
|
|
ng test --progress=false --watch=false
|
|
|
|
ng e2e --configuration=ci
|
2018-12-18 18:44:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
testBazel
|
|
|
|
testNonBazel
|