Skip to content

Commit

Permalink
bazel PG: Avoid calling sysctl on non-darwin platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
cjones051073 committed Apr 26, 2021
1 parent 5c768e3 commit 7d94e4a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions _resources/port1.0/group/bazel-1.0.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ proc bazel::get_cmd_opts {} {
proc bazel::get_build_opts {} {
global build.jobs configure.cc configure.cxx configure.cflags configure.cxxflags configure.ldflags
global configure.sdk_version use_parallel_build bazel.limit_build_jobs
global os.platform
# Bazel build options
# See https://docs.bazel.build/versions/master/memory-saving-mode.html
set bazel_build_opts "--subcommands --compilation_mode=opt --verbose_failures --nouse_action_cache --discard_analysis_cache --notrack_incremental_state --nokeep_state_after_build "
Expand All @@ -229,9 +230,11 @@ proc bazel::get_build_opts {} {
if { [option bazel.limit_build_jobs] } {
# Limit the number of parallel jobs to the number of physical, not logical, cpus.
# First current setting to ensure we would be reducing the current setting.
set physicalcpus [sysctl hw.physicalcpu]
if { ${build.jobs} > ${physicalcpus} } {
build.jobs ${physicalcpus}
if { ${os.platform} eq "darwin" } {
set physicalcpus [sysctl hw.physicalcpu]
if { ${build.jobs} > ${physicalcpus} } {
build.jobs ${physicalcpus}
}
}
set bazel_build_opts "${bazel_build_opts} --jobs ${build.jobs}"
if { [option bazel.max_ram_fraction] > 0 } {
Expand Down

0 comments on commit 7d94e4a

Please sign in to comment.