Skip to content

Commit 6a598fe

Browse files
committed
build: simplify bazel dependencies
1 parent 7edb94b commit 6a598fe

File tree

14 files changed

+120
-271
lines changed

14 files changed

+120
-271
lines changed

WORKSPACE

Lines changed: 37 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,55 @@
11
workspace(name = "angular_devkit")
22

3-
BAZEL_SKYLIB_VERSION = "0.3.1"
3+
# We get Buildifier from here.
44
http_archive(
5-
name = "bazel_skylib",
6-
url = "https://github.com/bazelbuild/bazel-skylib/archive/%s.zip" % BAZEL_SKYLIB_VERSION,
7-
strip_prefix = "bazel-skylib-%s" % BAZEL_SKYLIB_VERSION,
8-
sha256 = "95518adafc9a2b656667bbf517a952e54ce7f350779d0dd95133db4eb5c27fb1",
9-
)
10-
11-
RULES_NODEJS_VERSION = "caae26b8cfc29838969e0614ebcb551a0e39ba26"
12-
http_archive(
13-
name = "build_bazel_rules_nodejs",
14-
url = "https://github.com/bazelbuild/rules_nodejs/archive/%s.zip" % RULES_NODEJS_VERSION,
15-
strip_prefix = "rules_nodejs-%s" % RULES_NODEJS_VERSION,
16-
sha256 = "8b6978d03f58e9ce8e3c0034afd879d621f9387f693f5a8e1888241b0538a61f",
5+
name = "com_github_bazelbuild_buildtools",
6+
url = "https://github.com/bazelbuild/buildtools/archive/0.15.0.zip",
7+
strip_prefix = "buildtools-0.15.0",
8+
sha256 = "76d1837a86fa6ef5b4a07438f8489f00bfa1b841e5643b618e01232ba884b1fe",
179
)
1810

19-
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
20-
21-
check_bazel_version("0.15.0")
22-
23-
node_repositories(package_json = ["//:package.json"])
24-
25-
local_repository(
26-
name = "rxjs",
27-
path = "node_modules/rxjs/src",
28-
)
11+
load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies")
12+
buildifier_dependencies()
2913

30-
RULES_WEBTESTING_VERSION = "0.2.1"
14+
# The Go toolchain is used for Buildifier.
15+
# rules_typescript_dependencies() also tries to load it but we add it explicitely so we
16+
# don't have hidden dependencies.
17+
# This also means we need to load it before rules_typescript_dependencies().
3118
http_archive(
32-
name = "io_bazel_rules_webtesting",
33-
url = "https://github.com/bazelbuild/rules_webtesting/archive/%s.zip" % RULES_WEBTESTING_VERSION,
34-
strip_prefix = "rules_webtesting-%s" % RULES_WEBTESTING_VERSION,
35-
sha256 = "7d490aadff9b5262e5251fa69427ab2ffd1548422467cb9f9e1d110e2c36f0fa",
19+
name = "io_bazel_rules_go",
20+
url = "https://github.com/bazelbuild/rules_go/archive/0.14.0.zip",
21+
strip_prefix = "rules_go-0.14.0",
22+
sha256 = "9bd7c2743f014e4e112b671098ba1da6aec036fe07093b10ca39a9f81ec5cc33",
3623
)
3724

38-
RULES_TYPESCRIPT_VERSION = "0.15.3"
25+
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
26+
go_rules_dependencies()
27+
go_register_toolchains()
28+
29+
# Load the TypeScript rules, its dependencies, and setup the workspace.
3930
http_archive(
4031
name = "build_bazel_rules_typescript",
41-
url = "https://github.com/bazelbuild/rules_typescript/archive/%s.zip" % RULES_TYPESCRIPT_VERSION,
42-
strip_prefix = "rules_typescript-%s" % RULES_TYPESCRIPT_VERSION,
43-
sha256 = "a2b26ac3fc13036011196063db1bf7f1eae81334449201dc28087ebfa3708c99",
32+
url = "https://github.com/bazelbuild/rules_typescript/archive/0.16.1.zip",
33+
strip_prefix = "rules_typescript-0.16.1",
34+
sha256 = "5b2b0bc63cfcffe7bf97cad2dad3b26a73362f806de66207051f66c87956a995",
4435
)
4536

46-
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
37+
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
38+
# build_bazel_rules_nodejs is loaded transitively through rules_typescript_dependencies.
39+
rules_typescript_dependencies()
4740

41+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
4842
ts_setup_workspace()
4943

50-
# We get tools like Buildifier from here
51-
BAZEL_BUILDTOOLS_VERSION = "0.15.0"
52-
http_archive(
53-
name = "com_github_bazelbuild_buildtools",
54-
url = "https://github.com/bazelbuild/buildtools/archive/%s.zip" % BAZEL_BUILDTOOLS_VERSION,
55-
strip_prefix = "buildtools-%s" % BAZEL_BUILDTOOLS_VERSION,
56-
sha256 = "76d1837a86fa6ef5b4a07438f8489f00bfa1b841e5643b618e01232ba884b1fe",
57-
)
44+
# Load the nodejs dependencies, check minimum Bazel version, and define the local node_modules.
45+
load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dependencies")
46+
rules_nodejs_dependencies()
5847

59-
# The Go toolchain is used for Buildifier and some TypeScript tooling.
60-
# We need to use this commit to include Windows path fixes.
61-
RULES_GO_VERSION = "0.14.0"
62-
http_archive(
63-
name = "io_bazel_rules_go",
64-
url = "https://github.com/bazelbuild/rules_go/archive/%s.zip" % RULES_GO_VERSION,
65-
strip_prefix = "rules_go-%s" % RULES_GO_VERSION,
66-
sha256 = "9bd7c2743f014e4e112b671098ba1da6aec036fe07093b10ca39a9f81ec5cc33",
67-
)
68-
69-
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
70-
71-
go_rules_dependencies()
48+
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
49+
check_bazel_version("0.15.0")
50+
node_repositories(package_json = ["//:package.json"])
7251

73-
go_register_toolchains()
52+
local_repository(
53+
name = "rxjs",
54+
path = "node_modules/rxjs/src",
55+
)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"typescript": "~2.9.2"
6565
},
6666
"devDependencies": {
67+
"@bazel/typescript": "0.16.1",
6768
"@ngtools/json-schema": "^1.1.0",
6869
"@types/copy-webpack-plugin": "^4.4.1",
6970
"@types/express": "^4.16.0",

packages/angular/cli/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
licenses(["notice"]) # MIT
77

8-
load("//tools:defaults.bzl", "ts_library")
8+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
99

1010
package(default_visibility = ["//visibility:public"])
1111

packages/angular/pwa/BUILD

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
licenses(["notice"]) # MIT
77

8-
load("//tools:defaults.bzl", "ts_library")
8+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
99

1010
package(default_visibility = ["//visibility:public"])
1111

@@ -27,7 +27,6 @@ ts_library(
2727
# Borrow the compile-time deps of the typescript compiler
2828
# Just to avoid an extra npm install action.
2929
node_modules = "@build_bazel_rules_typescript_tsc_wrapped_deps//:node_modules",
30-
tsconfig = "//:tsconfig.json",
3130
deps = [
3231
"//packages/angular_devkit/core",
3332
"//packages/angular_devkit/schematics",

packages/angular_devkit/architect/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
licenses(["notice"]) # MIT
77

8-
load("//tools:defaults.bzl", "ts_library")
8+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
99

1010
package(default_visibility = ["//visibility:public"])
1111

packages/angular_devkit/architect_cli/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# found in the LICENSE file at https://angular.io/license
55
package(default_visibility = ["//visibility:public"])
66

7-
load("//tools:defaults.bzl", "ts_library")
7+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
88

99
licenses(["notice"]) # MIT
1010

packages/angular_devkit/build_optimizer/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
licenses(["notice"]) # MIT
77

8-
load("//tools:defaults.bzl", "ts_library")
8+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
99
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
1010

1111
package(default_visibility = ["//visibility:public"])

packages/angular_devkit/core/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# found in the LICENSE file at https://angular.io/license
55
package(default_visibility = ["//visibility:public"])
66

7-
load("//tools:defaults.bzl", "ts_library")
7+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
88
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
99

1010
licenses(["notice"]) # MIT License

packages/angular_devkit/schematics/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# found in the LICENSE file at https://angular.io/license
55
package(default_visibility = ["//visibility:public"])
66

7-
load("//tools:defaults.bzl", "ts_library")
7+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
88
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
99

1010
licenses(["notice"]) # MIT License

packages/angular_devkit/schematics_cli/BUILD

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# found in the LICENSE file at https://angular.io/license
55
package(default_visibility = ["//visibility:public"])
66

7-
load("//tools:defaults.bzl", "ts_library")
7+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
88

99
licenses(["notice"]) # MIT License
1010

@@ -23,7 +23,6 @@ ts_library(
2323
),
2424
module_name = "@angular-devkit/schematics-cli",
2525
module_root = "bin",
26-
tsconfig = "//:tsconfig.json",
2726
deps = [
2827
"//packages/angular_devkit/core",
2928
"//packages/angular_devkit/core:node",

packages/schematics/angular/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
licenses(["notice"]) # MIT
77

8-
load("//tools:defaults.bzl", "ts_library")
8+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
99
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
1010

1111
package(default_visibility = ["//visibility:public"])

packages/schematics/update/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
licenses(["notice"]) # MIT
77

8-
load("//tools:defaults.bzl", "ts_library")
8+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
99
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
1010

1111
package(default_visibility = ["//visibility:public"])

tools/defaults.bzl

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)