Skip to content

Commit fef0808

Browse files
committed
build(cdk): add bazel ng_module rules
Part of #8369
1 parent 3510064 commit fef0808

24 files changed

+6609
-3202
lines changed

BUILD.bazel

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
# TODO(jelbourn): figure out if these workarounds are still needed
4+
5+
# This rule belongs in node_modules/BUILD
6+
# It's here as a workaround for
7+
# https://github.com/bazelbuild/bazel/issues/374#issuecomment-296217940
8+
filegroup(
9+
name = "node_modules",
10+
# Performance workaround: list individual files
11+
# Reduces the number of files as inputs to nodejs_binary:
12+
# bazel query "deps(:node_modules)" | wc -l
13+
# This won't scale in the general case.
14+
# TODO(alexeagle): figure out what to do
15+
srcs = glob(["/".join(["node_modules", pkg, "**", ext]) for pkg in [
16+
"@angular",
17+
"jasmine",
18+
"typescript",
19+
"tslib",
20+
"zone.js",
21+
"rxjs",
22+
"@types",
23+
"tsickle",
24+
"hammerjs",
25+
"protobufjs",
26+
"bytebuffer",
27+
"reflect-metadata",
28+
"minimist",
29+
"moment",
30+
] for ext in [
31+
"*.js",
32+
"*.json",
33+
"*.d.ts",
34+
]]),
35+
)

WORKSPACE

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
workspace(name = "angular_material_src")
2+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
3+
4+
5+
# Add nodejs rules
6+
git_repository(
7+
name = "build_bazel_rules_nodejs",
8+
remote = "https://github.com/bazelbuild/rules_nodejs.git",
9+
# TODO(jelbourn): use the correct tag here.
10+
commit = "31d36ff2acdf630d1e331f38006cf1a5d303d338",
11+
)
12+
13+
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
14+
# your npm dependencies. You must still run the package manager.
15+
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
16+
node_repositories(package_json = ["//:package.json"])
17+
18+
# Add sass rules
19+
git_repository(
20+
name = "io_bazel_rules_sass",
21+
remote = "https://github.com/bazelbuild/rules_sass.git",
22+
tag = "0.0.2",
23+
)
24+
25+
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_repositories")
26+
sass_repositories()
27+
28+
# Add TypeScript rules
29+
local_repository(
30+
name = "build_bazel_rules_typescript",
31+
path = "node_modules/@bazel/typescript",
32+
)
33+
34+
# Add Angular rules
35+
local_repository(
36+
name = "angular",
37+
path = "node_modules/@angular/bazel",
38+
)

angular.tsconfig.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// WORKAROUND https://github.com/angular/angular/issues/18810
2+
// This file is required to run ngc on angular libraries, to write files like
3+
// node_modules/@angular/core/core.ngsummary.json
4+
{
5+
"compilerOptions": {
6+
"lib": [
7+
"dom",
8+
"es2015"
9+
],
10+
"experimentalDecorators": true,
11+
"types": []
12+
},
13+
"include": [
14+
"node_modules/@angular/**/*"
15+
],
16+
"exclude": [
17+
"node_modules/@angular/bazel/**",
18+
"node_modules/@angular/compiler-cli/**",
19+
// Workaround bug introduced by 079d884
20+
"node_modules/@angular/common/i18n_data*",
21+
"node_modules/@angular/common/locales.d.ts",
22+
"node_modules/@angular/common/locales/**",
23+
"node_modules/@angular/tsc-wrapped/**"
24+
]
25+
}

0 commit comments

Comments
 (0)