diff --git a/src/schematics/app/files/__directory__/__fileName__/BUILD.bazel__tmpl__ b/src/schematics/app/files/__directory__/__fileName__/BUILD.bazel__tmpl__ index 4af0bf76eb9..e01a4277a0a 100644 --- a/src/schematics/app/files/__directory__/__fileName__/BUILD.bazel__tmpl__ +++ b/src/schematics/app/files/__directory__/__fileName__/BUILD.bazel__tmpl__ @@ -1,5 +1,5 @@ package(default_visibility = ["//visibility:public"]) -load("@build_bazel_rules_angular//:defs.bzl", "ng_module") +load("@angular//:index.bzl", "ng_module") load("@nrwl//:webpack.bzl", "webpack_bundle") ng_module( diff --git a/src/schematics/nglib/files/__directory__/__fileName__/BUILD.bazel__tmpl__ b/src/schematics/nglib/files/__directory__/__fileName__/BUILD.bazel__tmpl__ index c7db9e7e93a..fc25f34be9b 100644 --- a/src/schematics/nglib/files/__directory__/__fileName__/BUILD.bazel__tmpl__ +++ b/src/schematics/nglib/files/__directory__/__fileName__/BUILD.bazel__tmpl__ @@ -1,5 +1,5 @@ package(default_visibility = ["//visibility:public"]) -load("@build_bazel_rules_angular//:defs.bzl", "ng_module") +load("@angular//:index.bzl", "ng_module") ng_module( name = "module", diff --git a/src/schematics/workspace/files/BUILD.bazel__tmpl__ b/src/schematics/workspace/files/BUILD.bazel__tmpl__ index ac93f973220..4ad95a53513 100644 --- a/src/schematics/workspace/files/BUILD.bazel__tmpl__ +++ b/src/schematics/workspace/files/BUILD.bazel__tmpl__ @@ -1,40 +1,8 @@ package(default_visibility = ["//visibility:public"]) exports_files(["tsconfig.json"]) -load("@build_bazel_rules_angular//:defs.bzl", "ng_external_libraries") - -# change to glob(["node_modules/**/*.js", "node_modules/**/*.json", "node_modules/**/*.d.ts"]) filegroup(name = "node_modules", srcs = glob([ - # should not be whitelisted - "node_modules/@angular/**", - "node_modules/typescript/**", - "node_modules/zone.js/**", - "node_modules/rxjs/**/*.d.ts", - "node_modules/rxjs/**/*.js", - "node_modules/@types/**/*.d.ts", - "node_modules/tsickle/**", - "node_modules/hammerjs/**/*.d.ts", - "node_modules/protobufjs/**", - "node_modules/bytebuffer/**", - "node_modules/reflect-metadata/**", - "node_modules/minimist/**/*.js", - "node_modules/webpack/**" + "node_modules/**/*.json", + "node_modules/**/*.js", + "node_modules/**/*.d.ts", ], exclude=["node_modules/@angular/cli/**"])) - -# this should go away soon when we do bootstrap codegen in the scripts.postinstall -ng_external_libraries(name = "ng_libs", srcs = glob([ - "node_modules/@angular/**" -], exclude = [ - "node_modules/@angular/cli/**", - "node_modules/@angular/platform-browser/animations*", - "node_modules/@angular/platform-browser/animations/**", - "node_modules/@angular/router*", - "node_modules/@angular/router/**", -])) - -filegroup( - name= "init", - srcs = [ - ":ng_libs" - ] -) diff --git a/src/schematics/workspace/files/WORKSPACE__tmpl__ b/src/schematics/workspace/files/WORKSPACE__tmpl__ index 9121178a212..9b7d66e496a 100644 --- a/src/schematics/workspace/files/WORKSPACE__tmpl__ +++ b/src/schematics/workspace/files/WORKSPACE__tmpl__ @@ -1,27 +1,19 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") git_repository( - name = "build_bazel_rules_typescript", - remote = "https://github.com/vsavkin/rules_typescript", - commit = "9a6c806", -) - -git_repository( - name = "build_bazel_rules_angular", - remote = "https://github.com/alexeagle/rules_angular", - commit = "ce85fe6", + name = "build_bazel_rules_nodejs", + remote = "https://github.com/bazelbuild/rules_nodejs.git", + tag = "0.0.2", ) -git_repository( - name = "io_bazel_rules_sass", - remote = "https://github.com/bazelbuild/rules_sass.git", - tag = "0.0.2", +local_repository( + name = "build_bazel_rules_typescript", + path = "node_modules/@bazel/typescript", ) -git_repository( - name = "build_bazel_rules_nodejs", - remote = "https://github.com/alexeagle/rules_nodejs.git", - commit = "4924d7b", +local_repository( + name = "angular", + path = "node_modules/@angular/bazel", ) local_repository( @@ -29,8 +21,14 @@ local_repository( path = "node_modules/@nrwl/nx/bazel", ) -load("@build_bazel_rules_typescript//:defs.bzl", "node_repositories") +git_repository( + name = "io_bazel_rules_sass", + remote = "https://github.com/bazelbuild/rules_sass.git", + tag = "0.0.2", +) + +load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories") load("@io_bazel_rules_sass//sass:sass.bzl", "sass_repositories") -node_repositories(package_json = "//:package.json") +node_repositories(package_json = ["//:package.json"]) sass_repositories() diff --git a/src/schematics/workspace/files/angular.tsconfig.json__tmpl__ b/src/schematics/workspace/files/angular.tsconfig.json__tmpl__ new file mode 100644 index 00000000000..0bdd1b56629 --- /dev/null +++ b/src/schematics/workspace/files/angular.tsconfig.json__tmpl__ @@ -0,0 +1,23 @@ +// WORKAROUND https://github.com/angular/angular/issues/18810 +// This file is required to run ngc on angular libraries, to write files like +// node_modules/@angular/core/core.ngsummary.json +{ + "compilerOptions": { + "lib": [ + "dom", + "es2015" + ], + "experimentalDecorators": true, + "types": [] + }, + "include": [ + "node_modules/@angular/**/*" + ], + "exclude": [ + "node_modules/@angular/bazel/**", + "node_modules/@angular/compiler-cli/**", + // Workaround bug introduced by 079d884 + "node_modules/@angular/common/i18n_data*", + "node_modules/@angular/tsc-wrapped/**" + ] +} diff --git a/src/schematics/workspace/files/package.json__tmpl__ b/src/schematics/workspace/files/package.json__tmpl__ index 945c9511996..694ccdb2adf 100644 --- a/src/schematics/workspace/files/package.json__tmpl__ +++ b/src/schematics/workspace/files/package.json__tmpl__ @@ -8,19 +8,20 @@ "build": "ng build", "test": "ng test", "lint": "ng lint", - "e2e": "ng e2e" + "e2e": "ng e2e", + "postinstall": "ngc -p angular.tsconfig.json" }, "private": true, "dependencies": { - "@angular/animations": "4.3.0", - "@angular/common": "4.3.0", - "@angular/compiler": "4.3.0", - "@angular/core": "4.3.0", - "@angular/forms": "4.3.0", - "@angular/http": "4.3.0", - "@angular/platform-browser": "4.3.0", - "@angular/platform-browser-dynamic": "4.3.0", - "@angular/router": "4.3.0", + "@angular/animations": "angular/animations-builds", + "@angular/common": "angular/common-builds", + "@angular/compiler": "angular/compiler-builds", + "@angular/core": "angular/core-builds", + "@angular/forms": "angular/forms-builds", + "@angular/http": "angular/http-builds", + "@angular/platform-browser": "angular/platform-browser-builds", + "@angular/platform-browser-dynamic": "angular/platform-browser-dynamic-builds", + "@angular/router": "angular/router-builds", "core-js": "^2.4.1", "rxjs": "^5.4.2", "zone.js": "^0.8.14" @@ -28,8 +29,9 @@ "devDependencies": { "@angular/cli": "https://github.com/nrwl/bazel-cli-build", "@nrwl/nx": "https://github.com/nrwl/nx-build", - "@angular/compiler-cli": "4.3.0", - "@angular/language-service": "4.3.0", + "@angular/bazel": "angular/bazel-builds", + "@angular/compiler-cli": "angular/compiler-cli-builds", + "@angular/language-service": "angular/language-service-builds", "@types/jasmine": "~2.5.53", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60",