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

sluongng/reapply linkopt macos #5698

Closed
wants to merge 5 commits into from
Closed
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
11 changes: 9 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ common:release --remote_download_toplevel

# Configuration used for release-mac workflow
common:release-mac --config=release-shared
common:release-mac --config=cache

# Configuration used for release-m1 workflow
common:release-m1 --config=release-shared
Expand Down Expand Up @@ -168,8 +169,6 @@ common --nolegacy_important_outputs

# Use a static PATH variable to prevent unnecessary rebuilds of dependencies like protobuf.
common --incompatible_strict_action_env
common:macos --action_env=DEVELOPER_DIR
common:macos --host_action_env=DEVELOPER_DIR

# rules_nodejs needs runfiles to be explicitly enabled.
common:linux --enable_runfiles
Expand Down Expand Up @@ -209,6 +208,14 @@ common:macos --cxxopt=-std=c++17
common:windows --host_cxxopt=/std:c++17
common:windows --cxxopt=/std:c++17

# Starting from Xcode 15, the linker will warn about duplicate flags.
# This is currently not avoidable with the current way the local cc toolchain is configured
# as well as how linkopts are propagated through the dependency graph between libraries.
# This flag is a workaround to silence the linker warnings.
# common:macos --linkopt="-Wl,-no_warn_duplicate_libraries"
# common:macos --host_linkopt="-Wl,-no_warn_duplicate_libraries"
common:macos --platform_mappings=platform_mapping

# Ensure that we don't use the apple_support cc_toolchain
common:macos --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1

Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.0
7.0.1
36 changes: 6 additions & 30 deletions .github/workflows/build-mac-intel-github-release-artifacts.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
name: "Build Mac-Intel Github Release Artifacts"

on:
workflow_dispatch:
inputs:
release_branch:
description: "Git branch to checkout."
required: true
default: "master"
type: string
version_tag:
description: "Version to tag release artifacts."
required: true
type: string
workflow_call:
inputs:
release_branch:
description: "Git branch to checkout."
required: true
type: string
version_tag:
description: "Version to tag release artifacts."
required: true
type: string
pull_request:
branches:
- master

jobs:
build:
Expand All @@ -31,9 +13,6 @@ jobs:
uses: actions/checkout@v3
with:
ref: ${{ inputs.release_branch }}
# We need to fetch git tags to obtain the latest version tag to report
# the version of the running binary.
fetch-depth: 0

- name: Install bazelisk
run: |
Expand All @@ -45,10 +24,7 @@ jobs:
- name: Build and Upload Artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEVELOPER_DIR: "/Library/Developer/CommandLineTools"
run: |
export DEVELOPER_DIR=/Library/Developer/CommandLineTools
"${GITHUB_WORKSPACE}/bin/bazel" build --config=release-mac --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} //server/cmd/buildbuddy:buildbuddy //enterprise/server/cmd/server:buildbuddy //enterprise/server/cmd/executor:executor
cp bazel-bin/server/cmd/**/**/buildbuddy buildbuddy-darwin-amd64
cp bazel-bin/enterprise/server/cmd/**/**/buildbuddy buildbuddy-enterprise-darwin-amd64
cp bazel-bin/enterprise/server/cmd/**/**/executor executor-enterprise-darwin-amd64
gh release upload ${{ inputs.version_tag }} buildbuddy-darwin-amd64 buildbuddy-enterprise-darwin-amd64 executor-enterprise-darwin-amd64 --clobber
env
"${GITHUB_WORKSPACE}/bin/bazel" build --toolchain_resolution_debug='@bazel_tools//tools/cpp:toolchain_type' --config=release-mac --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} //server/cmd/buildbuddy:buildbuddy //enterprise/server/cmd/server:buildbuddy //enterprise/server/cmd/executor:executor
4 changes: 4 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ http_archive(

http_archive(
name = "io_bazel_rules_go",
patch_args = ["-p1"],
patches = [
"//buildpatches:rules_go.patch",
],
sha256 = "7c76d6236b28ff695aa28cf35f95de317a9472fd1fb14ac797c9bf684f09b37c",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.44.2/rules_go-v0.44.2.zip",
Expand Down
12 changes: 12 additions & 0 deletions buildpatches/rules_go.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/go/platform/apple.bzl b/go/platform/apple.bzl
index 45c62d6c..f2d8f836 100644
--- a/go/platform/apple.bzl
+++ b/go/platform/apple.bzl
@@ -41,6 +41,7 @@ def apple_ensure_options(ctx, env, _tags, compiler_option_lists, linker_option_l
if not platform:
return
env.update(_apple_env(ctx, platform))
+ env.update({"DEVELOPER_DIR": "/Library/Developer/CommandLineTools"})
min_version = _apple_version_min(ctx, platform, platform_type)
for compiler_options in compiler_option_lists:
compiler_options.append(min_version)
5 changes: 5 additions & 0 deletions platform_mapping
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
platforms:
@local_config_platform//:host
--action_env=DEVELOPER_DIR=/Library/Developer/CommandLineTools
--host_action_env=DEVELOPER_DIR=/Library/Developer/CommandLineTools
--host_linkopt="-Wl,-v"
Loading