build: fix broken bazel build (#18335)

This commit is contained in:
Abhimanyu Deora 2017-07-26 11:40:33 -05:00 committed by Miško Hevery
parent b582e2b311
commit 205abe8140
2 changed files with 12 additions and 3 deletions

View File

@ -21,6 +21,7 @@ export * from './src/transformers/api';
export * from './src/transformers/entry_points'; export * from './src/transformers/entry_points';
export {main as ngc} from './src/ngc'; export {main as ngc} from './src/ngc';
export {performCompilation} from './src/ngc';
// TODO(hansl): moving to Angular 4 need to update this API. // 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'; export {NgTools_InternalApi_NG_2 as __NGTOOLS_PRIVATE_API_2} from './src/ngtools_api';

View File

@ -9,8 +9,9 @@
// TODO(chuckj): Remove the requirment for a fake 'reflect` implementation from // TODO(chuckj): Remove the requirment for a fake 'reflect` implementation from
// the compiler // the compiler
import 'reflect-metadata'; import 'reflect-metadata';
import {ngc} from '@angular/compiler-cli'; import {performCompilation} from '@angular/compiler-cli';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path';
// Note, the tsc_wrapped module comes from rules_typescript, not from @angular/tsc-wrapped // Note, the tsc_wrapped module comes from rules_typescript, not from @angular/tsc-wrapped
import {parseTsconfig} from 'tsc_wrapped'; import {parseTsconfig} from 'tsc_wrapped';
@ -18,7 +19,14 @@ function main(args: string[]) {
const [{options, bazelOpts, files, config}] = parseTsconfig(args[1]); const [{options, bazelOpts, files, config}] = parseTsconfig(args[1]);
const ngOptions: {expectedOut: string[]} = (config as any).angularCompilerOptions; 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) { if (result === 0) {
// Ensure that expected output files exist. // Ensure that expected output files exist.
@ -34,4 +42,4 @@ function main(args: string[]) {
if (require.main === module) { if (require.main === module) {
process.exitCode = main(process.argv.slice(2)); process.exitCode = main(process.argv.slice(2));
} }