From 2a1526209af92584e778cbaee5acf96800c91c29 Mon Sep 17 00:00:00 2001 From: Ben McIlwain Date: Mon, 12 Dec 2016 11:49:47 -0800 Subject: [PATCH] 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 --- java/google/registry/builddefs/zip_file.bzl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/google/registry/builddefs/zip_file.bzl b/java/google/registry/builddefs/zip_file.bzl index dac5a8678..d265599bf 100644 --- a/java/google/registry/builddefs/zip_file.bzl +++ b/java/google/registry/builddefs/zip_file.bzl @@ -148,7 +148,11 @@ def _zip_file(ctx): 'cd "${repo}"', 'rm -rf "${tmp}"', ] - script = ctx.new_file(ctx.configuration.bin_dir, '%s.sh' % ctx.label.name) + 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] inputs += [dep.zip_file for dep in ctx.attr.deps]