Skip to content

refactor(snack-bar): rework to account for ivy #15537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9ff4d2d
build: activate experimental Angular Ivy build of the demo app
alxhub Jul 2, 2018
3be11af
fix: disable animation temporarily for ivy
alxhub Jul 24, 2018
678244b
material demo app is running
kara Jan 12, 2019
053f7d0
chore(ivy): make unit tests runnable (#14832)
jelbourn Jan 15, 2019
fa7b7f3
chore(ivy): use `yarn bazel` consistently in install script (#14834)
jelbourn Jan 15, 2019
a3b27cc
chore(ivy): add @bazel/bazel to devDependencies (#14835)
jelbourn Jan 15, 2019
e721385
chore(ivy): filter unit tests based on a blacklist (#14846)
jelbourn Jan 16, 2019
e60bbd2
test: report karma results as json (#14860)
andrewseguin Jan 17, 2019
5c86cc4
chore: skip CI for ivy-2019 branch (#14868)
jelbourn Jan 17, 2019
41f0185
build: do run "build_release_packages" job in ivy-2019 branch (#14871)
devversion Jan 17, 2019
5be6a20
chore: update yarn lock
jelbourn Jan 18, 2019
031b06f
chore: add script to generate ivy test blacklist (#14877)
jelbourn Jan 18, 2019
614d827
chore(ivy): re-enable tree tests
jelbourn Jan 30, 2019
ebff165
chore: update zonejs to 0.8.29
jelbourn Jan 30, 2019
f4219b5
chore: add node shebang to ivy/fix-tsconfig.js script
jelbourn Jan 30, 2019
e55e8e9
chore: make scripts/ivy/fix-tsconfigs.js executable
jelbourn Jan 30, 2019
fa37a80
chore: simplify ivy/install-angular.sh
jelbourn Feb 1, 2019
348b3ef
chore(ivy): rename "blacklist" to "blocklist"
jelbourn Feb 5, 2019
fca1c02
chore(ivy): avoid global error issues with karma-jasmine
jelbourn Feb 6, 2019
0cee02b
chore: disable tests that are failing *only* on angular CI
jelbourn Feb 8, 2019
dc7467e
chore(ivy): add static flag to tab-related static queries (#15238)
kara Feb 20, 2019
c502f78
chore(ivy): add static flag to dialog-related static queries (#15239)
kara Feb 20, 2019
7ee4193
chore(ivy): add static flag to more queries (#15252)
kara Feb 20, 2019
f22561b
chore(ivy): add static flag to tree-related static queries (#15255)
kara Feb 20, 2019
576abc5
chore(ivy): add static flag to table-related static queries (#15257)
kara Feb 21, 2019
ea7b7f2
chore(ivy): fix static query stragglers that were not marked static q…
kara Feb 21, 2019
4d38453
test(menu): refactor test that depends on static queries (#15289)
crisbeto Feb 25, 2019
fcc0448
test(sidenav): fix sidenav failures under Ivy (#15300)
crisbeto Feb 25, 2019
f388871
test(grid-list): make error expectation less brittle (#15303)
jelbourn Feb 25, 2019
669d586
test(slide-toggle): adding missing detectChanges() and tick() (#15309)
jelbourn Feb 26, 2019
edf819e
test(overlay): use static queries w/ overlay containers (#15301)
jelbourn Feb 26, 2019
ba78acd
test(select): update static query tests (#15320)
crisbeto Feb 26, 2019
9473ce9
test(expansion): rework tests that depend on static queries (#15330)
crisbeto Feb 27, 2019
c068a53
test(accordion): update static query test (#15357)
marclaval Mar 1, 2019
fbbd5d0
fix: mark virtual scroll viewport queries as static (#15346)
kara Mar 1, 2019
ddc81f1
fix: restore virtualForOf properties (#15358)
kara Mar 1, 2019
ce4b814
fix(virtual-scroll): move views that are already attached instead of …
kara Mar 1, 2019
ab8a338
test(table): remove unnecessary test (#15391)
andrewseguin Mar 5, 2019
171f128
fix: move detectChanges call in tree spec to include trackBy (#15414)
kara Mar 7, 2019
e766a4f
test(chip-list): rework tests to work under Ivy (#15427)
crisbeto Mar 11, 2019
641e676
test(table): update static query test (#15450)
marclaval Mar 12, 2019
a3f4f43
fix(table): use default change detection strategy on table [from #154…
andrewseguin Mar 12, 2019
04b029c
test(input): make the type validation test to pass in Ivy (#15461)
marclaval Mar 13, 2019
29842aa
refactor(snack-bar): rework to account for ivy
crisbeto Mar 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ var_12: &ignore_presubmit_branch_filter
branches:
ignore:
- "_presubmit"
- "ivy-2019"

# -----------------------------
# Container version of CircleCI
Expand Down Expand Up @@ -348,7 +349,8 @@ workflows:

release_output:
jobs:
- build_release_packages
- build_release_packages:
filters: *ignore_presubmit_branch_filter
- build_devapp_aot:
filters: *ignore_presubmit_branch_filter
requires:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ yarn-error.log
testem.log
/.chrome
/.git
/.firebase
/.firebase
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"systemjs": "0.19.43",
"tsickle": "^0.34.0",
"tslib": "^1.9.3",
"zone.js": "^0.8.26"
"zone.js": "^0.8.29"
},
"devDependencies": {
"@angular-devkit/core": "^7.1.2",
Expand All @@ -55,6 +55,7 @@
"@angular/platform-browser-dynamic": "^7.1.3",
"@angular/platform-server": "^7.1.3",
"@angular/router": "^7.1.3",
"@bazel/bazel": "~0.21.0",
"@bazel/ibazel": "^0.9.0",
"@bazel/karma": "0.22.0",
"@bazel/typescript": "0.22.0",
Expand Down Expand Up @@ -111,7 +112,8 @@
"karma-browserstack-launcher": "^1.3.0",
"karma-chrome-launcher": "^2.2.0",
"karma-firefox-launcher": "^1.0.1",
"karma-jasmine": "^2.0.1",
"karma-jasmine": "github:jelbourn/karma-jasmine",
"karma-json-result-reporter": "^1.0.0",
"karma-parallel": "^0.3.0",
"karma-sauce-launcher": "^2.0.2",
"karma-sourcemap-loader": "^0.3.7",
Expand All @@ -134,7 +136,8 @@
"selenium-webdriver": "^3.6.0",
"sorcery": "^0.10.0",
"source-map-support": "^0.5.9",
"stylelint": "^9.9.0",
"stylelint": "^8.4.0",
"systemjs-builder": "^0.16.13",
"ts-node": "^3.0.4",
"tsconfig-paths": "^2.3.0",
"tslint": "^5.12.0",
Expand Down
39 changes: 39 additions & 0 deletions scripts/ivy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Experimental Ivy Scripts

These scripts exist for the testing of Ivy in the Material repo, pre-launch. This is uncharted
territory, so building Material this way may or may not work, and depending on the output is
non-trivial.

## Usage

For the first execution, a version of Angular must be built with `ngtsc`. To do this, a current
Angular repo is passed to `install-angular.sh`.

```bash
$ ./scripts/ivy/install-angular.sh /path/to/angular
```

This will replace `node_modules/@angular` with `ngtsc`-built versions of Angular packages.

Once that step is complete, the demo application can be built.

```bash
# Build the demo-app with Ivy
$ ./scripts/ivy/build.sh
# And serve it
$ cd dist/demo && http-server
```

## Known issues
* Much of the compilation will fail without commits in the Angular repo not yet in `master`.
* Ivy does not support the `ViewContainerRef.createComponent()` API yet, so the demo-app is unable to get past starting the Angular Router.

## Maintaining tsconfig files

The `ivy` branch has a lot of updated tsconfig files. These were mutated via script, which can
be re-run if needed

```bash
# Update tsconfigs
./scripts/ivy/update-tsconfigs.sh
```
27 changes: 27 additions & 0 deletions scripts/ivy/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -e

echo ">>> Build Material"
rm -rf dist
gulp build:devapp

echo ">>> Rebuild dev-app with ngtsc"
node_modules/.bin/ngc -p src/dev-app/tsconfig-build.json

echo ">>> Bundle demo-app with SystemJS"
node ./src/dev-app/systemjs-bundle.js

echo ">>> Assembling app"
mkdir dist/demo
cp dist/packages/dev-app/bundle.js dist/demo
cp src/dev-app/index.html dist/demo
cp dist/packages/dev-app/theme.css dist/demo
cp 'node_modules/@webcomponents/custom-elements/custom-elements.min.js' dist/demo
cp node_modules/core-js/client/core.js dist/demo
cp node_modules/systemjs/dist/system.src.js dist/demo
cp node_modules/zone.js/dist/zone.js dist/demo
cp node_modules/hammerjs/hammer.min.js dist/demo

echo ">>> Done."
echo "Output: $(pwd)/dist/demo"
59 changes: 59 additions & 0 deletions scripts/ivy/fix-tsconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env node

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

/*
* This script updates a tsconfig-build.json file for Ivy compilation. It has 3 main goals:
*
* 1. Change "public-api.ts" to "index.ts" in the files array.
* 2. Add "enableIvy": "ngtsc" to "angularCompilerOptions".
* 3. Turn "annotateForClosureCompiler" off (so decorators will tree-shake properly).
*/

const fs = require('fs');

function replacePublicApiTs(file) {
if (file === 'public-api.ts') {
return 'index.ts';
} else {
return file;
}
}


// Read in the tsconfig json file.
let source = fs.readFileSync(process.argv[2], 'utf8')
.split(/\n/)
.filter(line => !line.trim().startsWith('/') && !line.trim().startsWith('*'))
.join('\n')
.replace(/,(\s+)]/g, '$1]')
.replace(/,(\s+)}/g, '$1}');

let json = null;
try {
json = JSON.parse(source);
} catch (e) {
console.error(`Error parsing tsconfig ${process.argv[2]}:`);
console.error(source);
console.error(`Error was:`, e);
process.exit(1);
}

if (json['files'] && Array.isArray(json['files'])) {
json['files'] = json['files'].map(replacePublicApiTs);
}

if (json['angularCompilerOptions']) {
if (json['angularCompilerOptions']['annotateForClosureCompiler']) {
delete json['angularCompilerOptions']['annotateForClosureCompiler']
}
json['angularCompilerOptions']['enableIvy'] = 'ngtsc';
}

fs.writeFileSync(process.argv[2], JSON.stringify(json, null, 2));
98 changes: 98 additions & 0 deletions scripts/ivy/generate-blocklist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/usr/bin/env node

const path = require('path');
const fs = require('fs');

const karmaOutput = JSON.parse(fs.readFileSync('/tmp/karma-result.json'));


let generatedBlocklist = {};
for (const desc of Object.keys(karmaOutput)) {
// If karma encounters global errors, it adds them to an array keyed __BROWSER_ERRORS__.
// We ignore this since it's not associated with any particular test. It generally shouldn't
// happen at all because we're using a forked version of karma-jasmine that does not report
// global errors per-suite.
if (desc === '__BROWSER_ERRORS__') {
continue;
}

generatedBlocklist = {...generatedBlocklist, ...getFullFailure(karmaOutput[desc], desc)};
}

// We want to "remember" the notes from the current blocklist on angular/angular unless the
// error message has changed. We need to know where the local angular/angular repo is.
const angularRepoPath = process.argv[2];
if (!angularRepoPath) {
console.error('Please provide the path to your local angular/angular repo as the first argument');
process.exit(1);
}

// Read the contents of the previous blocklist.
const previousBlocklistPath =
path.join(angularRepoPath, 'tools', 'material-ci', 'angular_material_test_blocklist.js');
const previousBlocklistContent = fs.readFileSync(previousBlocklistPath, 'utf-8');

// Because the blocklist is a javascript file meant to be executed, we just actually execute it with
// eval. Create a dummy `window` for it to add to.
const window = {};
eval(previousBlocklistContent);
const previousBlocklist = window.testBlocklist;

// Copy any existing test notes.
for (const testName of Object.keys(generatedBlocklist)) {
if (previousBlocklist[testName] &&
generatedBlocklist[testName].error === previousBlocklist[testName].error) {
generatedBlocklist[testName].notes = previousBlocklist[testName].notes;
}
}

// Format the output as an executable javascript program.
const output =
`/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

/**
* Blocklist of unit tests from angular/material2 with ivy that are skipped when running on
* angular/angular. As bugs are resolved, items should be removed from this blocklist.
*
* The \`notes\` section should be used to keep track of specific issues associated with the failures.
*/

// clang-format off
// tslint:disable

window.testBlocklist = ${JSON.stringify(generatedBlocklist, null, 2)};
// clang-format on`;

// Write that sucker to dist.
fs.writeFileSync('dist/angular_material_test_blocklist.js', output, 'utf-8');


/**
* Given a karma test result, get a blocklist entry in the form
* {[full test name]: {error: '...', notes: '...'}}
*/
function getFullFailure(result, fullName = '') {
if (result['log']) {
if (result['log'].length) {
return {[fullName]: {
error: result['log'][0].split('\n')[0],
notes: 'Unknown',
}};
}

return {};
}

let failures = {};
for (const key of Object.keys(result)) {
failures = {...failures, ...getFullFailure(result[key], fullName + ' ' + key)};
}

return failures;
}
49 changes: 49 additions & 0 deletions scripts/ivy/install-angular.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

set -e


function clear_existing_angular_install() {
echo ">>> clearing existing @angular packages in node_modules"
chmod -R u+w node_modules/@angular
rm -rf node_modules/@angular/*
}

function build_angular_packages() {
angular_repo_dir=$1
echo ">>> Building @angular packages (from ${angular_repo_dir})"
pushd ${angular_repo_dir}
yarn bazel build --config=release --define=compile=aot //packages/{animations,common,compiler,compiler-cli,core,elements,forms,platform-browser,platform-browser-dynamic,router,upgrade}:npm_package
output_path=$(yarn --silent bazel info bazel-bin 2>/dev/null)/packages
popd
}

function install_angular_package() {
name=$1
echo " @angular/$name"
cp -r "${output_path}/${name}/npm_package" "node_modules/@angular/${name}"
}


if [[ "$1" != "" ]]
then
clear_existing_angular_install
build_angular_packages $1

echo ">>> Installing @angular packages"
install_angular_package "animations"
install_angular_package "common"
install_angular_package "compiler"
install_angular_package "compiler-cli"
install_angular_package "core"
install_angular_package "elements"
install_angular_package "forms"
install_angular_package "platform-browser"
install_angular_package "platform-browser-dynamic"
install_angular_package "router"
install_angular_package "upgrade"

chmod -R u+w node_modules/@angular
else
echo "Usage: $0 /path/to/angular/repo"
fi
15 changes: 15 additions & 0 deletions scripts/ivy/update-tsconfigs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

find src | grep /tsconfig.*json | grep -v '/tsconfig.json' | while read tsconfig; do
dir=`dirname $tsconfig`
echo "Updating $tsconfig"

# If no index.ts exists, rename public-api.ts.
if [ ! -f $dir/index.ts -a -f $dir/public-api.ts ]
then
echo "export * from './public_api';" > $dir/index.ts
fi
node scripts/ivy/fix-tsconfig.js $tsconfig
done
4 changes: 2 additions & 2 deletions src/a11y-demo/menu/menu-a11y.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ <h2>Menu with Icons</h2>

<section>
<h2>Menu with links</h2>
<button mat-icon-button [matMenuTriggerFor]="menu2" aria-label="Learn more about Angular">
<button mat-icon-button [matMenuTriggerFor]="menu3" aria-label="Learn more about Angular">
<mat-icon>more_vert</mat-icon>
</button>

<mat-menu #menu2="matMenu">
<mat-menu #menu3="matMenu">
<a href="http://angular.io" mat-menu-item>
Angular
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/cdk-experimental/dialog/dialog-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class CdkDialogContainer extends BasePortalOutlet implements OnDestroy {
// tslint:disable:no-host-decorator-in-concrete

/** The portal host inside of this container into which the dialog content will be loaded. */
@ViewChild(PortalHostDirective) _portalHost: PortalHostDirective;
@ViewChild(PortalHostDirective, {static: true}) _portalHost: PortalHostDirective;

/** A subject emitting before the dialog enters the view. */
_beforeEnter: Subject<void> = new Subject();
Expand Down
Loading