Use bin_ and genfiles_ directories derived from the ctx, not the configuration

For Bazel (open source Blaze), users can have multiple repositories
and we are moving towards having one bin/genfiles dir per repository.
This means that bin_dir and genfiles_dir need to be rule-specific, not
configuration-specific, since the configuration is not repository-specific.
ctx.configuration.bin_dir and ctx.configuration.genfiles_dir have been
deprecated and now we'd like to remove them entirely.

The new fields are only available in Bazel 0.4.0+.
Tested:
    TAP --sample for global presubmit queue
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=141791797
This commit is contained in:
Ben McIlwain 2016-12-12 11:49:47 -08:00
parent 50c862b7c1
commit 2a1526209a

View file

@ -148,6 +148,10 @@ def _zip_file(ctx):
'cd "${repo}"',
'rm -rf "${tmp}"',
]
if hasattr(ctx, 'bin_dir'):
script = ctx.new_file(ctx.bin_dir, '%s.sh' % ctx.label.name)
else:
# TODO(user): remove this once Bazel 4.0+ is required.
script = ctx.new_file(ctx.configuration.bin_dir, '%s.sh' % ctx.label.name)
ctx.file_action(output=script, content='\n'.join(cmd), executable=True)
inputs = [ctx.file._zipper]