ci(docs-infra): compile with Ivy (#26947)

Jira: FW-552

PR Close #26947
This commit is contained in:
George Kalpakas 2018-11-05 19:21:27 +02:00 committed by Jason Aden
parent 5639891e90
commit e98d508df2
3 changed files with 65 additions and 0 deletions

View File

@ -201,6 +201,19 @@ jobs:
# Run e2e tests # Run e2e tests
- run: yarn --cwd aio e2e - run: yarn --cwd aio e2e
test_aio_local_ivy:
<<: *job_defaults
steps:
- checkout:
<<: *post_checkout
- restore_cache:
key: *cache_key
- attach_workspace:
at: dist
- *define_env_vars
# Build aio with Ivy (using local Angular packages)
- run: yarn --cwd aio build-with-ivy --progress=false
test_aio_tools: test_aio_tools:
<<: *job_defaults <<: *job_defaults
steps: steps:
@ -497,6 +510,9 @@ workflows:
- test_aio_local: - test_aio_local:
requires: requires:
- build-packages-dist - build-packages-dist
- test_aio_local_ivy:
requires:
- build-packages-dist
- test_aio_tools: - test_aio_tools:
requires: requires:
- build-packages-dist - build-packages-dist
@ -526,6 +542,7 @@ workflows:
- integration_test - integration_test
# Only publish if `aio`/`docs` tests using the locally built Angular packages pass # Only publish if `aio`/`docs` tests using the locally built Angular packages pass
- test_aio_local - test_aio_local
- test_aio_local_ivy
- test_docs_examples - test_docs_examples
# Get the artifacts to publish from the build-packages-dist job # Get the artifacts to publish from the build-packages-dist job
# since the publishing script expects the legacy outputs layout. # since the publishing script expects the legacy outputs layout.

View File

@ -17,6 +17,8 @@
"build": "yarn ~~build", "build": "yarn ~~build",
"prebuild-local": "yarn setup-local", "prebuild-local": "yarn setup-local",
"build-local": "yarn ~~build", "build-local": "yarn ~~build",
"prebuild-with-ivy": "yarn setup-local && yarn ivy-ngcc",
"build-with-ivy": "node scripts/build-with-ivy",
"extract-cli-command-docs": "node tools/transforms/cli-docs-package/extract-cli-commands.js fd4e960d6", "extract-cli-command-docs": "node tools/transforms/cli-docs-package/extract-cli-commands.js fd4e960d6",
"lint": "yarn check-env && yarn docs-lint && ng lint && yarn example-lint && yarn tools-lint", "lint": "yarn check-env && yarn docs-lint && ng lint && yarn example-lint && yarn tools-lint",
"test": "yarn check-env && ng test", "test": "yarn check-env && ng test",

View File

@ -0,0 +1,46 @@
#!/usr/bin/env node
// Imports
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 TS_CONFIG_PATH = join(ROOT_DIR, 'tsconfig.json');
const NG_COMPILER_OPTS = {
angularCompilerOptions: {
// Related Jira issue: FW-737
allowEmptyCodegenFiles: true,
enableIvy: 'ngtsc',
},
};
// Run
_main(process.argv.slice(2));
// Functions - Definitions
function _main(buildArgs) {
console.log('\nModifying `tsconfig.json`...');
const oldTsConfigStr = readFileSync(TS_CONFIG_PATH, 'utf8');
const oldTsConfigObj = parse(oldTsConfigStr);
const newTsConfigObj = extend(true, oldTsConfigObj, NG_COMPILER_OPTS);
const newTsConfigStr = JSON.stringify(newTsConfigObj, null, 2);
writeFileSync(TS_CONFIG_PATH, newTsConfigStr);
console.log(newTsConfigStr);
try {
const buildArgsStr = buildArgs.join(' ');
console.log(`\nBuilding${buildArgsStr && ` with args \`${buildArgsStr}\``}...`);
exec(`yarn ~~build ${buildArgsStr}`, {cwd: ROOT_DIR});
} finally {
console.log('\nRestoring `tsconfig.json`...');
writeFileSync(TS_CONFIG_PATH, oldTsConfigStr);
}
console.log('\nDone!');
}