Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions src/lib/tsconfig-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"types": ["jasmine"],
"paths": {
"@angular/material/*": ["./*"],
"@angular/cdk/*": ["../../dist/packages/cdk/*/public-api"]
"@angular/cdk/*": ["../../dist/packages/cdk/*"]
}
},
"angularCompilerOptions": {
Expand All @@ -24,6 +24,6 @@
"index.ts"
],
"exclude": [
"**/schematics/**/*.ts",
],
"**/schematics/**/*.ts"
]
}
21 changes: 3 additions & 18 deletions tools/package-tools/build-package.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {join} from 'path';
import {red} from 'chalk';
import {PackageBundler} from './build-bundles';
import {buildConfig} from './build-config';
import {getSecondaryEntryPointsForPackage} from './secondary-entry-points';
import {
addImportAsToAllMetadata,
compileEntryPoint,
renamePrivateReExportsToBeUnique,
} from './compile-entry-point';
import {ngcCompile} from './ngc-compile';
import {getSecondaryEntryPointsForPackage} from './secondary-entry-points';

const {packagesDir, outputDir} = buildConfig;

Expand Down Expand Up @@ -78,7 +76,8 @@ export class BuildPackage {

/** Compiles the TypeScript test source files for the package. */
async compileTests() {
await this._compileTestEntryPoint(testsTsconfigName);
return compileEntryPoint(this, testsTsconfigName)
.then(() => addImportAsToAllMetadata(this));
}

/** Creates all bundles for the package and all associated entry points. */
Expand All @@ -93,20 +92,6 @@ export class BuildPackage {
.then(() => renamePrivateReExportsToBeUnique(this, p));
}

/** Compiles the TypeScript sources of a primary or secondary entry point. */
private _compileTestEntryPoint(tsconfigName: string, secondaryEntryPoint = ''): Promise<any> {
const entryPointPath = join(this.sourceDir, secondaryEntryPoint);
const tsconfigPath = join(entryPointPath, tsconfigName);

return ngcCompile(['-p', tsconfigPath])
.then(() => addImportAsToAllMetadata(this))
.catch(() => {
const error = red(`Failed to compile ${secondaryEntryPoint} using ${tsconfigPath}`);
console.error(error);
return Promise.reject(error);
});
}

/** Stores the secondary entry-points for this package if they haven't been computed already. */
private cacheSecondaryEntryPoints() {
if (!this._secondaryEntryPoints) {
Expand Down
5 changes: 4 additions & 1 deletion tools/package-tools/gulp/build-tasks-gulp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ export function createPackageBuildTasks(buildPackage: BuildPackage, preBuildTask
));

task(`${taskName}:build-no-bundles`, sequenceTask(
// Build assets before building the ESM output. Since we compile with NGC, the compiler
// tries to resolve all required assets.
`${taskName}:assets`,
// Build the ESM output that includes all test files. Also build assets for the package.
[`${taskName}:build:esm:tests`, `${taskName}:assets`],
`${taskName}:build:esm:tests`,
// Inline assets into ESM output.
`${taskName}:assets:inline`
));
Expand Down