Skip to content

Commit

Permalink
build: idiomatic install of @angular/bazel npm package (angular#26258) (
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored and IgorMinar committed Oct 20, 2018
1 parent 30d6233 commit 631998b
Show file tree
Hide file tree
Showing 27 changed files with 4,118 additions and 3,621 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
24 changes: 10 additions & 14 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,17 @@ filegroup(

load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")

# Override for ts_web_test_suite to use @ngdeps instead of @npm
# A nodejs_binary for @angular/bazel/ngc-wrapped to use by default in
# ng_module that depends on @npm//@angular/bazel instead of the
# output of the //packages/bazel/src/ngc-wrapped ts_library rule. This
# default is for downstream users that depend on the @angular/bazel npm
# package. The generated @npm//@angular/bazel/ngc-wrapped target
# does not work because it does not have the node `--expose-gc` flag
# set which is required to support the call to `global.gc()`.
nodejs_binary(
name = "@bazel/karma/karma",
data = ["@ngdeps//@bazel/karma"],
entry_point = "@bazel/karma/karma.js",
install_source_map_support = False,
visibility = ["//visibility:public"],
)

# Override for ts_library to use @ngdeps instead of @npm
nodejs_binary(
name = "@bazel/typescript/tsc_wrapped",
data = ["@ngdeps//@bazel/typescript"],
entry_point = "@bazel/typescript/tsc_wrapped/tsc_wrapped.js",
name = "@angular/bazel/ngc-wrapped",
data = ["@npm//@angular/bazel"],
entry_point = "@angular/bazel/src/ngc-wrapped/index.js",
install_source_map_support = False,
templated_args = ["--node_options=--expose-gc"],
visibility = ["//visibility:public"],
)
File renamed without changes.
11 changes: 6 additions & 5 deletions integration/bazel/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ local_repository(
path = "../..",
)

local_repository(
http_archive(
name = "rxjs",
path = "node_modules/rxjs/src",
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz",
strip_prefix = "package/src",
sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403",
)

load("@angular//packages/bazel:package.bzl", "rules_angular_dependencies")
Expand All @@ -26,15 +28,14 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_reposi

check_bazel_version("0.17.0")
node_repositories(
package_json = ["//:package.json"],
node_version = "10.9.0",
yarn_version = "1.9.2",
)

yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
package_json = "//src:package.json",
yarn_lock = "//src:yarn.lock",
)

load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
Expand Down
16 changes: 1 addition & 15 deletions integration/bazel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,9 @@
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"reflect-metadata": "0.1.12",
"rxjs": "6.0.0",
"tslib": "1.9.3",
"zone.js": "0.8.26"
},
"devDependencies": {
"@bazel/karma": "0.20.2",
"@bazel/typescript": "0.20.2",
"@types/jasmine": "2.8.8",
"@types/source-map": "0.5.1",
"protractor": "5.1.2",
"shelljs": "^0.8.2",
"tsickle": "0.32.0",
"typescript": "3.0.1"
},
"scripts": {
"//": "TODO(gmagolan): figure out how to keep dependencies here up to date with the root package.json",
"//": "deps are listed in src/package.json which is used by yarn_install",
"test": "bazel build ... --noshow_progress && bazel test ..."
}
}
27 changes: 27 additions & 0 deletions integration/bazel/src/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "angular-bazel",
"description": "example and integration test for building Angular apps with Bazel",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"reflect-metadata": "0.1.12",
"rxjs": "6.3.3",
"tslib": "1.9.3",
"zone.js": "0.8.26"
},
"devDependencies": {
"@angular/bazel": "file:../angular/dist/packages-dist/bazel",
"@angular/compiler": "file:../angular/dist/packages-dist/compiler",
"@angular/compiler-cli": "file:../angular/dist/packages-dist/compiler-cli",
"@bazel/karma": "0.20.2",
"@bazel/typescript": "0.20.2",
"@types/jasmine": "2.8.8",
"@types/source-map": "0.5.1",
"protractor": "5.1.2",
"tsickle": "0.32.0",
"typescript": "3.1.1"
},
"scripts": {
"//": "TODO(gregmagolan): figure out how to keep dependencies here up to date with the root package.json"
}
}
Loading

0 comments on commit 631998b

Please sign in to comment.