forked from bazel-contrib/rules_nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WORKSPACE
189 lines (157 loc) · 5.14 KB
/
WORKSPACE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
workspace(
name = "build_bazel_rules_nodejs",
managed_directories = {
"@fine_grained_deps_npm": ["internal/e2e/fine_grained_deps/npm/node_modules"],
"@fine_grained_deps_yarn": ["internal/e2e/fine_grained_deps/yarn/node_modules"],
"@fine_grained_no_bin": ["internal/e2e/fine_grained_no_bin/node_modules"],
"@npm": ["node_modules"],
"@npm_install_test": ["internal/npm_install/test/node_modules"],
},
)
load("//:package.bzl", "rules_nodejs_dev_dependencies")
rules_nodejs_dev_dependencies()
load("//internal/common:check_bazel_version.bzl", "check_bazel_version")
# 0.18.0: support for .bazelignore
# 0.23.0: required fix for pkg_tar strip_prefix
# 0.26.0: managed_directories feature added
check_bazel_version(
message = """
You no longer need to install Bazel on your machine.
rules_nodejs has a dependency on the @bazel/bazel package which supplies it.
Try running `yarn bazel` instead.
""",
minimum_bazel_version = "0.26.0",
)
#
# Load and install our dependencies downloaded above.
#
local_repository(
name = "examples_program",
path = "examples/program",
)
local_repository(
name = "internal_e2e_packages",
path = "internal/e2e/packages",
)
load("//:defs.bzl", "node_repositories", "npm_install", "yarn_install")
# Install a hermetic version of node.
# After this is run, these labels will be available:
# - NodeJS:
# @nodejs//:node
# - NPM:
# @nodejs//:npm
# - The yarn package manager:
# @nodejs//:yarn
#
# To install the node_modules of all the listed package_json files run:
# bazel run @nodejs//:yarn
# or
# bazel run @nodejs//:npm
node_repositories(
package_json = [
"//:package.json",
"@examples_program//:package.json",
],
)
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
# Install all Bazel dependencies needed for npm packages that supply Bazel rules
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
install_bazel_dependencies()
load("@internal_e2e_packages//:setup_workspace.bzl", "internal_e2e_packages_setup_workspace")
internal_e2e_packages_setup_workspace()
# Dependencies to run skydoc
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
sass_repositories()
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
skydoc_repositories()
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
# Needed for starlark unit testing
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
#
# Install npm dependencies for tests
#
yarn_install(
name = "fine_grained_deps_yarn",
included_files = [
"",
".js",
".d.ts",
".json",
".proto",
],
package_json = "//internal/e2e/fine_grained_deps:yarn/package.json",
yarn_lock = "//internal/e2e/fine_grained_deps:yarn/yarn.lock",
)
npm_install(
name = "fine_grained_deps_npm",
included_files = [
"",
".js",
".d.ts",
".json",
".proto",
],
package_json = "//internal/e2e/fine_grained_deps:npm/package.json",
package_lock_json = "//internal/e2e/fine_grained_deps:npm/package-lock.json",
)
yarn_install(
name = "fine_grained_no_bin",
package_json = "//internal/e2e/fine_grained_no_bin:package.json",
yarn_lock = "//internal/e2e/fine_grained_no_bin:yarn.lock",
)
yarn_install(
name = "npm_install_test",
manual_build_file_contents = """
filegroup(
name = "test_files",
srcs = [
"//:BUILD.bazel",
"//:install_bazel_dependencies.bzl",
"//:manual_build_file_contents",
"//:WORKSPACE",
"//@angular/core:BUILD.bazel",
"//@gregmagolan:BUILD.bazel",
"//@gregmagolan/test-a/bin:BUILD.bazel",
"//@gregmagolan/test-a:BUILD.bazel",
"//@gregmagolan/test-b/bin:BUILD.bazel",
"//@gregmagolan/test-b:BUILD.bazel",
"//ajv:BUILD.bazel",
"//jasmine/bin:BUILD.bazel",
"//jasmine:BUILD.bazel",
"//rxjs:BUILD.bazel",
"//unidiff/bin:BUILD.bazel",
"//unidiff:BUILD.bazel",
"//zone.js:BUILD.bazel",
],
)""",
package_json = "//internal/npm_install/test:package.json",
yarn_lock = "//internal/npm_install/test:yarn.lock",
)
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
# Creates toolchain configuration for remote execution with BuildKite CI
# for rbe_ubuntu1604
rbe_autoconfig(
name = "buildkite_config",
)
load("@build_bazel_integration_testing//tools:repositories.bzl", "bazel_binaries")
#depend on the Bazel binaries, also accepts an array of versions
bazel_binaries()