-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build(cdk): add bazel ng_module rules #8370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
# TODO(jelbourn): figure out if these workarounds are still needed | ||
|
||
# This rule belongs in node_modules/BUILD | ||
# It's here as a workaround for | ||
# https://github.com/bazelbuild/bazel/issues/374#issuecomment-296217940 | ||
filegroup( | ||
name = "node_modules", | ||
# Performance workaround: list individual files | ||
# Reduces the number of files as inputs to nodejs_binary: | ||
# bazel query "deps(:node_modules)" | wc -l | ||
# This won't scale in the general case. | ||
# TODO(alexeagle): figure out what to do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, I have an idea how to fix this if anyone has some time to investigate... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't strike me as that bad- you want to be explicit about your dependencies anyway |
||
srcs = glob(["/".join(["node_modules", pkg, "**", ext]) for pkg in [ | ||
"@angular", | ||
"jasmine", | ||
"typescript", | ||
"tslib", | ||
"zone.js", | ||
"rxjs", | ||
"@types", | ||
"tsickle", | ||
"hammerjs", | ||
"protobufjs", | ||
"bytebuffer", | ||
"reflect-metadata", | ||
"minimist", | ||
"moment", | ||
] for ext in [ | ||
"*.js", | ||
"*.json", | ||
"*.d.ts", | ||
]]), | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
workspace(name = "angular_material_src") | ||
|
||
# Add nodejs rules | ||
git_repository( | ||
name = "build_bazel_rules_nodejs", | ||
remote = "https://github.com/bazelbuild/rules_nodejs.git", | ||
# TODO(jelbourn): use the correct tag here. | ||
commit = "31d36ff2acdf630d1e331f38006cf1a5d303d338", | ||
) | ||
|
||
# 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") | ||
node_repositories(package_json = ["//:package.json"]) | ||
|
||
# Add sass rules | ||
git_repository( | ||
name = "io_bazel_rules_sass", | ||
remote = "https://github.com/bazelbuild/rules_sass.git", | ||
tag = "0.0.2", | ||
) | ||
|
||
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_repositories") | ||
sass_repositories() | ||
|
||
# Add TypeScript rules | ||
local_repository( | ||
name = "build_bazel_rules_typescript", | ||
path = "node_modules/@bazel/typescript", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should explicitly specify this as a dependency: https://www.npmjs.com/package/@bazel/typescript |
||
) | ||
|
||
# Add Angular rules | ||
local_repository( | ||
name = "angular", | ||
path = "node_modules/@angular/bazel", | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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/**" | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should use
//:__subpackages__
as the default visibility everywhere, to avoid external repos depending on our rulesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I try to use that here I get:
For the rest of the rules I'm not too concerned about it right now