diff options
author | Kristina Chodorow <kchodorow@google.com> | 2016-03-21 17:55:56 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-03-21 18:39:33 +0000 |
commit | 19b5675725caf69008a717082149237400260edc (patch) | |
tree | 944d15214a45f7005bf479704c02956c5d85f421 /tools/build_rules | |
parent | fbcfd50f0ef37bcf9072db21a46ff8048d78f763 (diff) |
Deprecate built-in Skylark rules
RELNOTES: Skylark rules that are available from their own repository will now
issue a warning when accessed through @bazel_tools.
--
MOS_MIGRATED_REVID=117730793
Diffstat (limited to 'tools/build_rules')
-rw-r--r-- | tools/build_rules/appengine/appengine.bzl | 12 | ||||
-rw-r--r-- | tools/build_rules/deprecation.bzl | 27 | ||||
-rw-r--r-- | tools/build_rules/go/def.bzl | 18 |
3 files changed, 56 insertions, 1 deletions
diff --git a/tools/build_rules/appengine/appengine.bzl b/tools/build_rules/appengine/appengine.bzl index 441a1ffb78..1abbc83a44 100644 --- a/tools/build_rules/appengine/appengine.bzl +++ b/tools/build_rules/appengine/appengine.bzl @@ -64,6 +64,15 @@ APP_ID. If not specified, it uses the default APP_ID provided in the application web.xml. """ +load("//tools/build_rules:deprecation.bzl", "deprecated") + +def warning(rule): + print(deprecated( + "appengine", + rule, + "@bazel_tools//tools/build_rules/appengine:appengine.bzl", + "@io_bazel_rules_appengine//appengine:appengine.bzl")) + jar_filetype = FileType([".jar"]) def _add_file(in_file, output, path = None): @@ -99,6 +108,7 @@ def _short_path_dirname(path): return sp[0:len(sp)-len(path.basename)-1] def _war_impl(ctxt): + warning("appengine_war") zipper = ctxt.file._zipper data_path = ctxt.attr.data_path @@ -231,6 +241,7 @@ appengine_war = rule( ) def java_war(name, data=[], data_path=None, **kwargs): + warning("java_war") native.java_library(name = "lib%s" % name, **kwargs) appengine_war(name = name, jars = ["lib%s" % name], @@ -261,6 +272,7 @@ filegroup( """ def appengine_repositories(): + warning("appengine_repositories") native.new_http_archive( name = "com_google_appengine_java", url = "http://central.maven.org/maven2/com/google/appengine/appengine-java-sdk/1.9.23/appengine-java-sdk-1.9.23.zip", diff --git a/tools/build_rules/deprecation.bzl b/tools/build_rules/deprecation.bzl new file mode 100644 index 0000000000..e85953e831 --- /dev/null +++ b/tools/build_rules/deprecation.bzl @@ -0,0 +1,27 @@ +# +# Copyright 2016 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +def deprecated(language, rule, old_path, new_path): + return """This rule has moved out of @bazel_tools! + +The {0} rules have moved to https://github.com/bazelbuild/rules_{0}, you +should now refer them via @io_bazel_rules_{0}, use: + +load('{3}', '{1}') + +instead of: + +load('{2}', '{1}') +""".format(language, rule, old_path, new_path) diff --git a/tools/build_rules/go/def.bzl b/tools/build_rules/go/def.bzl index 9d7abce0d4..32800ce553 100644 --- a/tools/build_rules/go/def.bzl +++ b/tools/build_rules/go/def.bzl @@ -26,6 +26,15 @@ In order of priority: """ +load("//tools/build_rules:deprecation.bzl", "deprecated") + +def warning(rule): + print(deprecated( + "go", + rule, + "@bazel_tools//tools/build_rules/go:def.bzl", + "@io_bazel_rules_go//go:def.bzl")) + _DEFAULT_LIB = "go_default_library" _VENDOR_PREFIX = "/vendor/" @@ -48,6 +57,7 @@ def _go_prefix_impl(ctx): def _go_prefix(ctx): """slash terminated go-prefix""" + warning("go_prefix") prefix = ctx.attr.go_prefix.go_prefix if prefix != "" and not prefix.endswith("/"): prefix = prefix + "/" @@ -193,6 +203,7 @@ def emit_go_compile_action(ctx, sources, deps, out_lib): def go_library_impl(ctx): """Implements the go_library() rule.""" + warning("go_library") sources = set(ctx.files.srcs) deps = ctx.attr.deps @@ -255,6 +266,7 @@ def emit_go_link_action(ctx, transitive_libs, lib, executable): def go_binary_impl(ctx): """go_binary_impl emits actions for compiling and linking a go executable.""" + warning("go_binary") lib_result = go_library_impl(ctx) executable = ctx.outputs.executable lib_out = ctx.outputs.lib @@ -273,6 +285,8 @@ def go_test_impl(ctx): It emits an action to run the test generator, and then compiles the test into a binary.""" + warning("go_test") + lib_result = go_library_impl(ctx) main_go = ctx.outputs.main_go prefix = _go_prefix(ctx) @@ -367,7 +381,8 @@ go_test = rule( "test_generator": attr.label( executable = True, default = Label( - "@bazel_tools//tools/build_rules/go/tools:generate_test_main"), + "@bazel_tools//tools/build_rules/go/tools:generate_test_main", + ), cfg = HOST_CFG, ), }, @@ -397,6 +412,7 @@ filegroup( """ def go_repositories(): + warning("go_repositories") native.new_http_archive( name= "golang_linux_amd64", url = "https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz", |