Skip to content

Commit

Permalink
bazel: Reduce rust binary size in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kiron1 committed Dec 18, 2023
1 parent 46cd2e4 commit 48f9acd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ build:x86_64_apple_darwin --cpu=darwin_x86_64
build:aarch64_apple_darwin --platforms=:aarch64-apple-darwin
build:aarch64_apple_darwin --cpu=darwin_arm64

build:release --compilation_mode=opt
build:release --strip=always
build:release --@rules_rust//:extra_rustc_flag=-Cstrip=debuginfo
build:release --@rules_rust//:extra_rustc_flag=-Copt-level=z
build:release --@rules_rust//:extra_rustc_flag=-Cdebuginfo=0
build:release --@rules_rust//:extra_rustc_flag=-Clto=true
build:release --@rules_rust//:extra_rustc_flag=-Ccodegen-units=1

# Always display the flags being used
common:ci --announce_rc

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ jobs:
- name: Build package
run: >
bazel build
-c opt
--config=ci
--config=release
--//:version=${{ needs.version.outputs.version }}
--//:rev=${{ needs.version.outputs.rev }}
${{ matrix.buildflags }}
Expand All @@ -204,8 +204,8 @@ jobs:
run: >
bazel
run
-c opt
--config=ci
--config=release
--//:version=${{ needs.version.outputs.version }}
--//:rev=${{ needs.version.outputs.rev }}
${{ matrix.buildflags }}
Expand Down

0 comments on commit 48f9acd

Please sign in to comment.