build: fix broken bazel build (#18335)
This commit is contained in:
parent
b582e2b311
commit
205abe8140
|
@ -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';
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
// 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';
|
||||
|
||||
|
@ -18,7 +19,14 @@ 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.
|
||||
|
@ -34,4 +42,4 @@ function main(args: string[]) {
|
|||
|
||||
if (require.main === module) {
|
||||
process.exitCode = main(process.argv.slice(2));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue