@@ -5,77 +5,19 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
5
5
# Add NodeJS rules (explicitly used for sass bundle rules)
6
6
http_archive (
7
7
name = "build_bazel_rules_nodejs" ,
8
- url = "https://github.com/bazelbuild/rules_nodejs/archive/0.16.5.zip" ,
9
- strip_prefix = "rules_nodejs-0.16.5" ,
10
- )
11
-
12
- # Add TypeScript rules
13
- http_archive (
14
- name = "build_bazel_rules_typescript" ,
15
- # Explicitly depend on https://github.com/bazelbuild/rules_typescript/pull/327 which fixes the devserver
16
- # for windows. Once this has been reviewed and merged, we can switch back to a normal release.
17
- url = "https://github.com/bazelbuild/rules_typescript/archive/2e761b53ca465a140c4a265cb80887e7bcf61eb9.zip" ,
18
- strip_prefix = "rules_typescript-2e761b53ca465a140c4a265cb80887e7bcf61eb9" ,
19
- )
20
-
21
- # Add Angular source and Bazel rules.
22
- http_archive (
23
- name = "angular" ,
24
- url = "https://github.com/angular/angular/archive/7.2.1.zip" ,
25
- strip_prefix = "angular-7.2.1" ,
26
- )
27
-
28
- # Add RxJS as repository because those are needed in order to build Angular from source.
29
- # Also we cannot refer to the RxJS version from the node modules because self-managed
30
- # node modules are not guaranteed to be installed.
31
- # TODO(gmagolan): remove this once rxjs ships with an named UMD bundle and we
32
- # are no longer building it from source.
33
- http_archive (
34
- name = "rxjs" ,
35
- url = "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz" ,
36
- strip_prefix = "package/src" ,
37
- sha256 = "72b0b4e517f43358f554c125e40e39f67688cd2738a8998b4a266981ed32f403" ,
38
- )
39
-
40
- # We need to create a local repository called "npm" because currently Angular Material
41
- # stores all of it's NPM dependencies in the "@matdeps" repository. This is necessary because
42
- # we don't want to reserve the "npm" repository that is commonly used by downstream projects.
43
- # Since we still need the "npm" repository in order to use the Angular or TypeScript Bazel
44
- # rules, we create a local repository that is just defined in **this** workspace and is not
45
- # being shipped to downstream projects. This can be removed once downstream projects can
46
- # consume Angular Material completely from NPM.
47
- # TODO(devversion): remove once Angular Material can be consumed from NPM with Bazel.
48
- local_repository (
49
- name = "npm" ,
50
- path = "tools/npm-workspace"
8
+ sha256 = "5c86b055c57e15bf32d9009a15bcd6d8e190c41b1ff2fb18037b75e0012e4e7c" ,
9
+ urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.26.0/rules_nodejs-0.26.0.tar.gz" ],
51
10
)
52
11
53
12
# Add sass rules
54
13
http_archive (
55
14
name = "io_bazel_rules_sass" ,
15
+ sha256 = "f71709f4c2d39e81c9b452e00f22e554b26d7beacaedc5b85d61f771fd01268d" ,
56
16
url = "https://github.com/bazelbuild/rules_sass/archive/1.16.1.zip" ,
57
17
strip_prefix = "rules_sass-1.16.1" ,
58
18
)
59
19
60
- # Since we are explitly fetching @build_bazel_rules_typescript, we should explicitly ask for
61
- # its transitive dependencies in case those haven't been fetched yet.
62
- load ("@build_bazel_rules_typescript//:package.bzl" , "rules_typescript_dependencies" )
63
- rules_typescript_dependencies ()
64
-
65
- # Since we are explitly fetching @build_bazel_rules_nodejs, we should explicitly ask for
66
- # its transitive dependencies in case those haven't been fetched yet.
67
- load ("@build_bazel_rules_nodejs//:package.bzl" , "rules_nodejs_dependencies" )
68
- rules_nodejs_dependencies ()
69
-
70
- # Fetch transitive dependencies which are needed by the Angular build targets.
71
- load ("@angular//packages/bazel:package.bzl" , "rules_angular_dependencies" )
72
- rules_angular_dependencies ()
73
-
74
- # Fetch transitive dependencies which are needed to use the Sass rules.
75
- load ("@io_bazel_rules_sass//:package.bzl" , "rules_sass_dependencies" )
76
- rules_sass_dependencies ()
77
-
78
- load ("@build_bazel_rules_nodejs//:defs.bzl" , "check_bazel_version" , "node_repositories" )
20
+ load ("@build_bazel_rules_nodejs//:defs.bzl" , "check_bazel_version" , "node_repositories" , "yarn_install" )
79
21
80
22
# The minimum bazel version to use with this repo is 0.18.0
81
23
check_bazel_version ("0.18.0" )
@@ -87,32 +29,67 @@ node_repositories(
87
29
yarn_version = "1.12.1" ,
88
30
)
89
31
32
+ yarn_install (
33
+ name = "npm" ,
34
+ package_json = "//:package.json" ,
35
+ # Ensure that the script is available when running `postinstall` in the Bazel sandbox.
36
+ data = [
37
+ "//:tools/npm/check-npm.js" ,
38
+ "//:angular-tsconfig.json" ,
39
+ ],
40
+ yarn_lock = "//:yarn.lock" ,
41
+ )
42
+
43
+ # Install all bazel dependencies of the @ngdeps npm packages
44
+ load ("@npm//:install_bazel_dependencies.bzl" , "install_bazel_dependencies" )
45
+ install_bazel_dependencies ()
46
+
90
47
# Setup TypeScript Bazel workspace
91
- load ("@build_bazel_rules_typescript //:defs.bzl" , "ts_setup_workspace" )
48
+ load ("@npm_bazel_typescript //:defs.bzl" , "ts_setup_workspace" )
92
49
ts_setup_workspace ()
93
50
51
+ # Fetch transitive dependencies which are needed to use the karma rules.
52
+ load ("@npm_bazel_karma//:package.bzl" , "rules_karma_dependencies" )
53
+ rules_karma_dependencies ()
54
+
55
+ # Fetch transitive dependencies which are needed to use the Sass rules.
56
+ load ("@io_bazel_rules_sass//:package.bzl" , "rules_sass_dependencies" )
57
+ rules_sass_dependencies ()
58
+
94
59
# Setup the Sass rule repositories.
95
60
load ("@io_bazel_rules_sass//:defs.bzl" , "sass_repositories" )
96
61
sass_repositories ()
97
62
98
- # Setup Angular workspace for building (Bazel managed node modules)
99
- load ("@angular//:index.bzl" , "ng_setup_workspace" )
100
- ng_setup_workspace ()
63
+ # Setup web testing. We need to setup a browser because the web testing rules for TypeScript need
64
+ # a reference to a registered browser (ideally that's a hermetic version of a browser)
65
+ load ("@io_bazel_rules_webtesting//web:repositories.bzl" , "web_test_repositories" )
66
+ web_test_repositories ()
101
67
102
- load ("@angular_material //:index .bzl" , "angular_material_setup_workspace " )
103
- angular_material_setup_workspace ()
68
+ load ("@npm_bazel_karma //:browser_repositories .bzl" , "browser_repositories " )
69
+ browser_repositories ()
104
70
105
- # Setup Go toolchain (required for Bazel web testing rules)
106
- load ("@io_bazel_rules_go//go:def.bzl" , "go_rules_dependencies" , "go_register_toolchains" )
107
- go_rules_dependencies ()
108
- go_register_toolchains ()
71
+ # Temporarily add Angular sources and its dependencies to consume the ts_api_guardian,
72
+ # remote-build-execution, and protractor stuff.
73
+ # TODO(jelbourn): remove this once we can do all the same stuff via @npm//@angular
74
+ http_archive (
75
+ name = "angular" ,
76
+ sha256 = "a542f00adf5cafbcad24268d69da8e4746c22619699f29c3b3b0259d0ce52974" ,
77
+ url = "https://github.com/angular/angular/archive/8.0.0-beta.6.zip" ,
78
+ strip_prefix = "angular-8.0.0-beta.6" ,
79
+ )
80
+ load ("@angular//packages/bazel:package.bzl" , "rules_angular_dependencies" )
81
+ rules_angular_dependencies ()
82
+ load ("@angular//:index.bzl" , "ng_setup_workspace" )
83
+ ng_setup_workspace ()
109
84
110
- # Setup web testing. We need to setup a browser because the web testing rules for TypeScript need
111
- # a reference to a registered browser (ideally that's a hermetic version of a browser)
112
- load ("@io_bazel_rules_webtesting//web:repositories.bzl" , "browser_repositories" ,
113
- "web_test_repositories" )
114
85
115
- web_test_repositories ()
116
- browser_repositories (
117
- chromium = True ,
86
+ # Bring in bazel_toolchains for RBE stuff.
87
+ http_archive (
88
+ name = "bazel_toolchains" ,
89
+ sha256 = "109a99384f9d08f9e75136d218ebaebc68cc810c56897aea2224c57932052d30" ,
90
+ strip_prefix = "bazel-toolchains-94d31935a2c94fe7e7c7379a0f3393e181928ff7" ,
91
+ urls = [
92
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/94d31935a2c94fe7e7c7379a0f3393e181928ff7.tar.gz" ,
93
+ "https://github.com/bazelbuild/bazel-toolchains/archive/94d31935a2c94fe7e7c7379a0f3393e181928ff7.tar.gz" ,
94
+ ]
118
95
)
0 commit comments