Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add distrib_cc_binary rule #11793

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tools/distributions/debian/debian_bin.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ filegroup(
name = "grpc-cpp-plugin",
srcs = ["grpc_cpp_plugin"],
)

# protobuf-compiler-grpc-java-plugin
filegroup(
name = "grpc-java-plugin",
srcs = ["grpc_java_plugin"],
)
1 change: 1 addition & 0 deletions tools/distributions/debian/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def debian_bin_deps():
symlinks = {
"protoc": "/usr/bin/protoc",
"grpc_cpp_plugin": "/usr/bin/grpc_cpp_plugin",
"grpc_java_plugin": "/usr/bin/grpc_java_plugin",
},
build_file = "//tools/distributions/debian:debian_bin.BUILD",
)
15 changes: 15 additions & 0 deletions tools/distributions/distribution_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ def distrib_cc_library(name, visibility = None, enable_distributions = [], **kwa

native.alias(name = name, actual = select(conditions), visibility = visibility)

def distrib_cc_binary(name, visibility = None, enable_distributions = [], **kwargs):
"""A macro for cc_binary rule to support distributions build (eg. Debian)"""
checked_in_name = name + "_checked_in"

native.cc_binary(name = checked_in_name, visibility = visibility, **kwargs)

conditions = {
"//conditions:default": ":" + checked_in_name,
}

if "debian" in enable_distributions:
conditions["//src/conditions:debian_build"] = "@debian_bin_deps//:" + name

native.alias(name = name, actual = select(conditions), visibility = visibility)

def distrib_jar_filegroup(name, visibility = None, enable_distributions = [], **kwargs):
"""A macro for filegroup rule to support distributions build (eg. Debian)"""
checked_in_name = name + "_checked_in"
Expand Down