diff options
author | 2015-11-18 14:49:15 +0000 | |
---|---|---|
committer | 2015-11-18 15:32:28 +0000 | |
commit | 86b9fef6e5c753013a4fdee75093ea8d95116ae4 (patch) | |
tree | 38e6713d8d1b8b426938f3639072a5999b0369a1 /tools/build_rules | |
parent | 9e1a62ae87feafc9d623a1b036f6ec0348663b76 (diff) |
Update go_binary and go_test rules to copy files in the "data"
attribute to runfiles. Add shell-based unit test for runfile
support by these rules.
--
Change-Id: Ia97278059d104b9728d53aa75c0987fc3c47b640
Reviewed-on: https://bazel-review.git.corp.google.com/#/c/2265/
MOS_MIGRATED_REVID=108139011
Diffstat (limited to 'tools/build_rules')
-rw-r--r-- | tools/build_rules/go/def.bzl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/build_rules/go/def.bzl b/tools/build_rules/go/def.bzl index a6c22c6045..194b996108 100644 --- a/tools/build_rules/go/def.bzl +++ b/tools/build_rules/go/def.bzl @@ -232,7 +232,11 @@ def go_binary_impl(ctx): emit_go_link_action( ctx, lib_result.transitive_go_library_object, lib_out, executable) - return struct(files = set([executable]) + lib_result.files) + + runfiles = ctx.runfiles(collect_data = True, + files = ctx.files.data) + return struct(files = set([executable]) + lib_result.files, + runfiles = runfiles) def go_test_impl(ctx): @@ -268,7 +272,8 @@ def go_test_impl(ctx): # TODO(bazel-team): the Go tests should do a chdir to the directory # holding the data files, so open-source go tests continue to work # without code changes. - runfiles = ctx.runfiles(collect_data = True, files = [ctx.outputs.executable]) + runfiles = ctx.runfiles(collect_data = True, + files = ctx.files.data + [ctx.outputs.executable]) return struct(runfiles=runfiles) go_library_attrs = { |