Skip to content

Commit fe7570a

Browse files
devversionkara
authored andcommitted
build: test cdk in aot and closure (#4142)
1 parent efd3485 commit fe7570a

File tree

13 files changed

+36
-28
lines changed

13 files changed

+36
-28
lines changed

scripts/closure-compiler/build-devapp-bundle.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ set -e -o pipefail
88
# Go to the project root directory
99
cd $(dirname $0)/../..
1010

11-
# Build the demo-app and also create the release output.
12-
$(npm bin)/gulp build:devapp
13-
$(npm bin)/gulp :package:release
1411

15-
# Rebuild demo-app with ES2015 modules. Closure compiler is then able to parse imports.
12+
# Build a release of the library and of the CDK package.
13+
$(npm bin)/gulp build:release
14+
$(npm bin)/gulp cdk:build-release
15+
16+
# Build demo-app with ES2015 modules. Closure compiler is then able to parse imports.
17+
$(npm bin)/gulp :build:devapp:assets :build:devapp:scss
1618
$(npm bin)/tsc -p src/demo-app/tsconfig-build.json --target ES2015 --module ES2015
1719

1820
# Re-compile RxJS sources into ES2015. Otherwise closure compiler can't parse it properly.
@@ -40,6 +42,7 @@ OPTS=(
4042
# List of path prefixes to be removed from ES6 & CommonJS modules.
4143
"--js_module_root=dist/packages"
4244
"--js_module_root=dist/releases/material"
45+
"--js_module_root=dist/releases/cdk"
4346
"--js_module_root=node_modules/@angular/core"
4447
"--js_module_root=node_modules/@angular/common"
4548
"--js_module_root=node_modules/@angular/compiler"
@@ -56,8 +59,9 @@ OPTS=(
5659
"--formatting=PRETTY_PRINT"
5760
"--debug"
5861

59-
# Include the Material FESM bundle
62+
# Include the Material and CDK FESM bundles
6063
dist/releases/material/@angular/material.js
64+
dist/releases/cdk/@angular/cdk.js
6165

6266
# Include all Angular FESM bundles.
6367
node_modules/@angular/core/@angular/core.js
@@ -90,4 +94,4 @@ echo ${OPTS[*]} > $closureFlags
9094
# Run the Google Closure compiler java runnable.
9195
java -jar node_modules/google-closure-compiler/compiler.jar --flagfile $closureFlags
9296

93-
echo "Finished bundling the dev-app using google closure compiler.."
97+
echo "Finished bundling the dev-app using google closure compiler.."

scripts/release/publish-docs-content.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repoPath="/tmp/material2-docs-content"
1111
repoUrl="https://github.com/angular/material2-docs-content"
1212
examplesSource="./dist/docs/examples"
1313

14-
$(npm bin)/gulp examples:release
14+
$(npm bin)/gulp examples:build-release:clean
1515
$(npm bin)/gulp docs
1616

1717
# Get git meta info for commit

src/demo-app/system-config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ System.config({
2626
'node:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
2727

2828
'@angular/material': 'dist/bundles/material.umd.js',
29-
// NGC always adds the `index` suffix. As a temporary workaround just map it with that.
30-
'@angular/cdk/index': 'dist/bundles/cdk.umd.js'
29+
'@angular/cdk': 'dist/bundles/cdk.umd.js'
3130
},
3231
packages: {
3332
// Thirdparty barrels.

src/demo-app/tsconfig-aot.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"experimentalDecorators": true,
88
"outDir": ".",
99
"paths": {
10-
"@angular/material": ["./material"]
10+
"@angular/material": ["./material"],
11+
"@angular/cdk": ["./cdk"]
1112
}
1213
},
1314
"files": [

src/demo-app/tsconfig-build.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
],
2020
"baseUrl": ".",
2121
"paths": {
22-
"@angular/material": ["../../dist/packages/material"],
23-
"@angular/cdk": ["../../dist/packages/cdk"]
22+
"@angular/material": ["../../dist/packages/material/public_api"],
23+
"@angular/cdk": ["../../dist/packages/cdk/public_api"]
2424
}
2525
},
2626
"files": [

src/e2e-app/system-config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ System.config({
2626
'node:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
2727

2828
'@angular/material': 'dist/bundles/material.umd.js',
29-
// NGC always adds the `index` suffix. As a temporary workaround just map it with that.
30-
'@angular/cdk/index': 'dist/bundles/cdk.umd.js'
29+
'@angular/cdk': 'dist/bundles/cdk.umd.js'
3130
},
3231
packages: {
3332
// Thirdparty barrels.

src/e2e-app/tsconfig-build.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414
"sourceMap": true,
1515
"target": "es5",
1616
"stripInternal": false,
17-
"baseUrl": "",
1817
"typeRoots": [
1918
"../../node_modules/@types/!(node)"
2019
],
20+
"baseUrl": "",
2121
"paths": {
22-
"@angular/material": [
23-
"../../dist/packages/material"
24-
]
22+
"@angular/material": ["../../dist/packages/material/public_api"]
2523
}
2624
},
2725
"angularCompilerOptions": {

src/lib/tsconfig-build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"types": [],
1818
"baseUrl": ".",
1919
"paths": {
20-
"@angular/cdk": ["../../dist/packages/cdk"]
20+
"@angular/cdk": ["../../dist/packages/cdk/public_api"]
2121
}
2222
},
2323
"files": [

src/material-examples/tsconfig-build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"types": [],
1818
"baseUrl": ".",
1919
"paths": {
20-
"@angular/material": ["../../dist/packages/material"]
20+
"@angular/material": ["../../dist/packages/material/public_api"]
2121
}
2222
},
2323
"files": [

tools/gulp/tasks/aot.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ import {join} from 'path';
77
const tsconfigFile = join(DIST_DEMOAPP, 'tsconfig-aot.json');
88

99
/** Builds the demo-app and library. To be able to run NGC, apply the metadata workaround. */
10-
task('aot:deps', sequenceTask('build:devapp', ':package:release', 'aot:copy-release'));
10+
task('aot:deps', sequenceTask(
11+
'build:devapp',
12+
[':package:release', 'cdk:build-release'],
13+
'aot:copy-release'
14+
));
1115

1216
// As a workaround for https://github.com/angular/angular/issues/12249, we need to
13-
// copy the Material ESM output inside of the demo-app output.
17+
// copy the Material and CDK ESM output inside of the demo-app output.
1418
task('aot:copy-release', () => {
15-
return copySync(join(DIST_RELEASES, 'material'), join(DIST_DEMOAPP, 'material'));
19+
copySync(join(DIST_RELEASES, 'material'), join(DIST_DEMOAPP, 'material'));
20+
copySync(join(DIST_RELEASES, 'cdk'), join(DIST_DEMOAPP, 'cdk'));
1621
});
1722

1823
/** Build the demo-app and a release to confirm that the library is AOT-compatible. */

0 commit comments

Comments
 (0)