Skip to content

Commit

Permalink
build: fix broken bazel build (#18335)
Browse files Browse the repository at this point in the history
  • Loading branch information
adeora authored and mhevery committed Jul 26, 2017
1 parent b582e2b commit 205abe8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/compiler-cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export * from './src/transformers/api';
export * from './src/transformers/entry_points';

export {main as ngc} from './src/ngc';
export {performCompilation} from './src/ngc';

// TODO(hansl): moving to Angular 4 need to update this API.
export {NgTools_InternalApi_NG_2 as __NGTOOLS_PRIVATE_API_2} from './src/ngtools_api';
14 changes: 11 additions & 3 deletions tools/ngc-wrapped/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@
// TODO(chuckj): Remove the requirment for a fake 'reflect` implementation from
// the compiler
import 'reflect-metadata';
import {ngc} from '@angular/compiler-cli';
import {performCompilation} from '@angular/compiler-cli';
import * as fs from 'fs';
import * as path from 'path';
// Note, the tsc_wrapped module comes from rules_typescript, not from @angular/tsc-wrapped
import {parseTsconfig} from 'tsc_wrapped';

function main(args: string[]) {
const [{options, bazelOpts, files, config}] = parseTsconfig(args[1]);
const ngOptions: {expectedOut: string[]} = (config as any).angularCompilerOptions;

const result = ngc(args, undefined, files, options, ngOptions);
const parsedArgs = require('minimist')(args);
const project = parsedArgs.p || parsedArgs.project || '.';

const projectDir = fs.lstatSync(project).isFile() ? path.dirname(project) : project;

// file names in tsconfig are resolved relative to this absolute path
const basePath = path.resolve(process.cwd(), projectDir);
const result = performCompilation(basePath, files, options, ngOptions, undefined);

if (result === 0) {
// Ensure that expected output files exist.
Expand All @@ -34,4 +42,4 @@ function main(args: string[]) {

if (require.main === module) {
process.exitCode = main(process.argv.slice(2));
}
}

0 comments on commit 205abe8

Please sign in to comment.