Skip to content

Commit d0e64dd

Browse files
committed
Make the toolchain version customizable
This allows projects to pull in the version of node that they need in WORKSPACE files, without tying themselves to a particular update cadence.
1 parent 494eafc commit d0e64dd

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

node/internal/node_repositories.bzl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,24 @@ _node_toolchain = repository_rule(
5555
},
5656
)
5757

58-
def node_repositories():
59-
58+
def node_repositories(version="6.6.0",
59+
linux_sha256="c22ab0dfa9d0b8d9de02ef7c0d860298a5d1bf6cae7413fb18b99e8a3d25648a",
60+
darwin_sha256="c8d1fe38eb794ca46aacf6c8e90676eec7a8aeec83b4b09f57ce503509e7a19f"):
6061
native.new_http_archive(
6162
name = "nodejs_linux_amd64",
62-
url = "https://nodejs.org/dist/v6.6.0/node-v6.6.0-linux-x64.tar.gz",
63+
url = "https://nodejs.org/dist/v{version}/node-v{version}-linux-x64.tar.gz".format(version=version),
6364
type = "tar.gz",
64-
strip_prefix = "node-v6.6.0-linux-x64",
65-
sha256 = "c22ab0dfa9d0b8d9de02ef7c0d860298a5d1bf6cae7413fb18b99e8a3d25648a",
65+
strip_prefix = "node-v{version}-linux-x64".format(version=version),
66+
sha256 = linux_sha256,
6667
build_file_content = "",
6768
)
6869

6970
native.new_http_archive(
7071
name = "nodejs_darwin_amd64",
71-
url = "https://nodejs.org/dist/v6.6.0/node-v6.6.0-darwin-x64.tar.gz",
72+
url = "https://nodejs.org/dist/v{version}/node-v{version}-darwin-x64.tar.gz".format(version=version),
7273
type = "tar.gz",
73-
strip_prefix = "node-v6.6.0-darwin-x64",
74-
sha256 = "c8d1fe38eb794ca46aacf6c8e90676eec7a8aeec83b4b09f57ce503509e7a19f",
74+
strip_prefix = "node-v{version}-darwin-x64".format(version=version),
75+
sha256 = darwin_sha256,
7576
build_file_content = "",
7677
)
7778

0 commit comments

Comments
 (0)