From b3fcc9d2db3f1d3f87d918f2cb990a032b9e9edb Mon Sep 17 00:00:00 2001 From: Matt Rice Date: Mon, 24 Jul 2017 16:19:07 -0400 Subject: [PATCH 1/2] Added skylark function for envoy targets that currently call cc_library directly --- bazel/envoy_build_system.bzl | 7 +++++++ include/envoy/common/BUILD | 2 +- test/test_common/BUILD | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index b82d3130563cd..c239fe94f9b6f 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -54,6 +54,13 @@ def envoy_include_prefix(path): return '/'.join(path.split('/')[1:]) return None +# Envoy C++ library targets that need no transformations or additional dependencies before being +# passed to cc_library should be specified with this function. Note: this exists to ensure that +# all envoy targets pass through an envoy-declared skylark function where they can be modified +# before being passed to a native bazel function. +def basic_envoy_cc_library(name, **kargs): + native.cc_library(name = name, **kwargs) + # Envoy C++ library targets should be specified with this function. def envoy_cc_library(name, srcs = [], diff --git a/include/envoy/common/BUILD b/include/envoy/common/BUILD index 6a9792e2310fd..de635ec2c418c 100644 --- a/include/envoy/common/BUILD +++ b/include/envoy/common/BUILD @@ -8,7 +8,7 @@ load( envoy_package() -cc_library( +basic_envoy_cc_library( name = "base_includes", hdrs = [ "exception.h", diff --git a/test/test_common/BUILD b/test/test_common/BUILD index bfd363cae7fd2..bb6eb123a7a35 100644 --- a/test/test_common/BUILD +++ b/test/test_common/BUILD @@ -9,7 +9,7 @@ load( envoy_package() -cc_library( +basic_envoy_cc_library( name = "printers_includes", hdrs = ["printers.h"], ) From 8aaf35f044a57f9d1b9525cb64fcf18f1bf528f7 Mon Sep 17 00:00:00 2001 From: Matt Rice Date: Mon, 24 Jul 2017 16:31:21 -0400 Subject: [PATCH 2/2] updated name and corrected a few minor issues --- bazel/envoy_build_system.bzl | 4 ++-- include/envoy/common/BUILD | 3 ++- test/test_common/BUILD | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index c239fe94f9b6f..32f717bc44d06 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -58,8 +58,8 @@ def envoy_include_prefix(path): # passed to cc_library should be specified with this function. Note: this exists to ensure that # all envoy targets pass through an envoy-declared skylark function where they can be modified # before being passed to a native bazel function. -def basic_envoy_cc_library(name, **kargs): - native.cc_library(name = name, **kwargs) +def envoy_basic_cc_library(name, **kargs): + native.cc_library(name = name, **kargs) # Envoy C++ library targets should be specified with this function. def envoy_cc_library(name, diff --git a/include/envoy/common/BUILD b/include/envoy/common/BUILD index de635ec2c418c..97ac34438fe66 100644 --- a/include/envoy/common/BUILD +++ b/include/envoy/common/BUILD @@ -3,12 +3,13 @@ licenses(["notice"]) # Apache 2 load( "//bazel:envoy_build_system.bzl", "envoy_cc_library", + "envoy_basic_cc_library", "envoy_package", ) envoy_package() -basic_envoy_cc_library( +envoy_basic_cc_library( name = "base_includes", hdrs = [ "exception.h", diff --git a/test/test_common/BUILD b/test/test_common/BUILD index bb6eb123a7a35..98b306158ecf3 100644 --- a/test/test_common/BUILD +++ b/test/test_common/BUILD @@ -3,13 +3,14 @@ licenses(["notice"]) # Apache 2 load( "//bazel:envoy_build_system.bzl", "envoy_cc_library", + "envoy_basic_cc_library", "envoy_cc_test_library", "envoy_package", ) envoy_package() -basic_envoy_cc_library( +envoy_basic_cc_library( name = "printers_includes", hdrs = ["printers.h"], )