Skip to content

Commit

Permalink
[bazel] Enable WMO in release configuration (realm#4252)
Browse files Browse the repository at this point in the history
Enabling WMO can make SwiftLint up to 90% faster in my testing, and
matches what SwiftPM does when building with `swift buid -c release`.
  • Loading branch information
jpsim authored Sep 28, 2022
1 parent 86a176d commit d2c638b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ build --macos_minimum_os=12.0 --host_macos_minimum_os=12.0
build --disk_cache=~/.bazel_cache

build:release \
--compilation_mode=opt
--compilation_mode=opt \
--features=swift.opt_uses_wmo
2 changes: 1 addition & 1 deletion Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ has_app_changes = !modified_files.grep(/Source/).empty?
has_test_changes = !modified_files.grep(/Tests/).empty?
has_danger_changes = !modified_files.grep(/Dangerfile|script\/oss-check|Gemfile/).empty?
has_package_changes = !modified_files.grep(/Package\.swift/).empty?
has_bazel_changes = !modified_files.grep(/WORKSPACE|bazel\/|BUILD/).empty?
has_bazel_changes = !modified_files.grep(/\.bazelrc|WORKSPACE|bazel\/|BUILD/).empty?

# Add a CHANGELOG entry for app changes
if !modified_files.include?('CHANGELOG.md') && has_app_changes
Expand Down
2 changes: 1 addition & 1 deletion tools/oss-check
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def build(branch)
perform("git worktree add --detach #{dir} #{target}")
end

build_command = "cd #{dir}; bazel build -c opt @SwiftLint//:swiftlint && mv bazel-bin/swiftlint swiftlint-#{branch}"
build_command = "cd #{dir}; bazel build --config=release @SwiftLint//:swiftlint && mv bazel-bin/swiftlint swiftlint-#{branch}"

perform(build_command)
return if $?.success?
Expand Down

0 comments on commit d2c638b

Please sign in to comment.