build: build cdk with angular from source (#13541)

* build: build cdk with angular from source

* Continues the long-term Bazel goal by fixing the CDK bazel build
targets. Also builds the CDK targets with Angular from source.

Follow up's will try to make serving, and testing possible.

* Build package on CI

* No longer compile with AOT compiler that generates factory files that cannot be packaged into "ng_package"
This commit is contained in:
Paul Gschwendtner
2018-10-11 19:00:40 +02:00
committed by Andrew Seguin
parent a2c23a45be
commit 282736f8be
31 changed files with 199 additions and 162 deletions
+33 -16
View File
@@ -3,17 +3,17 @@ workspace(name = "angular_material")
# Add NodeJS rules (explicitly used for sass bundle rules)
http_archive(
name = "build_bazel_rules_nodejs",
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.14.2.zip",
strip_prefix = "rules_nodejs-0.14.2",
sha256 = "af481421c9e74f754a693a8bf5e9409484e38cf7be6f73f85879bdc7ed1b1d82",
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.15.0.zip",
strip_prefix = "rules_nodejs-0.15.0",
sha256 = "5f5b6464ca20aa63d278caaf4736f0381eb838800d7375132057a48f09d0b837",
)
# Add TypeScript rules
http_archive(
name = "build_bazel_rules_typescript",
url = "https://github.com/bazelbuild/rules_typescript/archive/0.19.1.zip",
strip_prefix = "rules_typescript-0.19.1",
sha256 = "91a03623a03a463ffd62cea3f7a384c2f298af6438d5d153fc4d69aa5665b53d",
url = "https://github.com/bazelbuild/rules_typescript/archive/0.20.2.zip",
strip_prefix = "rules_typescript-0.20.2",
sha256 = "2879fbd7168ba5d17db22bc2f585c0d1d3a82dd5e6f8af118e8b2f74d290024e",
)
# Fetch transient dependencies of the TypeScript bazel rules.
@@ -31,6 +31,27 @@ http_archive(
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
sass_repositories()
# Add Angular source and Bazel rules.
http_archive(
name = "angular",
# Temporarily locked down to the angular/angular:bazel branch. This branch includes necessary
# commits that make building from source possible.
# TODO(devversion): switch to release archive if workaround can be removed
url = "https://github.com/angular/angular/archive/08e4489cf5a93a352954f1639da5e92112993753.zip",
strip_prefix = "angular-08e4489cf5a93a352954f1639da5e92112993753",
sha256 = "a59c85426048cc95f51937d0c26f4d1143b7bef730152b68ac4b79d1438e746b",
)
# Add RxJS as repository because those are needed in order to build Angular from source.
# Also we cannot refer to the RxJS version from the node modules because self-managed
# node modules are not guaranteed to be installed.
http_archive(
name = "rxjs",
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz",
strip_prefix = "package/src",
sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403",
)
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
# your npm dependencies. You must still run the package manager.
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install")
@@ -54,14 +75,10 @@ yarn_install(
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
ts_setup_workspace()
# Add Angular rules
local_repository(
name = "angular",
path = "node_modules/@angular/bazel",
)
# Setup Angular bazel rules
load("@angular//packages/bazel:package.bzl", "rules_angular_dependencies")
rules_angular_dependencies()
# Add rxjs
local_repository(
name = "rxjs",
path = "node_modules/rxjs/src",
)
# Setup Angular workspace for building (Bazel managed node modules)
load("@angular//:index.bzl", "ng_setup_workspace")
ng_setup_workspace()