Skip to content

Commit

Permalink
build: optimize builds in RBE (envoyproxy#11966)
Browse files Browse the repository at this point in the history
- schedule wee8 build in larger machines with size=large label
- luajit/moonjit make with `-j`
- delete empty globs (partly addresses envoyproxy#9492) 

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
  • Loading branch information
lizan committed Jul 22, 2020
1 parent b33f3cc commit 3c6868a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
8 changes: 8 additions & 0 deletions bazel/dependency_imports.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@envoy_build_tools//toolchains:rbe_toolchains_config.bzl", "rbe_toolchains_config")
load("@bazel_toolchains//rules/exec_properties:exec_properties.bzl", "create_rbe_exec_properties_dict", "custom_exec_properties")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
load("@upb//bazel:repository_defs.bzl", upb_bazel_version_repository = "bazel_version_repository")
Expand All @@ -19,6 +20,13 @@ def envoy_dependency_imports(go_version = GO_VERSION):
apple_rules_dependencies()
upb_bazel_version_repository(name = "upb_bazel_version")

custom_exec_properties(
name = "envoy_large_machine_exec_property",
constants = {
"LARGE_MACHINE": create_rbe_exec_properties_dict(labels = dict(size = "large")),
},
)

go_repository(
name = "org_golang_google_grpc",
build_file_proto_mode = "disable",
Expand Down
3 changes: 0 additions & 3 deletions bazel/external/fmtlib.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ licenses(["notice"]) # Apache 2

cc_library(
name = "fmtlib",
srcs = glob([
"fmt/*.cc",
]),
hdrs = glob([
"include/fmt/*.h",
]),
Expand Down
1 change: 0 additions & 1 deletion bazel/external/spdlog.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ licenses(["notice"]) # Apache 2
cc_library(
name = "spdlog",
hdrs = glob([
"include/**/*.cc",
"include/**/*.h",
]),
defines = ["SPDLOG_FMT_EXTERNAL"],
Expand Down
2 changes: 2 additions & 0 deletions bazel/external/wee8.BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@envoy_large_machine_exec_property//:constants.bzl", "LARGE_MACHINE")
load(":genrule_cmd.bzl", "genrule_cmd")

licenses(["notice"]) # Apache 2
Expand Down Expand Up @@ -26,4 +27,5 @@ genrule(
"libwee8.a",
],
cmd = genrule_cmd("@envoy//bazel/external:wee8.genrule_cmd"),
exec_properties = LARGE_MACHINE,
)
4 changes: 2 additions & 2 deletions bazel/foreign_cc/luajit.patch
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ index 0000000..9c71271
--- /dev/null
+++ b/build.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#!/usr/bin/env python3
+
+import argparse
+import os
Expand Down Expand Up @@ -93,7 +93,7 @@ index 0000000..9c71271
+ with open("clang-asan-blocklist.txt", "w") as f:
+ f.write("fun:*\n")
+
+ os.system('make V=1 PREFIX="{}" install'.format(args.prefix))
+ os.system('make -j{} V=1 PREFIX="{}" install'.format(os.cpu_count(), args.prefix))
+
+def win_main():
+ src_dir = os.path.dirname(os.path.realpath(__file__))
Expand Down
4 changes: 2 additions & 2 deletions bazel/foreign_cc/moonjit.patch
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ index 0000000..9c71271
--- /dev/null
+++ b/build.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#!/usr/bin/env python3
+
+import argparse
+import os
Expand Down Expand Up @@ -84,7 +84,7 @@ index 0000000..9c71271
+ with open("clang-asan-blocklist.txt", "w") as f:
+ f.write("fun:*\n")
+
+ os.system('make V=1 PREFIX="{}" install'.format(args.prefix))
+ os.system('make -j{} V=1 PREFIX="{}" install'.format(os.cpu_count(), args.prefix))
+
+def win_main():
+ src_dir = os.path.dirname(os.path.realpath(__file__))
Expand Down
1 change: 0 additions & 1 deletion configs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ envoy_py_test_binary(
srcs = ["configgen.py"],
data = glob([
"*.yaml",
"*.json",
]),
external_deps = ["jinja2"],
)
Expand Down

0 comments on commit 3c6868a

Please sign in to comment.