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
+8 -1
View File
@@ -6,12 +6,19 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
ts_library(
name = "sass_bundle_lib",
srcs = ["sass_bundle.ts"],
deps = [
"@npm//@types/node",
"@npm//scss-bundle",
],
tsconfig = "bazel-tools-tsconfig.json",
)
# Executable for the custom sass_bundle rule (see sass_bundle.bzl).
nodejs_binary(
name = "sass_bundle",
data = [":sass_bundle_lib"],
data = [
"@npm//scss-bundle",
":sass_bundle_lib",
],
entry_point = "angular_material/tools/sass_bundle.js",
)
+4
View File
@@ -46,3 +46,7 @@ build --workspace_status_command=./tools/bazel-stamp-vars.sh
# Make TypeScript and Angular compilation fast, by keeping a few copies of the compiler
# running as daemons, and cache SourceFile AST's to reduce parse time.
build --strategy=TypeScriptCompile=worker --strategy=AngularTemplateCompile=worker
# Use the new "ngtsc" compiler strategy. We don't want to compile with Ivy nor with the
# legacy compiler that doesn't handle `providedIn` properly.
build --define=compile=local
+19 -2
View File
@@ -1,12 +1,29 @@
# Re-export of Bazel rules with repository-wide defaults
load("@angular//:index.bzl", _ng_module = "ng_module")
load("@build_bazel_rules_nodejs//:defs.bzl", _jasmine_node_test = "jasmine_node_test")
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library")
def ts_library(deps = [], **kwargs):
ts_library(**kwargs)
def ng_module(deps = [], **kwargs):
local_deps = [
# Since we use the TypeScript import helpers (tslib) for each TypeScript configuration,
# we declare TSLib as default dependency
"@npm//tslib",
] + deps
_ng_module(
deps = local_deps,
**kwargs
)
def jasmine_node_test(deps = [], **kwargs):
local_deps = [
# Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/344
"@npm//:jasmine",
"@npm//:source-map-support",
"@npm//jasmine",
"@npm//source-map-support",
] + deps
_jasmine_node_test(