Skip to content

Commit

Permalink
Deprecate closure_repositories in favor of rules_closure_{dependencie…
Browse files Browse the repository at this point in the history
…s,toolchains} (bazelbuild#423)

This PR adds macros to closure/repositories.bzl to make rules_closure
more compliant with Bazel's Style Guide for Rules.

Working towards bazelbuild#421
  • Loading branch information
Yannic authored and sgammon committed Oct 17, 2019
1 parent b892d15 commit daf5b04
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
8 changes: 3 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ workspace(name = "io_bazel_rules_closure")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//closure/private:java_import_external.bzl", "java_import_external")
load("//closure:repositories.bzl", "closure_repositories")

closure_repositories()
load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains")
rules_closure_dependencies()
rules_closure_toolchains()

load("//closure:toolchains.bzl", "closure_register_toolchains")

closure_register_toolchains()

java_import_external(
name = "com_google_guava_testlib",
Expand Down
3 changes: 1 addition & 2 deletions closure/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ closure_template_library = _closure_template_library
closure_js_test = _closure_js_test
phantomjs_test = _phantomjs_test
filegroup_external = _filegroup_external
closure_repositories = _closure_repositories
closure_register_toolchains = _closure_register_toolchains
closure_repositories = _closure_repositories # TODO(yannic): Remove on 2019-11-01.
web_library = _web_library
web_library_external = _web_library_external
25 changes: 24 additions & 1 deletion closure/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,30 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file"
load("//closure/private:java_import_external.bzl", "java_import_external")
load("//closure/private:platform_http_file.bzl", "platform_http_file")

def closure_repositories(
_ERROR_CLOSURE_REPOSITORIES_IS_DEPRECATED = """
closure_repositories() is deprecated.
Please add the following to your workspace instead:
load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains")
rules_closure_dependencies()
rules_closure_toolchains()
""".strip()

def closure_repositories(**kargs):
"""Legacy macro to import dependencies for Closure Rules."""

print(_ERROR_CLOSURE_REPOSITORIES_IS_DEPRECATED)
rules_closure_dependencies(**kargs)

def rules_closure_toolchains():
"""An utility method to load all Closure toolchains.
It doesn't do anything at the moment.
"""
pass

def rules_closure_dependencies(
omit_aopalliance = False,
omit_args4j = False,
omit_bazel_skylib = False,
Expand Down

0 comments on commit daf5b04

Please sign in to comment.