From c7b9ae3eb2fa75bec2fdd4d188b57ab431796f5d Mon Sep 17 00:00:00 2001 From: Paul Cody Johnston Date: Sun, 21 Apr 2019 18:38:21 -0600 Subject: [PATCH] node_module: implement data file copy (#80) --- node/internal/node_module.bzl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/node/internal/node_module.bzl b/node/internal/node_module.bzl index 232f3f1..2a4fc76 100644 --- a/node/internal/node_module.bzl +++ b/node/internal/node_module.bzl @@ -159,8 +159,13 @@ def _node_module_impl(ctx): dst = ctx.new_file("%s/%s" % (name, _get_path_for_module_file(ctx, root_file, src, sourcemap))) outputs.append(_copy_file(ctx, src, dst)) + for src in ctx.files.data: + filename = src.short_path + dst = ctx.actions.declare_file(filename, sibling = root_file) + outputs.append(_copy_file(ctx, src, dst)) + return struct( - files = depset(outputs), + files = depset(outputs + ctx.files.data), node_module = struct( identifier = name.replace(ctx.attr.separator, '_'), name = name, @@ -230,10 +235,9 @@ node_module = rule( single_file = True, ), - # Additional data files to be included in the module, but - # excluded from the package.json 'files' attribute. "data": attr.label_list( allow_files = True, + doc = "Additional data files to be included in the module, but excluded from the package.json 'files' attribute", ), # Module dependencies.