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 28ba1bf commit a6142cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 27 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,7 +40,7 @@ npm_install = _npm_install
yarn_install = _yarn_install
rollup_bundle = _rollup_bundle
npm_package = _npm_package
SourcesInfo = _sources_info
NodeJSSourcesInfo = _sources_info
history_server = _history_server
http_server = _http_server
# ANY RULES ADDED HERE SHOULD BE DOCUMENTED, run yarn skydoc to verify
Expand Down
21 changes: 11 additions & 10 deletions internal/node/node.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ load("//internal/common:sources_aspect.bzl", "sources_aspect")
load("//internal/common:expand_into_runfiles.bzl", "expand_location_into_runfiles")
load("//internal/common:node_module_info.bzl", "NodeModuleInfo", "collect_node_modules_aspect")

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 @@ -142,7 +143,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 @@ -210,8 +211,8 @@ _NODEJS_EXECUTABLE_ATTRS = {
name = "my_binary",
...
data = [
"@npm//:foo",
"@npm//:bar",
"@npm//foo",
"@npm//bar",
...
],
)
Expand Down Expand Up @@ -240,9 +241,9 @@ _NODEJS_EXECUTABLE_ATTRS = {
name = "my_test",
...
deps = [
"@npm//:jasmine",
"@npm//:foo",
"@npm//:bar",
"@npm//jasmine",
"@npm//foo",
"@npm//bar",
...
],
)
Expand All @@ -256,7 +257,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
15 changes: 0 additions & 15 deletions internal/node/node_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -201,21 +201,6 @@ 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",
],
),
)
filegroup(
name = "minimal_node_runfiles",
srcs = glob(
[
"bin/node.js",
Expand Down

0 comments on commit a6142cf

Please sign in to comment.