build(docs-infra): turn on Ivy (#32923)

The angular.io project uses Angular and CLI v9, which by default turns
on Ivy mode. However, since ec4381dd4, we explicitly opt out of Ivy.

This commit removes the `enabledIvy: false` configuration, thus allowing
the default behavior of having Ivy on.

NOTE:
This commit only changes the angular.io projects. The docs examples need
to be updated separately (first to Angular and CLI v9 and then to Ivy).

PR Close #32923
This commit is contained in:
George Kalpakas 2019-10-01 00:54:00 +03:00 committed by atscott
parent bc886a64a7
commit eb72cecc42
7 changed files with 37 additions and 46 deletions

View File

@ -347,6 +347,10 @@ jobs:
steps:
- custom_attach_workspace
- init_environment
# Compile dependencies to ivy
# Running `ngcc` here (instead of implicitly via `ng build`) allows us to take advantage of
# the parallel, async mode speed-up (~20-25s on CI).
- run: yarn --cwd aio ivy-ngcc --properties es2015
# Build aio
- run: yarn --cwd aio build --progress=false
# Lint the code
@ -376,7 +380,7 @@ jobs:
test_aio_local:
parameters:
ivy:
viewengine:
type: boolean
default: false
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
@ -385,7 +389,7 @@ jobs:
- custom_attach_workspace
- init_environment
# Build aio (with local Angular packages)
- run: yarn --cwd aio build-local<<# parameters.ivy >>-with-ivy<</ parameters.ivy >>-ci
- run: yarn --cwd aio build-local<<# parameters.viewengine >>-with-viewengine<</ parameters.viewengine >>-ci
# Run unit tests
- run: yarn --cwd aio test --progress=false --watch=false
# Run e2e tests
@ -393,7 +397,7 @@ jobs:
# Run PWA-score tests
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
# Check the bundle sizes.
- run: yarn --cwd aio payload-size aio-local<<# parameters.ivy >>-ivy<</ parameters.ivy >>
- run: yarn --cwd aio payload-size aio-local<<# parameters.viewengine >>-viewengine<</ parameters.viewengine >>
test_aio_tools:
executor: default-executor
@ -776,8 +780,8 @@ workflows:
requires:
- build-npm-packages
- test_aio_local:
name: test_aio_local_ivy
ivy: true
name: test_aio_local_viewengine
viewengine: true
requires:
- build-npm-packages
- test_aio_tools:
@ -816,7 +820,7 @@ workflows:
- integration_test
# Only publish if `aio`/`docs` tests using the locally built Angular packages pass
- test_aio_local
- test_aio_local_ivy
- test_aio_local_viewengine
- test_docs_examples
- test_docs_examples_ivy
# Get the artifacts to publish from the build-packages-dist job

View File

@ -18,8 +18,8 @@ Here are the most important tasks you might need to use:
* `yarn build` - create a production build of the application (after installing dependencies, boilerplate, etc).
* `yarn build-local` - same as `build`, but use `setup-local` instead of `setup`.
* `yarn build-local-with-ivy` - same as `build-local`, but in addition also turns on `ivy` mode in aio.
(Note: To turn on `ivy` mode in examples, see `yarn boilerplate:add` below.)
* `yarn build-local-with-viewengine` - same as `build-local`, but in addition also turns on `ViewEngine` mode in aio.
(Note: Docs examples run in `ViewEngine` mode by default. To turn on `ivy` mode in examples, see `yarn boilerplate:add` below.)
* `yarn start` - run a development web server that watches the files; then builds the doc-viewer and reloads the page, as necessary.
* `yarn serve-and-sync` - run both the `docs-watch` and `start` in the same console.

View File

@ -19,10 +19,10 @@
"build-local": "yarn ~~build",
"prebuild-local-ci": "yarn setup-local --no-build-packages",
"build-local-ci": "yarn ~~build --progress=false",
"prebuild-local-with-ivy": "yarn setup-local && node scripts/switch-to-ivy",
"build-local-with-ivy": "yarn ~~build",
"prebuild-local-with-ivy-ci": "yarn setup-local --no-build-packages && node scripts/switch-to-ivy",
"build-local-with-ivy-ci": "yarn ~~build --progress=false",
"prebuild-local-with-viewengine": "node scripts/switch-to-viewengine && yarn setup-local",
"build-local-with-viewengine": "yarn ~~build",
"prebuild-local-with-viewengine-ci": "node scripts/switch-to-viewengine && yarn setup-local --no-build-packages",
"build-local-with-viewengine-ci": "yarn ~~build --progress=false",
"extract-cli-command-docs": "node tools/transforms/cli-docs-package/extract-cli-commands.js 0a36071b8",
"lint": "yarn check-env && yarn docs-lint && ng lint && yarn example-lint && yarn tools-lint",
"test": "yarn check-env && ng test",

View File

@ -2,28 +2,16 @@
"aio": {
"master": {
"uncompressed": {
"runtime-es5": 3091,
"runtime-es2015": 3097,
"main-es5": 480426,
"main-es2015": 434851,
"runtime-es5": 2981,
"runtime-es2015": 2987,
"main-es5": 540068,
"main-es2015": 494141,
"polyfills-es5": 142239,
"polyfills-es2015": 52503
}
}
},
"aio-local": {
"master": {
"uncompressed": {
"runtime-es5": 3091,
"runtime-es2015": 3097,
"main-es5": 481663,
"main-es2015": 436411,
"polyfills-es5": 142239,
"polyfills-es2015": 52503
}
}
},
"aio-local-ivy": {
"master": {
"uncompressed": {
"runtime-es5": 2981,
@ -34,5 +22,17 @@
"polyfills-es2015": 52503
}
}
},
"aio-local-viewengine": {
"master": {
"uncompressed": {
"runtime-es5": 3091,
"runtime-es2015": 3097,
"main-es5": 481663,
"main-es2015": 436411,
"polyfills-es5": 142239,
"polyfills-es2015": 52503
}
}
}
}

View File

@ -4,16 +4,13 @@
const {extend, parse} = require('cjson');
const {readFileSync, writeFileSync} = require('fs');
const {join, resolve} = require('path');
const {exec, set} = require('shelljs');
set('-e');
// Constants
const ROOT_DIR = resolve(__dirname, '..');
const NG_JSON = join(ROOT_DIR, 'angular.json');
const NG_COMPILER_OPTS = {
angularCompilerOptions: {
enableIvy: true,
enableIvy: false,
},
};
@ -26,7 +23,7 @@ function _main() {
const ngConfig = parse(readFileSync(NG_JSON, 'utf8'));
const tsConfigPath = join(ROOT_DIR, ngConfig.projects.site.architect.build.options.tsConfig);
// Enable Ivy in TS config.
// Enable ViewIngine/Disable Ivy in TS config.
console.log(`\nModifying \`${tsConfigPath}\`...`);
const oldTsConfigStr = readFileSync(tsConfigPath, 'utf8');
const oldTsConfigObj = parse(oldTsConfigStr);
@ -35,13 +32,8 @@ function _main() {
console.log(`\nNew config: ${newTsConfigStr}`);
writeFileSync(tsConfigPath, newTsConfigStr);
// Run ngcc.
const ngccArgs = '--loglevel debug --properties es2015';
console.log(`\nRunning ngcc (with args: ${ngccArgs})...`);
exec(`yarn ivy-ngcc ${ngccArgs}`);
// Done.
console.log('\nReady to build with Ivy!');
console.log('(To switch back to ViewEngine (with packages from npm), undo the changes in ' +
console.log('\nReady to build with ViewEngine!');
console.log('(To switch back to Ivy (with packages from npm), undo the changes in ' +
`\`${tsConfigPath}\` and run \`yarn aio-use-npm && yarn example-use-npm\`.)`);
}

View File

@ -239,9 +239,7 @@ describe('site App', function() {
/* tslint:disable:max-line-length */
expect(page.ghLinks.get(0).getAttribute('href'))
.toMatch(/https:\/\/github\.com\/angular\/angular\/edit\/master\/aio\/content\/guide\/http\.md\?message=docs%3A%20describe%20your%20change\.\.\./);
// TODO(gkalpak): This test often times out with Ivy (because loading `guide/http` takes a lot of time).
// Remove the timeout once the performance issues have been fixed.
}, 60000);
});
it('should not be present on top level pages', () => {
page.navigateTo('features');

View File

@ -33,7 +33,4 @@
"scripts",
"tools"
],
"angularCompilerOptions": {
"enableIvy": false,
},
}