Skip to content

Commit cf39a41

Browse files
authored
build(cdk): add bazel ng_module rules (#8370)
Part of #8369
1 parent 262c23b commit cf39a41

24 files changed

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

angular.tsconfig.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
]
20+
}

0 commit comments

Comments
 (0)