Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Oct 23, 2018
1 parent d22bb3c commit 3380dd7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 34 deletions.
4 changes: 2 additions & 2 deletions defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ load("//internal/common:check_bazel_version.bzl", _check_bazel_version = "check_
load("//internal/node:node.bzl",
_nodejs_binary = "nodejs_binary_macro",
_nodejs_test = "nodejs_test_macro",
_sources_info = "SourcesInfo")
_sources_info = "NodeJSSourcesInfo")
load("//internal/node:node_repositories.bzl",_node_repositories = "node_repositories")
load("//internal/jasmine_node_test:jasmine_node_test.bzl", _jasmine_node_test = "jasmine_node_test")
load("//internal/npm_install:npm_install.bzl", _npm_install = "npm_install", _yarn_install = "yarn_install")
Expand All @@ -40,9 +40,9 @@ npm_install = _npm_install
yarn_install = _yarn_install
rollup_bundle = _rollup_bundle
npm_package = _npm_package
NodeJSSourcesInfo = _sources_info
history_server = _history_server
http_server = _http_server
SourcesInfo = _sources_info
# ANY RULES ADDED HERE SHOULD BE DOCUMENTED, run yarn skydoc to verify

check_rules_nodejs_version = _check_rules_nodejs_version
Expand Down
11 changes: 6 additions & 5 deletions internal/node/node.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ def _trim_package_node_modules(package_name):
segments += [n]
return "/".join(segments)

SourcesInfo = provider(fields = [
"data",
])
NodeJSSourcesInfo = provider(
doc = """Minimal files needed to run a NodeJS program, without npm packages""",
fields = {"data": "A list of File objects"},
)

def _write_loader_script(ctx):
# Generates the JavaScript snippet of module roots mappings, with each entry
Expand Down Expand Up @@ -159,7 +160,7 @@ def _nodejs_binary_impl(ctx):
transitive_files = runfiles,
),
),
SourcesInfo(
NodeJSSourcesInfo(
data = non_module_sources + [ctx.outputs.loader, ctx.outputs.script]
)
]
Expand Down Expand Up @@ -273,7 +274,7 @@ _NODEJS_EXECUTABLE_ATTRS = {
allow_files = True,
single_file = True),
"_node_runfiles": attr.label(
default = Label("@nodejs//:minimal_node_runfiles"),
default = Label("@nodejs//:node_runfiles"),
allow_files = True),
"_repository_args": attr.label(
default = Label("@nodejs//:bin/node_args.sh"),
Expand Down
29 changes: 2 additions & 27 deletions internal/node/node_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -239,35 +239,10 @@ alias(name = "npm", actual = "{npm}")
alias(name = "yarn", actual = "{yarn}")
filegroup(
name = "node_runfiles",
srcs = glob(
[
"bin/node.js",
"{node_dir}/**",
"{yarn_dir}/**",
],
exclude = [
"**/*.md",
"**/*.html",
# These files are generated during node-gyp compilation and include
# absolute paths, making them non-hermetic.
# See https://github.com/bazelbuild/rules_nodejs/issues/347
"**/*.pyc",
],
),
)
filegroup(
name = "minimal_node_runfiles",
srcs = glob(
[
srcs = [
"bin/node.js",
"{node_dir}/bin/node",
],
exclude = [
"**/*.md",
"**/*.html",
],
),
],
)
""".format(
node = node_entry,
Expand Down

0 comments on commit 3380dd7

Please sign in to comment.