Skip to content

Commit

Permalink
Change experimental build to use pl_exp_ variants
Browse files Browse the repository at this point in the history
Summary:
This allows us to mark targets as manual build and not bazel ignore them.

We need to add a linter to make sure we follow this rule.

Test Plan: bazel test //...

Reviewers: oazizi, michelle, #engineering

Reviewed By: oazizi, #engineering

Differential Revision: https://phab.corp.pixielabs.ai/D1122

GitOrigin-RevId: f47fd0d
  • Loading branch information
zasgar committed Jul 8, 2019
1 parent bc6519e commit 6b3a9fe
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
4 changes: 0 additions & 4 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# If you want to work on experimental you need to delete the following line.
# Sadly bazel does not seem to provide an easy way to this automatically.
experimental/

src/ui/node_modules
vendor
third_party/bpftrace/build
5 changes: 5 additions & 0 deletions bazel/cc_resource.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ def pl_cc_resource_impl(

# Create a cc_library with the .o files.
native.cc_library(name = name, srcs = object_files, tags = tags, linkstatic = 1, **kwargs)

def pl_exp_cc_resource(**kwargs):
tags = kwargs.get("tags", [])
kwargs["tags"] = tags + ["manual"]
pl_cc_resource(**kwargs)
24 changes: 23 additions & 1 deletion bazel/pl_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def pl_cc_test(
args = [],
coverage = True,
local = False):
test_lib_tags = []
test_lib_tags = list(tags)
if coverage:
test_lib_tags.append("coverage_test_lib")
pl_cc_test_library(
Expand All @@ -180,6 +180,7 @@ def pl_cc_test(
repository = repository,
tags = test_lib_tags,
)

native.cc_test(
name = name,
copts = pl_copts(repository, test = True),
Expand Down Expand Up @@ -254,3 +255,24 @@ def pl_go_library(**kwargs):
kwargs["clinkopts"] = pl_linkopts()
kwargs["toolchains"] = ["@bazel_tools//tools/cpp:current_cc_toolchain"]
go_library(**kwargs)

def append_manual_tag(kwargs):
tags = kwargs.get("tags", [])
kwargs["tags"] = tags + ["manual"]
return kwargs

def pl_exp_cc_binary(**kwargs):
kwargs = append_manual_tag(kwargs)
pl_cc_binary(**kwargs)

def pl_exp_cc_library(**kwargs):
kwargs = append_manual_tag(kwargs)
pl_cc_library(**kwargs)

def pl_exp_cc_test(**kwargs):
kwargs = append_manual_tag(kwargs)
pl_cc_test(**kwargs)

def pl_exp_cc_test_library(**kwargs):
kwargs = append_manual_tag(kwargs)
pl_cc_test_library(**kwargs)
5 changes: 5 additions & 0 deletions bazel/proto_compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ def pl_go_proto_library(name, proto, importpath, deps = [], **kwargs):
deps = deps,
**kwargs
)

def pl_exp_cc_proto_library(**kwargs):
tags = kwargs.get("tags", [])
kwargs["tags"] = tags + ["manual"]
pl_cc_proto_library(**kwargs)

0 comments on commit 6b3a9fe

Please sign in to comment.