Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade rules-nodes to version 3.5.0 #9635

Merged
merged 10 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions bazel_tools/rules_nodejs_windows_mkdir.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/internal/npm_install/npm_install.bzl b/internal/npm_install/npm_install.bzl
index 3c07b3a0..a7b77d9a 100644
--- a/internal/npm_install/npm_install.bzl
+++ b/internal/npm_install/npm_install.bzl
@@ -335,8 +335,9 @@ def _copy_file(repository_ctx, f):
to_segments = to.split("/")
if len(to_segments) > 1:
dirname = "/".join(to_segments[:-1])
+ args = ["mkdir", "-p", dirname] if not is_windows_os(repository_ctx) else ["cmd", "/c", "if not exist {dir} mkdir {dir}".format(dir = dirname)]
result = repository_ctx.execute(
- ["mkdir", "-p", dirname],
+ args,
quiet = repository_ctx.attr.quiet,
)
if result.return_code:
@@ -344,12 +345,13 @@ def _copy_file(repository_ctx, f):

# copy the file; don't use the repository_ctx.template trick with empty substitution as this
# does not copy over binary files properly
+ cp_args = ["cp", "-f", repository_ctx.path(f), to] if not is_windows_os(repository_ctx) else ["cmd", "/c", "copy /y {} {}".format("\\".join(str(repository_ctx.path(f)).split("/")), "\\".join(to_segments))]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aherrmann-da do you have a better idea for handling this? ctx.file doesn’t work since you either mess up executable bits or break binary files. Just cp doesn’t work because it might not be in PATH and this is a repository rule so we cannot get it from the posix toolchain. Just cmd /c copy does not work because it does not like forward slashes.
So in the end I ended up with this but it seems terrible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't really have a better idea. As you describe all these other methods have their respective limitations.

Perhaps string.replace is also a bit less noisy than the split/join, but, I have no strong preference there.

result = repository_ctx.execute(
- ["cp", "-f", repository_ctx.path(f), to],
+ cp_args,
quiet = repository_ctx.attr.quiet,
)
if result.return_code:
- fail("cp -f %s %s failed: \nSTDOUT:\n%s\nSTDERR:\n%s" % (repository_ctx.path(f), to, result.stdout, result.stderr))
+ fail("cp -f {} {} failed: \nSTDOUT:\n{}\nSTDERR:\n{}, {}".format(repository_ctx.path(f), to, result.stdout, result.stderr, cp_args))

def _symlink_file(repository_ctx, f):
repository_ctx.symlink(f, _workspace_root_path(repository_ctx, f))
6 changes: 4 additions & 2 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ buildifier_version = "4.0.0"
buildifier_sha256 = "0d3ca4ed434958dda241fb129f77bd5ef0ce246250feed2d5a5470c6f29a77fa"
zlib_version = "1.2.11"
zlib_sha256 = "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff"
rules_nodejs_version = "2.3.1"
rules_nodejs_sha256 = "121f17d8b421ce72f3376431c3461cd66bfe14de49059edc7bb008d5aebd16be"
rules_nodejs_version = "3.5.0"
rules_nodejs_sha256 = "10f534e1c80f795cffe1f2822becd4897754d18564612510c59b3c73544ae7c6"
rules_jvm_external_version = "3.3"
rules_jvm_external_sha256 = "d85951a92c0908c80bd8551002d66cb23c3434409c814179c0ff026b53544dab"
rules_go_version = "0.23.6"
Expand Down Expand Up @@ -204,6 +204,8 @@ def daml_deps():
# Work around for https://github.com/bazelbuild/rules_nodejs/issues/1565
"@com_github_digital_asset_daml//bazel_tools:rules_nodejs_npm_cli_path.patch",
"@com_github_digital_asset_daml//bazel_tools:rules_nodejs_node_dependency.patch",
# Can be upstreamed
"@com_github_digital_asset_daml//bazel_tools:rules_nodejs_windows_mkdir.patch",
],
patch_args = ["-p1"],
)
Expand Down
197 changes: 1 addition & 196 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,202 +40,7 @@ genrule(
],
) + [
# we need to list all the transitive dependencies here because of https://github.com/bazelbuild/rules_nodejs/issues/1553
"@npm//acorn",
"@npm//acorn-node",
"@npm//acorn-walk",
"@npm//ansi-regex",
"@npm//ansi-styles",
"@npm//anymatch",
"@npm//assert",
"@npm//async",
"@npm//async-each",
"@npm//balanced-match",
"@npm//basic-auth",
"@npm//batch",
"@npm//binary-extensions",
"@npm//body",
"@npm//brace-expansion",
"@npm//browserify",
"@npm//browserify-cache-api",
"@npm//browserify-incremental",
"@npm//browserify-zlib",
"@npm//browser-pack",
"@npm//browser-resolve",
"@npm//buffer",
"@npm//buffer-from",
"@npm//bytes",
"@npm//cached-path-relative",
"@npm//chalk",
"@npm//chokidar",
"@npm//coffeescript",
"@npm//color-convert",
"@npm//colors",
"@npm//combine-source-map",
"@npm//concat-map",
"@npm//concat-stream",
"@npm//connect",
"@npm//connect-livereload",
"@npm//console-browserify",
"@npm//constants-browserify",
"@npm//continuable-cache",
"@npm//convert-source-map",
"@npm//core-util-is",
"@npm//cross-spawn",
"@npm//crypto-browserify",
"@npm//dargs",
"@npm//dash-ast",
"@npm//dateformat",
"@npm//defined",
"@npm//depd",
"@npm//deps-sort",
"@npm//destroy",
"@npm//detective",
"@npm//domain-browser",
"@npm//duplexer",
"@npm//duplexer2",
"@npm//ee-first",
"@npm//encodeurl",
"@npm//error",
"@npm//escape-html",
"@npm//escape-string-regexp",
"@npm//etag",
"@npm//eventemitter2",
"@npm//events",
"@npm//exit",
"@npm//fast-safe-stringify",
"@npm//faye-websocket",
"@npm//figures",
"@npm//file-sync-cmp",
"@npm//finalhandler",
"@npm//findup-sync",
"@npm//fresh",
"@npm//fs.realpath",
"@npm//function-bind",
"@npm//gaze",
"@npm//get-assigned-identifiers",
"@npm//getobject",
"@npm//glob",
"@npm//glob-parent",
"@npm//globule",
"@npm//graceful-fs",
"@npm//grunt",
"@npm//grunt-banner",
"@npm//grunt-browserify",
"@npm//grunt-contrib-clean",
"@npm//grunt-contrib-connect",
"@npm//grunt-contrib-copy",
"@npm//grunt-contrib-sass",
"@npm//grunt-contrib-uglify",
"@npm//grunt-contrib-watch",
"@npm//grunt-exec",
"@npm//grunt-legacy-log",
"@npm//grunt-legacy-log-utils",
"@npm//grunt-legacy-util",
"@npm//grunt-open",
"@npm//gzip-size",
"@npm//has",
"@npm//has-ansi",
"@npm//has-flag",
"@npm//hooker",
"@npm//htmlescape",
"@npm//http-errors",
"@npm//http-parser-js",
"@npm//https-browserify",
"@npm//iconv-lite",
"@npm//inflight",
"@npm//inherits",
"@npm//inline-source-map",
"@npm//insert-module-globals",
"@npm//is-binary-path",
"@npm//is-number-like",
"@npm//is-wsl",
"@npm//jsonparse",
"@npm//json-stable-stringify",
"@npm//JSONStream",
"@npm//js-yaml",
"@npm//labeled-stream-splicer",
"@npm//lodash",
"@npm//lodash.isfinite",
"@npm//lodash.memoize",
"@npm//lru-cache",
"@npm//matchdep",
"@npm//maxmin",
"@npm//mime-db",
"@npm//mime-types",
"@npm//minimatch",
"@npm//mkdirp",
"@npm//module-deps",
"@npm//morgan",
"@npm//node-http2",
"@npm//nopt",
"@npm//normalize-path",
"@npm//number-is-nan",
"@npm//object-assign",
"@npm//once",
"@npm//on-finished",
"@npm//on-headers",
"@npm//opn",
"@npm//os-browserify",
"@npm//parents",
"@npm//parseurl",
"@npm//path-browserify",
"@npm//path-dirname",
"@npm//path-is-absolute",
"@npm//path-platform",
"@npm//portscanner",
"@npm//pretty-bytes",
"@npm//process",
"@npm//process-nextick-args",
"@npm//punycode",
"@npm//querystring-es3",
"@npm//raw-body",
"@npm//readable-stream",
"@npm//readdirp",
"@npm//read-only-stream",
"@npm//remove-trailing-separator",
"@npm//rimraf",
"@npm//safe-buffer",
"@npm//safe-json-parse",
"@npm//safer-buffer",
"@npm//send",
"@npm//serve-index",
"@npm//serve-static",
"@npm//setprototypeof",
"@npm//shasum",
"@npm//shasum-object",
"@npm//sprintf-js",
"@npm//statuses",
"@npm//stream-browserify",
"@npm//stream-combiner2",
"@npm//stream-http",
"@npm//stream-splicer",
"@npm//string_decoder",
"@npm//string-template",
"@npm//strip-ansi",
"@npm//supports-color",
"@npm//syntax-error",
"@npm//through",
"@npm//through2",
"@npm//timers-browserify",
"@npm//tiny-lr",
"@npm//tty-browserify",
"@npm//uglify-js",
"@npm//umd",
"@npm//undeclared-identifiers",
"@npm//underscore.string",
"@npm//unpipe",
"@npm//upath",
"@npm//uri-path",
"@npm//url",
"@npm//util",
"@npm//util-deprecate",
"@npm//utils-merge",
"@npm//vm-browserify",
"@npm//watchify",
"@npm//websocket-driver",
"@npm//websocket-extensions",
"@npm//wrappy",
"@npm//xtend",
"@npm//:node_modules",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visibility seems to have changed in such a way that only direct dependencies are visible. Listing everything in package.json only to then list it here again doesn’t seem very useful so I went for this approach instead.

],
outs = ["da_theme.tar.gz"],
cmd = """
Expand Down
1 change: 0 additions & 1 deletion language-support/ts/eslint.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def eslint_test(name, srcs, tsconfig = ":tsconfig.json", eslintrc = ":.eslintrc.
eslint_deps = [
"@language_support_ts_deps//@typescript-eslint",
"@language_support_ts_deps//@typescript-eslint/eslint-plugin",
"@language_support_ts_deps//tsutils",
] if not is_windows else []
templated_args = [
"--config",
Expand Down
2 changes: 1 addition & 1 deletion language-support/ts/packages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@bazel/hide-bazel-files": "1.7.0",
"@bazel/typescript": "^2.3.1",
"@bazel/typescript": "^3.4.2",
"@types/jest": "^26.0.20",
"@types/lodash": "4.14.161",
"@types/react": "^16.9.20",
Expand Down
8 changes: 4 additions & 4 deletions language-support/ts/packages/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@
resolved "https://registry.yarnpkg.com/@bazel/hide-bazel-files/-/hide-bazel-files-1.7.0.tgz#7cb140c23c4269d6464c24be0a2acf0241d2a31d"
integrity sha512-pvdyRX/EsU8n+oElFb+OZ9i5M48HNFR+Z4D3vc0qDGiJ8oly9fZcUb2gbw4CzyeovJz0IzjSxjqMS6cp5gKoeg==

"@bazel/typescript@^2.3.1":
version "2.3.3"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-2.3.3.tgz#8f238a6d395140cdc6ed6900f0861efb744ca91b"
integrity sha512-tkkrV1wrpMKj7gDlgloo/24lGmW5btHxzg9xqBZsXVvEfhr3HP9dU296bBxtdS1zZuORCxdIhh7D3iPonQDibg==
"@bazel/typescript@^3.4.2":
version "3.4.2"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.4.2.tgz#183cb14d1f4149cc67ed2723c4b8a7366da5ec36"
integrity sha512-JtLdPOC7rytALJBxawxTCnxVopGstk2eXFs56zHBy+JWSeqrnwujeWZyK5qZHzpag02/JtIQ/ZKkM/DQtrXC8Q==
dependencies:
protobufjs "6.8.8"
semver "5.6.0"
Expand Down
9 changes: 4 additions & 5 deletions navigator/frontend/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ filegroup(
# a custom node.js binary that has access to all plugins loaded by webpack at runtime.
nodejs_binary(
name = "webpack",
entry_point = "@navigator_frontend_deps//:node_modules/webpack/bin/webpack.js",
node_modules = "@navigator_frontend_deps//:node_modules",
# The webpack build step requires almost all of the node_modules dependencies
# data = [
# ...
# ],
data = [
"@navigator_frontend_deps//:node_modules",
],
entry_point = "@navigator_frontend_deps//:node_modules/webpack/bin/webpack.js",
)

# TODO (drsk) We should switch the frontend rule to use the bazel typescript rules instead of
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
},
"devDependencies": {
"@bazel/hide-bazel-files": "1.7.0",
"@bazel/typescript": "2.0.1"
"@bazel/typescript": "3.4.2"
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
resolved "https://registry.yarnpkg.com/@bazel/hide-bazel-files/-/hide-bazel-files-1.7.0.tgz#7cb140c23c4269d6464c24be0a2acf0241d2a31d"
integrity sha512-pvdyRX/EsU8n+oElFb+OZ9i5M48HNFR+Z4D3vc0qDGiJ8oly9fZcUb2gbw4CzyeovJz0IzjSxjqMS6cp5gKoeg==

"@bazel/typescript@2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-2.0.1.tgz#f99405ce53e2d16a98f9b66da42bff9f5c055c24"
integrity sha512-zoaxp57m8WbBILv8MlNEcRf1xRbtvAyDAy2nekEy2RhvCx96slZ5+JJIQJ7AW6teb37iqvurg1OvNZsO/1bc7Q==
"@bazel/typescript@3.4.2":
version "3.4.2"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.4.2.tgz#183cb14d1f4149cc67ed2723c4b8a7366da5ec36"
integrity sha512-JtLdPOC7rytALJBxawxTCnxVopGstk2eXFs56zHBy+JWSeqrnwujeWZyK5qZHzpag02/JtIQ/ZKkM/DQtrXC8Q==
dependencies:
protobufjs "6.8.8"
semver "5.6.0"
Expand Down