Skip to content

Commit

Permalink
fix(build): ngc compiler resolve failures
Browse files Browse the repository at this point in the history
  • Loading branch information
pimenovoleg committed Jul 11, 2018
1 parent 38c1098 commit 142b157
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/lib/tsconfig.tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"types": ["jasmine"],
"paths": {
"@ptsecurity/mosaic/*": ["./*"],
"@ptsecurity/cdk/*": ["../../dist/packages/cdk/*/public-api"]
"@ptsecurity/cdk/*": ["../../dist/packages/cdk/*"]
}
},
"angularCompilerOptions": {
Expand Down
21 changes: 2 additions & 19 deletions tools/packages/build-package.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as chalk from 'chalk';
import { join } from 'path';

import { PackageBundler } from './build-bundles';
Expand All @@ -8,7 +7,6 @@ import {
compileEntryPoint,
renamePrivateReExportsToBeUnique
} from './compile-entry-point';
import { ngcCompile } from './ngc-compile';
import { getSecondaryEntryPointsForPackage } from './secondary-entry-points';


Expand Down Expand Up @@ -103,7 +101,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));
}

async createBundles() {
Expand All @@ -119,22 +118,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 = chalk.default.red(`Failed to compile ${secondaryEntryPoint} using ${tsconfigPath}`);
/* tslint:disable-next-line:no-console */
console.error(error);

return Promise.reject(error);
});
}

/**
* Stores the secondary entry-points for this package if they haven't been computed already.
*/
Expand Down
5 changes: 4 additions & 1 deletion tools/packages/gulp/build-tasks-gulp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,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

0 comments on commit 142b157

Please sign in to comment.