Skip to content

Commit

Permalink
size: override pgv validations with NOP functions
Browse files Browse the repository at this point in the history
This change updates pgv to a version that supports a "cc nop" language. With
that we can make the validation functions a NOP that hopefuly gets inlined.

This is the PGV change for reference: bufbuild/protoc-gen-validate#533

Size delta: -3.7 Mi

Signed-off-by: Martin Conte Mac Donell <reflejo@gmail.com>
  • Loading branch information
Reflejo committed Feb 10, 2022
1 parent 3d972f4 commit 2a060fe
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ build --features=-per_object_debug_info
# Suppress deprecated declaration warnings due to extensive transitive noise from protobuf.
build --copt -Wno-deprecated-declarations

# Override PGV validation with NOP functions
build --@com_envoyproxy_protoc_gen_validate//bazel:template-flavor=nop

# Enable source map for debugging in IDEs
build:dbg --copt="-fdebug-compilation-dir" --copt="/proc/self/cwd"

Expand Down
31 changes: 31 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
workspace(name = "envoy_mobile")

# TODO[fz]: Remove once envoy updates protoc
# Uses PGV that includes the CC NOP template to disable validation.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
],
)

load("@bazel_gazelle//:deps.bzl", "go_repository")

go_repository(
name = "com_github_lyft_protoc_gen_star",
importpath = "github.com/lyft/protoc-gen-star",
sum = "h1:xOpFu4vwmIoUeUrRuAtdCrZZymT/6AkW/bsUWA506Fo=",
version = "v0.6.0",
)

git_repository(
name = "com_envoyproxy_protoc_gen_validate",
commit = "79071f0f8b04188b297a0517a6e55b2d3641ab5a",
remote = "https://github.com/envoyproxy/protoc-gen-validate"
)

# End of PGV overrides

load("@envoy_mobile//bazel:envoy_mobile_repositories.bzl", "envoy_mobile_repositories")
envoy_mobile_repositories()

Expand Down

0 comments on commit 2a060fe

Please sign in to comment.