-
Notifications
You must be signed in to change notification settings - Fork 12k
Use Bazel for repo unit tests #11749
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
7ad0d0b
34fad75
166dc51
a2d999d
bb9c5c3
c1b7a08
bf0d240
6687593
515d4ca
534df70
f660e3a
7edb94b
6a598fe
1edc071
c7d86fd
8f2f518
f4fd44f
4bf5321
d1d99e5
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 |
---|---|---|
@@ -1,52 +1,66 @@ | ||
workspace(name = "angular_devkit") | ||
|
||
# We get Buildifier from here. | ||
http_archive( | ||
name = "build_bazel_rules_nodejs", | ||
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.4.1.zip", | ||
strip_prefix = "rules_nodejs-0.4.1", | ||
sha256 = "e9bc013417272b17f302dc169ad597f05561bb277451f010043f4da493417607", | ||
name = "com_github_bazelbuild_buildtools", | ||
url = "https://github.com/bazelbuild/buildtools/archive/0.15.0.zip", | ||
strip_prefix = "buildtools-0.15.0", | ||
sha256 = "76d1837a86fa6ef5b4a07438f8489f00bfa1b841e5643b618e01232ba884b1fe", | ||
) | ||
|
||
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories") | ||
load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies") | ||
buildifier_dependencies() | ||
|
||
check_bazel_version("0.9.0") | ||
node_repositories(package_json = ["//:package.json"]) | ||
# The Go toolchain is used for Buildifier. | ||
# rules_typescript_dependencies() also tries to load it but we add it explicitely so we | ||
# don't have hidden dependencies. | ||
# This also means we need to load it before rules_typescript_dependencies(). | ||
http_archive( | ||
name = "io_bazel_rules_go", | ||
url = "https://github.com/bazelbuild/rules_go/archive/0.14.0.zip", | ||
strip_prefix = "rules_go-0.14.0", | ||
sha256 = "9bd7c2743f014e4e112b671098ba1da6aec036fe07093b10ca39a9f81ec5cc33", | ||
) | ||
|
||
local_repository( | ||
name = "rxjs", | ||
path = "node_modules/rxjs/src", | ||
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies") | ||
go_rules_dependencies() | ||
go_register_toolchains() | ||
|
||
# We need a minimum of this version to include https://github.com/bazelbuild/rules_nodejs/pull/281. | ||
http_archive( | ||
name = "build_bazel_rules_nodejs", | ||
url = "https://github.com/bazelbuild/rules_nodejs/archive/c75e3dd0571b0937e3ce0c4f0e6b6b50d90468f0.zip", | ||
strip_prefix = "rules_nodejs-c75e3dd0571b0937e3ce0c4f0e6b6b50d90468f0", | ||
sha256 = "b78506ddaed7c682027f873d2bd50086a28570b3187da9fa16fe1672eed3015e", | ||
) | ||
|
||
# Pick up the fix for source-map typings | ||
RULES_TYPESCRIPT_VERSION = "00f8fd5467f2b12ac2fbb8d74ea81d2dd5636d31" | ||
# Load the TypeScript rules, its dependencies, and setup the workspace. | ||
http_archive( | ||
name = "build_bazel_rules_typescript", | ||
url = "https://github.com/bazelbuild/rules_typescript/archive/%s.zip" % RULES_TYPESCRIPT_VERSION, | ||
strip_prefix = "rules_typescript-%s" % RULES_TYPESCRIPT_VERSION, | ||
sha256 = "3606b97a4859cc3f73b47888618b14290cf4b93c411b1bedd821e8bb39b3442b", | ||
url = "https://github.com/bazelbuild/rules_typescript/archive/0.16.1.zip", | ||
strip_prefix = "rules_typescript-0.16.1", | ||
sha256 = "5b2b0bc63cfcffe7bf97cad2dad3b26a73362f806de66207051f66c87956a995", | ||
) | ||
|
||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") | ||
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies") | ||
# build_bazel_rules_nodejs is loaded transitively through rules_typescript_dependencies. | ||
rules_typescript_dependencies() | ||
|
||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") | ||
ts_setup_workspace() | ||
|
||
# We get tools like Buildifier from here | ||
git_repository( | ||
name = "com_github_bazelbuild_buildtools", | ||
remote = "https://github.com/bazelbuild/buildtools.git", | ||
commit = "b3b620e8bcff18ed3378cd3f35ebeb7016d71f71", | ||
) | ||
# Load the nodejs dependencies, check minimum Bazel version, and define the local node_modules. | ||
load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dependencies") | ||
rules_nodejs_dependencies() | ||
|
||
# The Go toolchain is used for Buildifier and some TypeScript tooling. | ||
http_archive( | ||
name = "io_bazel_rules_go", | ||
url = "https://github.com/bazelbuild/rules_go/releases/download/0.7.1/rules_go-0.7.1.tar.gz", | ||
sha256 = "341d5eacef704415386974bc82a1783a8b7ffbff2ab6ba02375e1ca20d9b031c", | ||
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories") | ||
check_bazel_version("0.15.0") | ||
node_repositories( | ||
package_json = ["//:package.json"], | ||
preserve_symlinks = True, | ||
) | ||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") | ||
|
||
go_rules_dependencies() | ||
|
||
go_register_toolchains() | ||
|
||
local_repository( | ||
name = "rxjs", | ||
path = "node_modules/rxjs/src", | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,35 +5,26 @@ | |
|
||
licenses(["notice"]) # MIT | ||
|
||
load("//tools:defaults.bzl", "ts_library") | ||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
ts_library( | ||
name = "architect", | ||
srcs = glob( | ||
["src/**/*.ts"], | ||
# Currently, this library is used only with the rollup plugin. | ||
# To make it simpler for downstream repositories to compile this, we | ||
# neither provide compile-time deps as an `npm_install` rule, nor do we | ||
# expect the downstream repository to install @types/webpack[-*] | ||
# So we exclude files that depend on webpack typings. | ||
include = ["src/**/*.ts"], | ||
exclude = [ | ||
"**/*_spec.ts", | ||
"**/*_spec_large.ts", | ||
], | ||
), | ||
module_name = "@angular-devkit/architect", | ||
module_root = "src/index.d.ts", | ||
data = glob(["**/*.json"]), | ||
deps = [ | ||
"//packages/angular_devkit/core", | ||
"//packages/angular_devkit/core:node", | ||
"@rxjs", | ||
"@rxjs//operators", | ||
], | ||
tsconfig = "//:tsconfig.json", | ||
module_name = "@angular-devkit/architect", | ||
module_root = "src", | ||
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. why do we no longer need module root? 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 do, but it's added above (before data). |
||
# Borrow the compile-time deps of the typescript compiler | ||
# Just to avoid an extra npm install action. | ||
node_modules = "@build_bazel_rules_typescript_tsc_wrapped_deps//:node_modules", | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,29 +5,44 @@ | |
|
||
licenses(["notice"]) # MIT | ||
|
||
load("//tools:defaults.bzl", "ts_library") | ||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") | ||
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
ts_library( | ||
name = "lib", | ||
name = "build_optimizer", | ||
srcs = glob( | ||
["**/*.ts"], | ||
# Currently, this library is used only with the rollup plugin. | ||
# To make it simpler for downstream repositories to compile this, we | ||
# neither provide compile-time deps as an `npm_install` rule, nor do we | ||
# expect the downstream repository to install @types/webpack[-*] | ||
# So we exclude files that depend on webpack typings. | ||
include = ["src/**/*.ts"], | ||
exclude = [ | ||
"src/build-optimizer/webpack-loader.ts", | ||
"src/purify/**", | ||
"src/index.ts", | ||
"**/*_spec.ts", | ||
"**/*_spec_large.ts", | ||
# TODO(@filipesilva): shouldn't need to exclude the cli files but can't exclude them | ||
# from jasmine_node_test. | ||
"src/**/cli.ts", | ||
"src/**/*_spec.ts", | ||
"src/**/*_spec_large.ts", | ||
"src/**/*_benchmark.ts", | ||
], | ||
), | ||
tsconfig = "//:tsconfig.json", | ||
# Borrow the compile-time deps of the typescript compiler | ||
# Just to avoid an extra npm install action. | ||
node_modules = "@build_bazel_rules_typescript_tsc_wrapped_deps//:node_modules", | ||
deps = [], | ||
) | ||
|
||
ts_library( | ||
name = "build_optimizer_test_lib", | ||
srcs = glob( | ||
include = [ | ||
"src/**/*_spec.ts", | ||
"src/**/*_spec_large.ts", | ||
], | ||
), | ||
deps = [ | ||
":build_optimizer", | ||
"//packages/angular_devkit/core", | ||
# @typings: jasmine | ||
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. will be interesting to sync this to google3 and see if all the tests pass there too |
||
# @typings: node | ||
], | ||
) | ||
|
||
jasmine_node_test( | ||
name = "build_optimizer_test", | ||
srcs = [":build_optimizer_test_lib"], | ||
) |
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.
why remove the comment? was it stale?
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.
The comment is not applicable at all. It looks like it was copy pasted from the build-optimizer BUILD file.