diff --git a/tools/build_defs/d/d.bzl b/tools/build_defs/d/d.bzl index 27943ffccca730..9e8164a0fe801e 100644 --- a/tools/build_defs/d/d.bzl +++ b/tools/build_defs/d/d.bzl @@ -14,6 +14,15 @@ """D rules for Bazel.""" +load("//tools/build_rules:deprecation.bzl", "deprecated") + +def warning(rule): + print(deprecated( + "d", + rule, + "@bazel_tools//tools/build_defs/d:d.bzl", + "@io_bazel_rules_d//d:d.bzl")) + A_FILETYPE = FileType([".a"]) D_FILETYPE = FileType([ @@ -198,6 +207,7 @@ def _setup_deps(deps, name, working_dir): def _d_library_impl(ctx): """Implementation of the d_library rule.""" + warning("d_library") d_lib = ctx.outputs.d_lib # Dependencies @@ -296,14 +306,17 @@ def _d_binary_impl_common(ctx, extra_flags=[]): def _d_binary_impl(ctx): """Implementation of the d_binary rule.""" + warning("d_binary") return _d_binary_impl_common(ctx) def _d_test_impl(ctx): """Implementation of the d_test rule.""" + warning("d_test") return _d_binary_impl_common(ctx, extra_flags=["-unittest"]) def _d_source_library_impl(ctx): """Implementation of the d_source_library rule.""" + warning("d_library") transitive_d_srcs = set(order="compile") transitive_libs = set() transitive_imports = set() @@ -345,6 +358,7 @@ def _d_docs_impl(ctx): documentation. 2. Create a ZIP archive containing the HTML documentation. """ + warning("d_docs") d_docs_zip = ctx.outputs.d_docs docs_dir = d_docs_zip.dirname + "/_d_docs" objs_dir = d_docs_zip.dirname + "/_d_objs" @@ -504,6 +518,7 @@ filegroup( """ def d_repositories(): + warning("d_repositories") native.new_http_archive( name = "dmd_linux_x86_64", url = "http://downloads.dlang.org/releases/2.x/2.070.0/dmd.2.070.0.linux.tar.xz", diff --git a/tools/build_defs/dotnet/csharp.bzl b/tools/build_defs/dotnet/csharp.bzl index a7660a69787ca0..918aa38e01dc8f 100644 --- a/tools/build_defs/dotnet/csharp.bzl +++ b/tools/build_defs/dotnet/csharp.bzl @@ -14,6 +14,15 @@ """CSharp bazel rules""" +load("//tools/build_rules:deprecation.bzl", "deprecated") + +def warning(rule): + print(deprecated( + "dotnet", + rule, + "@bazel_tools//tools/build_defs/dotnet:csharp.bzl", + "@io_bazel_rules_dotnet//dotnet:csharp.bzl")) + _MONO_UNIX_CSC = "/usr/local/bin/mcs" # TODO(jeremy): Windows when it's available. @@ -161,8 +170,8 @@ def _cs_runfiles(ctx, outputs, depinfo): files = outputs, transitive_files = set(depinfo.dlls + depinfo.transitive_dlls) or None) - def _csc_compile_impl(ctx): + warning("csharp_library") if hasattr(ctx.outputs, "csc_lib") and hasattr(ctx.outputs, "csc_exe"): fail("exactly one of csc_lib and csc_exe must be defined") @@ -191,6 +200,7 @@ def _csc_compile_impl(ctx): runfiles=runfiles) def _cs_nunit_run_impl(ctx): + warning("csharp_nunit_test") if hasattr(ctx.outputs, "csc_lib") and hasattr(ctx.outputs, "csc_exe"): fail("exactly one of csc_lib and csc_exe must be defined") @@ -220,66 +230,75 @@ def _cs_nunit_run_impl(ctx): _COMMON_ATTRS = { # configuration fragment that specifies - "_flag_start": attr.string(default="-"), + "_flag_start": attr.string(default = "-"), # where the csharp compiler is. - "csc": attr.string(default=_MONO_UNIX_CSC), + "csc": attr.string(default = _MONO_UNIX_CSC), # code dependencies for this rule. # all dependencies must provide an out field. - "deps": attr.label_list(providers=["out", "target_type"]), + "deps": attr.label_list(providers = [ + "out", + "target_type", + ]), # source files for this target. - "srcs": attr.label_list(allow_files = FileType([".cs", ".resx"])), + "srcs": attr.label_list(allow_files = FileType([ + ".cs", + ".resx", + ])), # resources to use as dependencies. # TODO(jeremy): "resources_deps": attr.label_list(allow_files=True), #TODO(jeremy): # name of the module if you are creating a module. #TODO(jeremy): "modulename": attri.string(), # warn level to use - "warn": attr.int(default=4), + "warn": attr.int(default = 4), # define preprocessor symbols. #TODO(jeremy): "define": attr.string_list(), } -_LIB_ATTRS={"_target_type": attr.string(default="library")} +_LIB_ATTRS = {"_target_type": attr.string(default = "library")} -_EXE_ATTRS={ - "_target_type": attr.string(default="exe"), +_EXE_ATTRS = { + "_target_type": attr.string(default = "exe"), # main class to use as entry point. "main_class": attr.string(), } -_NUNIT_ATTRS={ - "_nunit_exe": attr.label(default=Label("@nunit//:nunit_exe"), - single_file=True), - "_nunit_framework": attr.label(default=Label("@nunit//:nunit_framework")), - "_nunit_exe_libs": attr.label(default=Label("@nunit//:nunit_exe_libs")), +_NUNIT_ATTRS = { + "_nunit_exe": attr.label( + default = Label("@nunit//:nunit_exe"), + single_file = True, + ), + "_nunit_framework": attr.label(default = Label("@nunit//:nunit_framework")), + "_nunit_exe_libs": attr.label(default = Label("@nunit//:nunit_exe_libs")), } -_LIB_OUTPUTS={ +_LIB_OUTPUTS = { "csc_lib": "%{name}.dll", "doc_xml": "%{name}.xml", } -_BIN_OUTPUTS={ +_BIN_OUTPUTS = { "csc_exe": "%{name}.exe", } csharp_library = rule( - implementation=_csc_compile_impl, - attrs=_COMMON_ATTRS + _LIB_ATTRS, + attrs = _COMMON_ATTRS + _LIB_ATTRS, outputs = _LIB_OUTPUTS, + implementation = _csc_compile_impl, ) csharp_binary = rule( - implementation=_csc_compile_impl, - attrs=_COMMON_ATTRS + _EXE_ATTRS, + attrs = _COMMON_ATTRS + _EXE_ATTRS, + executable = True, outputs = _BIN_OUTPUTS, - executable=True) + implementation = _csc_compile_impl, +) csharp_nunit_test = rule( - implementation=_cs_nunit_run_impl, - executable=True, - attrs=_COMMON_ATTRS + _LIB_ATTRS +_NUNIT_ATTRS, + attrs = _COMMON_ATTRS + _LIB_ATTRS + _NUNIT_ATTRS, + executable = True, outputs = _LIB_OUTPUTS, - test=True + test = True, + implementation = _cs_nunit_run_impl, ) NUNIT_BUILD_FILE = """ @@ -303,6 +322,7 @@ filegroup( """ def csharp_repositories(): + warning("csharp_repositories") native.new_http_archive( name = "nunit", build_file_content = NUNIT_BUILD_FILE, diff --git a/tools/build_defs/groovy/groovy.bzl b/tools/build_defs/groovy/groovy.bzl index c995b50b2e7ace..992e7caf1aa31e 100644 --- a/tools/build_defs/groovy/groovy.bzl +++ b/tools/build_defs/groovy/groovy.bzl @@ -12,10 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("//tools/build_rules:deprecation.bzl", "deprecated") + +def warning(rule): + print(deprecated( + "groovy", + rule, + "@bazel_tools//tools/build_defs/groovy:groovy.bzl", + "@io_bazel_rules_groovy//groovy:groovy.bzl")) + def _groovy_jar_impl(ctx): """Creates a .jar file from Groovy sources. Users should rely on groovy_library instead of using this rule directly. """ + warning("groovy_jar") class_jar = ctx.outputs.class_jar build_output = class_jar.path + ".build_output" @@ -112,6 +122,7 @@ def groovy_library(name, srcs=[], deps=[], **kwargs): .java sources. The result is wrapped in a java_import so that java rules may depend on it. """ + warning("groovy_library") _groovy_jar( name = name + "-impl", srcs = srcs, @@ -129,6 +140,7 @@ def groovy_and_java_library(name, srcs=[], deps=[], **kwargs): java_library. The groovy_library will depend on the java_library, so the Groovy code may reference the Java code but not vice-versa. """ + warning("groovy_and_java_library") groovy_deps = deps jars = [] @@ -165,6 +177,7 @@ def groovy_binary(name, main_class, srcs=[], deps=[], **kwargs): """Rule analagous to java_binary that accepts .groovy sources instead of .java sources. """ + warning("groovy_binary") all_deps = deps + ["//external:groovy"] if srcs: groovy_library( @@ -190,6 +203,7 @@ def path_to_class(path): fail("groovy_test sources must be under src/test/java or src/test/groovy") def _groovy_test_impl(ctx): + warning("groovy_test") # Collect jars from the Groovy sdk groovy_sdk_jars = [file for file in ctx.files._groovysdk @@ -283,6 +297,7 @@ def groovy_junit_test( jvm_flags=[], size="small", tags=[]): + warning("groovy_junit_test") groovy_lib_deps = deps + ["//external:junit"] test_deps = deps + ["//external:junit"] @@ -330,6 +345,7 @@ def spock_test( jvm_flags=[], size="small", tags=[]): + warning("spock_test") groovy_lib_deps = deps + [ "//external:junit", "//external:spock", @@ -376,6 +392,7 @@ def spock_test( ) def groovy_repositories(): + warning("groovy_repositories") native.new_http_archive( name = "groovy_sdk_artifact", url = "http://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.4.zip", diff --git a/tools/build_defs/sass/sass.bzl b/tools/build_defs/sass/sass.bzl index 97ecfd57e424af..4ae978a1a1797e 100644 --- a/tools/build_defs/sass/sass.bzl +++ b/tools/build_defs/sass/sass.bzl @@ -12,7 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -SASS_FILETYPES = FileType([".sass", ".scss"]) +load("//tools/build_rules:deprecation.bzl", "deprecated") + +def warning(rule): + print(deprecated( + "sass", + rule, + "@bazel_tools//tools/build_defs/sass:sass.bzl", + "@io_bazel_rules_sass//sass:sass.bzl")) + +SASS_FILETYPES = FileType([ + ".sass", + ".scss", +]) def collect_transitive_sources(ctx): source_files = set(order="compile") @@ -21,6 +33,7 @@ def collect_transitive_sources(ctx): return source_files def _sass_library_impl(ctx): + warning("sass_library") transitive_sources = collect_transitive_sources(ctx) transitive_sources += SASS_FILETYPES.filter(ctx.files.srcs) return struct( @@ -30,6 +43,7 @@ def _sass_library_impl(ctx): def _sass_binary_impl(ctx): # Reference the sass compiler and define the default options # that sass_binary uses. + warning("sass_binary") sassc = ctx.file._sassc options = [ "--style={0}".format(ctx.attr.output_style), @@ -55,7 +69,6 @@ sass_deps_attr = attr.label_list( ) sass_library = rule( - implementation = _sass_library_impl, attrs = { "srcs": attr.label_list( allow_files = SASS_FILETYPES, @@ -64,10 +77,10 @@ sass_library = rule( ), "deps": sass_deps_attr, }, + implementation = _sass_library_impl, ) sass_binary = rule( - implementation = _sass_binary_impl, attrs = { "src": attr.label( allow_files = SASS_FILETYPES, @@ -86,6 +99,7 @@ sass_binary = rule( "css_file": "%{name}.css", "css_map_file": "%{name}.css.map", }, + implementation = _sass_binary_impl, ) LIBSASS_BUILD_FILE = """ @@ -124,6 +138,7 @@ cc_binary( """ def sass_repositories(): + warning("sass_repositories") native.new_http_archive( name = "libsass", url = "https://github.com/sass/libsass/archive/3.3.0-beta1.tar.gz", diff --git a/tools/build_rules/appengine/appengine.bzl b/tools/build_rules/appengine/appengine.bzl index 441a1ffb78ab4e..1abbc83a443220 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 00000000000000..e85953e8317c6a --- /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 9d7abce0d40798..32800ce553214f 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",