diff --git a/packages/compiler-cli/BUILD.bazel b/packages/compiler-cli/BUILD.bazel deleted file mode 100644 index 02d37f163f..0000000000 --- a/packages/compiler-cli/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -package(default_visibility=["//visibility:public"]) -load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") - -ts_library( - name = "compiler-cli", - srcs = glob(["**/*.ts"], exclude=[ - "integrationtest/**", - "test/**", - ]), - module_name = "@angular/compiler-cli", - deps = [ - "//packages/compiler", - "//packages/core", - "//packages/tsc-wrapped", - ], - tsconfig = ":tsconfig-build.json", -) diff --git a/packages/compiler-cli/src/compiler_host.ts b/packages/compiler-cli/src/compiler_host.ts index 04d5083770..03424e9ebc 100644 --- a/packages/compiler-cli/src/compiler_host.ts +++ b/packages/compiler-cli/src/compiler_host.ts @@ -41,8 +41,8 @@ export class CompilerHost implements AotCompilerHost { protected program: ts.Program, protected options: AngularCompilerOptions, protected context: CompilerHostContext, collectorOptions?: CollectorOptions) { // normalize the path so that it never ends with '/'. - this.basePath = path.normalize(path.join(this.options.basePath !, '.')).replace(/\\/g, '/'); - this.genDir = path.normalize(path.join(this.options.genDir !, '.')).replace(/\\/g, '/'); + this.basePath = path.normalize(path.join(this.options.basePath, '.')).replace(/\\/g, '/'); + this.genDir = path.normalize(path.join(this.options.genDir, '.')).replace(/\\/g, '/'); const genPath: string = path.relative(this.basePath, this.genDir); this.isGenDirChildOfRootDir = genPath === '' || !genPath.startsWith('..'); @@ -312,7 +312,7 @@ export class CompilerHost implements AotCompilerHost { relativePath = relativePath.substr(3); } - return path.join(this.options.genDir !, relativePath); + return path.join(this.options.genDir, relativePath); } private hasBundleIndex(filePath: string): boolean { diff --git a/packages/compiler-cli/src/extractor.ts b/packages/compiler-cli/src/extractor.ts index e87a370d76..99a6e8f9f7 100644 --- a/packages/compiler-cli/src/extractor.ts +++ b/packages/compiler-cli/src/extractor.ts @@ -36,7 +36,7 @@ export class Extractor { return promiseBundle.then(bundle => { const content = this.serialize(bundle, formatName); const dstFile = outFile || `messages.${ext}`; - const dstPath = path.join(this.options.genDir !, dstFile); + const dstPath = path.join(this.options.genDir, dstFile); this.host.writeFile(dstPath, content, false); return [dstPath]; }); diff --git a/packages/compiler-cli/src/transformers/module_filename_resolver.ts b/packages/compiler-cli/src/transformers/module_filename_resolver.ts index 9c224d85de..5cf3012e2b 100644 --- a/packages/compiler-cli/src/transformers/module_filename_resolver.ts +++ b/packages/compiler-cli/src/transformers/module_filename_resolver.ts @@ -27,8 +27,8 @@ class SingleRootDirModuleFilenameResolver implements ModuleFilenameResolver { constructor(private host: ModuleFilenameResolutionHost, private options: CompilerOptions) { // normalize the path so that it never ends with '/'. - this.basePath = path.normalize(path.join(options.basePath !, '.')).replace(/\\/g, '/'); - this.genDir = path.normalize(path.join(options.genDir !, '.')).replace(/\\/g, '/'); + this.basePath = path.normalize(path.join(options.basePath, '.')).replace(/\\/g, '/'); + this.genDir = path.normalize(path.join(options.genDir, '.')).replace(/\\/g, '/'); const genPath: string = path.relative(this.basePath, this.genDir); this.isGenDirChildOfRootDir = genPath === '' || !genPath.startsWith('..'); @@ -153,7 +153,7 @@ class MultipleRootDirModuleFilenameResolver implements ModuleFilenameResolver { constructor(private host: ModuleFilenameResolutionHost, private options: CompilerOptions) { // normalize the path so that it never ends with '/'. - this.basePath = path.normalize(path.join(options.basePath !, '.')).replace(/\\/g, '/'); + this.basePath = path.normalize(path.join(options.basePath, '.')).replace(/\\/g, '/'); } getNgCanonicalFileName(fileName: string): string { diff --git a/packages/compiler/BUILD.bazel b/packages/compiler/BUILD.bazel deleted file mode 100644 index 857fadd6e0..0000000000 --- a/packages/compiler/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -package(default_visibility=["//visibility:public"]) -load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") - -ts_library( - name = "compiler", - srcs = glob(["**/*.ts"], exclude=[ - "test/**", - "testing/**", - ]), - module_name = "@angular/compiler", - deps = ["//packages/core"], - tsconfig = ":tsconfig-build.json", -) diff --git a/packages/core/BUILD.bazel b/packages/core/BUILD.bazel index b0654c1ca6..d2c76b4d2a 100644 --- a/packages/core/BUILD.bazel +++ b/packages/core/BUILD.bazel @@ -11,18 +11,3 @@ ts_library( deps = [], tsconfig = ":tsconfig-build.json", ) - -load("@build_bazel_rules_angular//:defs.bzl", "ng_module") - -ng_module( - name = "core_ng_module", - srcs = glob(["**/*.ts"], exclude=[ - "test/**", - "testing/**", - ]), - # Needed to allow (ts_library,ng_module) pair - write_ng_outputs_only = True, - module_name = "@angular/core", - tsconfig = ":tsconfig-build.json", - compiler = "//tools/ngc-wrapped" -) \ No newline at end of file diff --git a/packages/tsc-wrapped/BUILD.bazel b/packages/tsc-wrapped/BUILD.bazel deleted file mode 100644 index f86cf576c8..0000000000 --- a/packages/tsc-wrapped/BUILD.bazel +++ /dev/null @@ -1,11 +0,0 @@ -package(default_visibility=["//visibility:public"]) -load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") - -ts_library( - name = "tsc-wrapped", - srcs = glob(["**/*.ts"], exclude=[ - "test/**", - ]), - module_name = "@angular/tsc-wrapped", - tsconfig = ":tsconfig-build.json", -) diff --git a/tools/ngc-wrapped/BUILD.bazel b/tools/ngc-wrapped/BUILD.bazel deleted file mode 100644 index fb5d5cf7ac..0000000000 --- a/tools/ngc-wrapped/BUILD.bazel +++ /dev/null @@ -1,19 +0,0 @@ -load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "nodejs_binary") - -licenses(["notice"]) # Apache 2.0 - -ts_library( - name = "ngc_lib", - srcs = ["index.ts"], - deps = [ - "//packages/compiler-cli", - "@build_bazel_rules_typescript//internal/tsc_wrapped" - ], -) - -nodejs_binary( - name = "ngc-wrapped", - entry_point = "__main__/tools/ngc-wrapped/index.js", - data = [":ngc_lib"], - visibility = ["//visibility:public"], -) \ No newline at end of file diff --git a/tools/ngc-wrapped/README.md b/tools/ngc-wrapped/README.md deleted file mode 100644 index 4f4487e48b..0000000000 --- a/tools/ngc-wrapped/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# ngc-wrapped - -This is a wrapper around @angular/compiler-cli that makes ngc run under Bazel. -It should be identical to https://github.com/bazelbuild/rules_angular/tree/master/internal/ngc -however that is built against Angular packages from npm, while ngc-wrapped is -built using Bazel against Angular at HEAD. diff --git a/tools/ngc-wrapped/index.ts b/tools/ngc-wrapped/index.ts deleted file mode 100644 index 3929ccb05a..0000000000 --- a/tools/ngc-wrapped/index.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -// TODO(chuckj): Remove the requirment for a fake 'reflect` implementation from -// the compiler -import 'reflect-metadata'; -import {ngc} from '@angular/compiler-cli'; -import * as fs from 'fs'; -// 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); - - if (result === 0) { - // Ensure that expected output files exist. - if (ngOptions && ngOptions.expectedOut) { - for (const out of ngOptions.expectedOut) { - fs.appendFileSync(out, '', 'utf-8'); - } - } - } - - return result; -} - -if (require.main === module) { - process.exitCode = main(process.argv.slice(2)); -} \ No newline at end of file diff --git a/tools/tsconfig.json b/tools/tsconfig.json index 58702a2c06..f16b62ee1d 100644 --- a/tools/tsconfig.json +++ b/tools/tsconfig.json @@ -9,22 +9,19 @@ "outDir": "../dist/tools/", "noImplicitAny": true, "noFallthroughCasesInSwitch": true, - "paths": {}, + "paths": { + }, "rootDir": ".", "sourceMap": true, "inlineSources": true, - "lib": [ - "es6", - "dom" - ], + "lib": ["es6", "dom"], "target": "es5", "skipLibCheck": true }, "exclude": [ "node_modules", - "ngc-wrapped", "typings-test", "public_api_guard", "docs" ] -} \ No newline at end of file +}