diff --git a/src/lib/tsconfig-tests.json b/src/lib/tsconfig-tests.json index 71a2f109b594..9435c945af1e 100644 --- a/src/lib/tsconfig-tests.json +++ b/src/lib/tsconfig-tests.json @@ -10,7 +10,7 @@ "types": ["jasmine"], "paths": { "@angular/material/*": ["./*"], - "@angular/cdk/*": ["../../dist/packages/cdk/*/public-api"] + "@angular/cdk/*": ["../../dist/packages/cdk/*"] } }, "angularCompilerOptions": { @@ -24,6 +24,6 @@ "index.ts" ], "exclude": [ - "**/schematics/**/*.ts", - ], + "**/schematics/**/*.ts" + ] } diff --git a/tools/package-tools/build-package.ts b/tools/package-tools/build-package.ts index 8c25d7e99b18..b32bfde3bdbf 100644 --- a/tools/package-tools/build-package.ts +++ b/tools/package-tools/build-package.ts @@ -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; @@ -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. */ @@ -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 { - 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) { diff --git a/tools/package-tools/gulp/build-tasks-gulp.ts b/tools/package-tools/gulp/build-tasks-gulp.ts index f0995746d072..924fe52ad369 100644 --- a/tools/package-tools/gulp/build-tasks-gulp.ts +++ b/tools/package-tools/gulp/build-tasks-gulp.ts @@ -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` ));