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

size: optimizations for dynamic library #2049

Merged
merged 3 commits into from
Feb 18, 2022
Merged
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
9 changes: 9 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 Expand Up @@ -71,6 +74,12 @@ build:tsan-dev --test_env="TSAN_OPTIONS=report_atomic_races=0"
# into a zip file. This shouldn't affect crash reports.
build:release-common --define=no_debug_info=1

# Compile releases optimizing for size (eg -Os, etc).
build:release-common --config=sizeopt

# Set default symbols visibility to hidden to reduce .dynstr and the symbol table size
build:release-common --copt=-fvisibility=hidden

# Flags for release builds targeting iOS
build:release-ios --apple_bitcode=embedded
build:release-ios --config=ios
Expand Down
11 changes: 11 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
workspace(name = "envoy_mobile")

# TODO[fz]: Remove once envoy updates PGV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically, any release including this PR: bufbuild/protoc-gen-validate#533

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
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("@envoy_mobile//bazel:envoy_mobile_repositories.bzl", "envoy_mobile_repositories")
envoy_mobile_repositories()

Expand Down
20 changes: 20 additions & 0 deletions bazel/envoy_mobile_repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@bazel_gazelle//:deps.bzl", "go_repository")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file", "http_jar")

def envoy_mobile_repositories():
Expand All @@ -8,12 +10,30 @@ def envoy_mobile_repositories():
urls = ["https://github.com/google/bazel-common/archive/413b433b91f26dbe39cdbc20f742ad6555dd1e27.zip"],
)

# Uses PGV that includes the CC NOP template to disable validation.
# TODO(fz): Remove this once PGV is updated on envoy
override_pgv()

upstream_envoy_overrides()
swift_repos()
kotlin_repos()
android_repos()
python_repos()

def override_pgv():
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"
)

def upstream_envoy_overrides():
# Workaround due to a Detekt version compatibility with protobuf: https://github.com/envoyproxy/envoy-mobile/issues/1869
http_archive(
Expand Down