Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit ff93611

Browse files
authored
Revert "bazel: add config setting for zig linux 86 and incompatible cc (#52364)" (#52457)
Main is blocked because of this commit This reverts commit 7e6ca20. ## Test plan none - this is a revert <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles -->
1 parent 1f5fed0 commit ff93611

File tree

5 files changed

+36
-54
lines changed

5 files changed

+36
-54
lines changed

.bazelrc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ build --test_env=ENABLE_BAZEL_PACKAGES_LOAD_HACK=true
2020

2121
# Needed by https://github.com/uber/bazel-zig-cc which we use to cross-compile
2222
# CGo code for cmd/symbols to be used in containers.
23-
build:incompat-zig-linux-amd64 --incompatible_enable_cc_toolchain_resolution
24-
build:incompat-zig-linux-amd64 --platforms @zig_sdk//platform:linux_amd64
25-
build:incompat-zig-linux-amd64 --extra_toolchains @zig_sdk//toolchain:linux_amd64_musl
26-
23+
build --incompatible_enable_cc_toolchain_resolution
2724

2825
# Except in CI run E2E tests in headless mode
2926
try-import %workspace%/user.bazelrc

cmd/server/build-bazel.sh

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,44 +57,41 @@ MUSL_TARGETS=(
5757

5858
if [[ "${ENTERPRISE:-"false"}" == "false" ]]; then
5959
MUSL_TARGETS+=(//cmd/symbols)
60+
exit $?
6061
else
6162
MUSL_TARGETS+=(//enterprise/cmd/symbols)
6263
fi
6364

64-
bazelrc=(
65-
--bazelrc=.bazelrc
66-
)
67-
if [[ ${CI:-""} == "true" ]]; then
68-
bazelrc+=(
69-
--bazelrc=.aspect/bazelrc/ci.bazelrc
70-
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc
71-
)
72-
fi
73-
7465
echo "--- bazel build musl"
7566
bazel \
76-
"${bazelrc[@]}"
67+
--bazelrc=.bazelrc \
68+
--bazelrc=.aspect/bazelrc/ci.bazelrc \
69+
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc \
7770
build \
7871
"${MUSL_TARGETS[@]}" \
7972
--stamp \
8073
--workspace_status_command=./dev/bazel_stamp_vars.sh \
81-
--config incompat-zig-linux-amd64
74+
--platforms @zig_sdk//platform:linux_amd64 \
75+
--extra_toolchains @zig_sdk//toolchain:linux_amd64_musl
8276

8377
for MUSL_TARGET in "${MUSL_TARGETS[@]}"; do
84-
out=$(bazel
85-
"${bazelrc[@]}"
78+
out=$(bazel --bazelrc=.bazelrc \
79+
--bazelrc=.aspect/bazelrc/ci.bazelrc \
80+
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc \
8681
cquery \
8782
"$MUSL_TARGET" \
8883
--stamp \
8984
--workspace_status_command=./dev/bazel_stamp_vars.sh \
90-
--config incompat-zig-linux-amd64 \
85+
--platforms @zig_sdk//platform:linux_amd64 \
86+
--extra_toolchains @zig_sdk//toolchain:linux_amd64_musl \
9187
--output=files)
9288
cp "$out" "$BINDIR"
9389
echo "copying $MUSL_TARGET"
9490
done
9591

9692
if [[ "${ENTERPRISE:-"false"}" == "false" ]]; then
9793
TARGETS=("${OSS_TARGETS[@]}")
94+
exit $?
9895
else
9996
TARGETS=("${ENTERPRISE_TARGETS[@]}")
10097
fi

cmd/symbols/build-bazel.sh

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,25 @@ cleanup() {
1212
trap cleanup EXIT
1313

1414
echo "--- bazel build"
15-
16-
bazelrc=(
17-
--bazelrc=.bazelrc
18-
)
19-
if [[ ${CI:-""} == "true" ]]; then
20-
bazelrc+=(
21-
--bazelrc=.aspect/bazelrc/ci.bazelrc
22-
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc
23-
)
24-
fi
25-
26-
27-
bazel "${bazelrc[@]}" \
28-
build \
15+
bazel build \
16+
--bazelrc=.bazelrc \
17+
--bazelrc=.aspect/bazelrc/ci.bazelrc \
18+
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc \
2919
//cmd/symbols \
3020
--stamp \
3121
--workspace_status_command=./dev/bazel_stamp_vars.sh \
32-
--config incompat-zig-linux-amd64
22+
--platforms @zig_sdk//platform:linux_amd64 \
23+
--extra_toolchains @zig_sdk//toolchain:linux_amd64_musl
3324

3425
out=$(
35-
bazel "${bazelrc[@]}" \
36-
cquery //cmd/symbols \
26+
bazel build \
27+
--bazelrc=.bazelrc \
28+
--bazelrc=.aspect/bazelrc/ci.bazelrc \
29+
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc \ cquery //cmd/symbols \
3730
--stamp \
3831
--workspace_status_command=./dev/bazel_stamp_vars.sh \
39-
--config incompat-zig-linux-amd64 \
32+
--platforms @zig_sdk//platform:linux_amd64 \
33+
--extra_toolchains @zig_sdk//toolchain:linux_amd64_musl \
4034
--output=files
4135
)
4236
cp "$out" "$OUTPUT"

enterprise/cmd/symbols/build-bazel.sh

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,36 @@
33
# This script builds the symbols docker image.
44

55
cd "$(dirname "${BASH_SOURCE[0]}")/../../.."
6-
set -eu
6+
set -eux
77

88
OUTPUT=$(mktemp -d -t sgdockerbuild_XXXXXXX)
99
cleanup() {
1010
rm -rf "$OUTPUT"
1111
}
1212
trap cleanup EXIT
1313

14-
bazelrc=(
15-
--bazelrc=.bazelrc
16-
)
17-
if [[ ${CI:-""} == "true" ]]; then
18-
bazelrc+=(
19-
--bazelrc=.aspect/bazelrc/ci.bazelrc
20-
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc
21-
)
22-
fi
23-
2414
echo "--- bazel build"
2515
bazel \
26-
"${bazelrc[@]}" \
16+
--bazelrc=.bazelrc \
17+
--bazelrc=.aspect/bazelrc/ci.bazelrc \
18+
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc \
2719
build \
2820
//enterprise/cmd/symbols \
2921
--stamp \
3022
--workspace_status_command=./dev/bazel_stamp_vars.sh \
31-
--config incompat-zig-linux-amd64
23+
--platforms @zig_sdk//platform:linux_amd64 \
24+
--extra_toolchains @zig_sdk//toolchain:linux_amd64_musl
3225

3326
out=$(
34-
bazel \
35-
"${bazelrc[@]}" \
27+
bazel --bazelrc=.bazelrc \
28+
--bazelrc=.aspect/bazelrc/ci.bazelrc \
29+
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc \
3630
cquery \
3731
//enterprise/cmd/symbols \
3832
--stamp \
3933
--workspace_status_command=./dev/bazel_stamp_vars.sh \
40-
--config incompat-zig-linux-amd64 \
34+
--platforms @zig_sdk//platform:linux_amd64 \
35+
--extra_toolchains @zig_sdk//toolchain:linux_amd64_musl \
4136
--output=files
4237
)
4338
cp "$out" "$OUTPUT"

enterprise/dev/app/build-backend.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ bazel_build() {
6565
# for more info see the BUILD.bazel file in enterprise/cmd/sourcegraph
6666
if [[ ${CROSS_COMPILE_X86_64_MACOS:-0} == 1 ]]; then
6767
bazel_target="//enterprise/cmd/sourcegraph:sourcegraph_x86_64_darwin"
68-
# we don't use the incompat-zig-linux-amd64 bazel config here, since we need bazel to pick up the host cc
6968
bazel_opts="${bazel_opts} --platforms @zig_sdk//platform:darwin_amd64 --extra_toolchains @zig_sdk//toolchain:darwin_amd64"
7069
fi
7170

0 commit comments

Comments
 (0)