From a6142cf77394ecbf8c7b1d3f28b8032816450e9a Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 23 Oct 2018 15:12:18 -0700 Subject: [PATCH] Cleanup --- defs.bzl | 4 ++-- internal/node/node.bzl | 21 +++++++++++---------- internal/node/node_repositories.bzl | 15 --------------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/defs.bzl b/defs.bzl index 14597a9c63..b076c394ee 100644 --- a/defs.bzl +++ b/defs.bzl @@ -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") @@ -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 diff --git a/internal/node/node.bzl b/internal/node/node.bzl index 7dc2c92ae1..c9ef3733e2 100644 --- a/internal/node/node.bzl +++ b/internal/node/node.bzl @@ -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 @@ -142,7 +143,7 @@ def _nodejs_binary_impl(ctx): transitive_files = runfiles, ), ), - SourcesInfo( + NodeJSSourcesInfo( data = non_module_sources + [ctx.outputs.loader, ctx.outputs.script] ) ] @@ -210,8 +211,8 @@ _NODEJS_EXECUTABLE_ATTRS = { name = "my_binary", ... data = [ - "@npm//:foo", - "@npm//:bar", + "@npm//foo", + "@npm//bar", ... ], ) @@ -240,9 +241,9 @@ _NODEJS_EXECUTABLE_ATTRS = { name = "my_test", ... deps = [ - "@npm//:jasmine", - "@npm//:foo", - "@npm//:bar", + "@npm//jasmine", + "@npm//foo", + "@npm//bar", ... ], ) @@ -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"), diff --git a/internal/node/node_repositories.bzl b/internal/node/node_repositories.bzl index c01c85071c..fe505be32c 100644 --- a/internal/node/node_repositories.bzl +++ b/internal/node/node_repositories.bzl @@ -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",