mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 21:35:42 +00:00
Decouple non-Mac builds from Xcode dependency (#6316)
* Decouple non-Mac builds from Xcode via BAZEL_NO_APPLE_CPP_TOOLCHAIN Set BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 in .bazelrc so apple_support skips Xcode detection (xcode-locator) entirely for Scala/C++/Go builds. Only mactools builds (Mac/Sparkle) re-enable the Apple CC toolchain. This means Xcode version changes no longer affect Eagle, Shardok, test, auth, docker, or Unity Windows builds — no expunge, no cache invalidation, no rebuild. The sync script and its expunge/cache-key logic are now scoped to mactools only and removed from all non-Mac CI workflows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Revert BAZEL_NO_APPLE_CPP_TOOLCHAIN; keep Apple CC with stable environ BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 broke builds because apple_support registers platforms (e.g. macos_x86_64) that require Apple CC toolchains for resolution — even in non-Mac builds. Instead, keep Apple CC enabled but ensure its repo rule never re-evaluates on non-Mac builds by keeping DEVELOPER_DIR pinned in common:macos. The sync script only runs for mactools builds and overrides DEVELOPER_DIR there. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,12 +37,14 @@ common:macos --host_linkopt=-Wl,-no_warn_duplicate_libraries
|
||||
# See: https://github.com/grpc/grpc/issues/37619
|
||||
common:macos --features=-module_maps
|
||||
|
||||
# Bake the Xcode build version into action cache keys so that stale
|
||||
# local/remote cache entries are naturally ignored after Xcode updates.
|
||||
# Generated by scripts/sync_bazel_xcode.sh (run in CI before every build).
|
||||
try-import %workspace%/.bazelrc.xcode
|
||||
# Pin DEVELOPER_DIR so the apple_cc_autoconf repo rule doesn't re-evaluate
|
||||
# when Xcode updates in-place. The sync script overrides this for mactools.
|
||||
common:macos --repo_env=DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
|
||||
|
||||
# Xcode config for mactools builds only. Generated by scripts/sync_bazel_xcode.sh.
|
||||
# Bakes the Xcode build version into action cache keys and sets DEVELOPER_DIR.
|
||||
try-import %workspace%/.bazelrc.xcode
|
||||
|
||||
common --java_language_version=25
|
||||
common --java_runtime_version=remotejdk_25
|
||||
common --tool_java_language_version=25
|
||||
|
||||
@@ -35,9 +35,6 @@ jobs:
|
||||
with:
|
||||
lfs: false
|
||||
|
||||
- name: Sync Bazel Xcode config
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
|
||||
- name: Build Auth Server Docker image
|
||||
id: build-auth
|
||||
run: |
|
||||
|
||||
@@ -44,8 +44,6 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: false
|
||||
- name: Sync Bazel Xcode config
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
- name: Check BUILD.bazel dependencies
|
||||
run: ./scripts/check_build_deps.sh --strict
|
||||
- name: Set up Node.js
|
||||
@@ -68,8 +66,6 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: false
|
||||
- name: Sync Bazel Xcode config
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
- name: Run tests
|
||||
run: bazel test --build_event_json_file=test.json //src/test/... //src/main/go/...
|
||||
- name: Collect failed test logs
|
||||
|
||||
@@ -74,10 +74,6 @@ jobs:
|
||||
with:
|
||||
lfs: false
|
||||
|
||||
- name: Sync Bazel Xcode config
|
||||
if: steps.check-latest.outputs.skip != 'true'
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
|
||||
- name: Fetch LFS files needed for admin server
|
||||
if: steps.check-latest.outputs.skip != 'true'
|
||||
run: git lfs pull --include="src/main/go/net/eagle0/admin_server/static/tiles/*"
|
||||
|
||||
@@ -29,7 +29,5 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: false
|
||||
- name: Sync Bazel Xcode config
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
- name: Build Eagle server
|
||||
run: bazel build //src/main/scala/net/eagle0/eagle:eagle_server
|
||||
|
||||
@@ -38,9 +38,6 @@ jobs:
|
||||
with:
|
||||
lfs: false
|
||||
|
||||
- name: Sync Bazel Xcode config
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
|
||||
- name: Build Shardok ARM64 binary (cross-compile for Linux ARM64)
|
||||
run: |
|
||||
set -ex
|
||||
|
||||
@@ -30,7 +30,5 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: false
|
||||
- name: Sync Bazel Xcode config
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
- name: Build Shardok server
|
||||
run: bazel build -c opt //src/main/cpp/net/eagle0/shardok:shardok-server
|
||||
|
||||
@@ -111,8 +111,6 @@ jobs:
|
||||
git lfs pull
|
||||
echo "LFS objects after pull:"
|
||||
git lfs ls-files | wc -l
|
||||
- name: Sync Bazel Xcode config
|
||||
run: ./scripts/sync_bazel_xcode.sh
|
||||
- name: Ensure Unity version installed
|
||||
run: ./ci/github_actions/ensure_unity_installed.sh windows
|
||||
- name: Build Windows unity
|
||||
|
||||
Generated
+3
-187
@@ -1138,168 +1138,12 @@
|
||||
},
|
||||
"@@googleapis+//:extensions.bzl%switched_rules": {
|
||||
"general": {
|
||||
"bzlTransitiveDigest": "vG6fuTzXD8MMvHWZEQud0MMH7eoC4GXY0va7VrFFh04=",
|
||||
"usagesDigest": "tB2/BAROtqvrfaBweAJxJpqqnx85mOx/aupy9bEK4Ss=",
|
||||
"bzlTransitiveDigest": "liqpEiZfQn8ycdEspyJt6J+baY9GQOl+9/prJJz2wTA=",
|
||||
"usagesDigest": "AtKnJVSfl4DFbEt1Zhzwc971VYZMgmyRYK8WMKrwA7o=",
|
||||
"recordedFileInputs": {},
|
||||
"recordedDirentsInputs": {},
|
||||
"envVariables": {},
|
||||
"generatedRepoSpecs": {
|
||||
"com_google_googleapis_imports": {
|
||||
"repoRuleId": "@@googleapis+//:repository_rules.bzl%switched_rules",
|
||||
"attributes": {
|
||||
"rules": {
|
||||
"proto_library_with_info": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"moved_proto_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"java_proto_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"java_grpc_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"java_gapic_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"java_gapic_test": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"java_gapic_assembly_gradle_pkg": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"py_proto_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"py_grpc_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"py_gapic_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"py_test": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"py_gapic_assembly_pkg": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"py_import": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"go_proto_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"go_grpc_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"go_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"go_test": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"go_gapic_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"go_gapic_assembly_pkg": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"cc_proto_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"cc_grpc_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"cc_gapic_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"php_proto_library": [
|
||||
"",
|
||||
"php_proto_library"
|
||||
],
|
||||
"php_grpc_library": [
|
||||
"",
|
||||
"php_grpc_library"
|
||||
],
|
||||
"php_gapic_library": [
|
||||
"",
|
||||
"php_gapic_library"
|
||||
],
|
||||
"php_gapic_assembly_pkg": [
|
||||
"",
|
||||
"php_gapic_assembly_pkg"
|
||||
],
|
||||
"nodejs_gapic_library": [
|
||||
"",
|
||||
"typescript_gapic_library"
|
||||
],
|
||||
"nodejs_gapic_assembly_pkg": [
|
||||
"",
|
||||
"typescript_gapic_assembly_pkg"
|
||||
],
|
||||
"ruby_proto_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"ruby_grpc_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"ruby_ads_gapic_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"ruby_cloud_gapic_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"ruby_gapic_assembly_pkg": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"csharp_proto_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"csharp_grpc_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"csharp_gapic_library": [
|
||||
"",
|
||||
""
|
||||
],
|
||||
"csharp_gapic_assembly_pkg": [
|
||||
"",
|
||||
""
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"generatedRepoSpecs": {},
|
||||
"recordedRepoMappingEntries": []
|
||||
}
|
||||
},
|
||||
@@ -1399,34 +1243,6 @@
|
||||
"recordedRepoMappingEntries": []
|
||||
}
|
||||
},
|
||||
"@@rules_apple+//apple:extensions.bzl%non_module_deps": {
|
||||
"general": {
|
||||
"bzlTransitiveDigest": "UsflLeiazyu2v5pvibcvOeIdDV95S25rT96h4XU1nhY=",
|
||||
"usagesDigest": "M3VqFpeTCo4qmrNKGZw0dxBHvTYDrfV3cscGzlSAhQ4=",
|
||||
"recordedFileInputs": {},
|
||||
"recordedDirentsInputs": {},
|
||||
"envVariables": {},
|
||||
"generatedRepoSpecs": {
|
||||
"xctestrunner": {
|
||||
"repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive",
|
||||
"attributes": {
|
||||
"urls": [
|
||||
"https://github.com/google/xctestrunner/archive/b7698df3d435b6491b4b4c0f9fc7a63fbed5e3a6.tar.gz"
|
||||
],
|
||||
"strip_prefix": "xctestrunner-b7698df3d435b6491b4b4c0f9fc7a63fbed5e3a6",
|
||||
"sha256": "ae3a063c985a8633cb7eb566db21656f8db8eb9a0edb8c182312c7f0db53730d"
|
||||
}
|
||||
}
|
||||
},
|
||||
"recordedRepoMappingEntries": [
|
||||
[
|
||||
"rules_apple+",
|
||||
"bazel_tools",
|
||||
"bazel_tools"
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"@@rules_dotnet+//dotnet:extensions.bzl%dotnet": {
|
||||
"general": {
|
||||
"bzlTransitiveDigest": "fd+R6GHICVvxgxz6YGDAcp7EbUx26nq9MWH1unOHz9I=",
|
||||
|
||||
+26
-14
@@ -1,12 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# Keeps Bazel in sync with the installed Xcode version. Two mechanisms:
|
||||
# Keeps Bazel mactools builds in sync with the installed Xcode version.
|
||||
#
|
||||
# 1. Writes .bazelrc.xcode with --action_env=XCODE_BUILD_VERSION=<version>
|
||||
# so the version is part of every action's cache key. This prevents stale
|
||||
# remote cache entries from being reused after an Xcode update.
|
||||
# Only needed on runners that do mactools builds (Mac/Sparkle). Non-Mac builds
|
||||
# don't run this script; their apple_cc_autoconf stays cached because none of
|
||||
# its environ vars change, so they're unaffected by Xcode version changes.
|
||||
#
|
||||
# 1. Writes .bazelrc.xcode with mactools-scoped flags:
|
||||
# - action_env for remote cache key invalidation
|
||||
# - DEVELOPER_DIR pointing to the active Xcode
|
||||
#
|
||||
# 2. Runs `bazel clean --expunge` when the version actually changes, because
|
||||
# local_config_xcode (a cached repository rule) bakes in the old version
|
||||
# local_config_apple_cc (a cached repository rule) bakes in the old version
|
||||
# and can only be refreshed by clearing the output base.
|
||||
#
|
||||
# .bazelrc imports the generated file via: try-import %workspace%/.bazelrc.xcode
|
||||
@@ -20,23 +24,31 @@ if [ -z "$XCODE_BUILD_VERSION" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BAZELRC_XCODE=".bazelrc.xcode"
|
||||
EXPECTED="common --action_env=XCODE_BUILD_VERSION=${XCODE_BUILD_VERSION}"
|
||||
DEVELOPER_DIR=$(xcode-select -p 2>/dev/null)
|
||||
|
||||
# If the file already has the right version, nothing to do
|
||||
if [ -f "$BAZELRC_XCODE" ] && [ "$(cat "$BAZELRC_XCODE")" = "$EXPECTED" ]; then
|
||||
exit 0
|
||||
BAZELRC_XCODE=".bazelrc.xcode"
|
||||
EXPECTED_LINE="common:mactools --action_env=XCODE_BUILD_VERSION=${XCODE_BUILD_VERSION}"
|
||||
|
||||
# Check if the file already has the right version (first line is the version marker)
|
||||
if [ -f "$BAZELRC_XCODE" ]; then
|
||||
CURRENT_FIRST_LINE=$(head -1 "$BAZELRC_XCODE")
|
||||
if [ "$CURRENT_FIRST_LINE" = "$EXPECTED_LINE" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Xcode version changed (or first run) — expunge local cache to clear
|
||||
# stale local_config_xcode, then write the new version for remote cache keys
|
||||
# stale local_config_apple_cc, then write the new config
|
||||
OLD_VERSION="unknown"
|
||||
if [ -f "$BAZELRC_XCODE" ]; then
|
||||
OLD_VERSION=$(sed -n 's/.*XCODE_BUILD_VERSION=//p' "$BAZELRC_XCODE")
|
||||
OLD_VERSION=$(sed -n 's/.*XCODE_BUILD_VERSION=//p' "$BAZELRC_XCODE" | head -1)
|
||||
fi
|
||||
echo "Xcode build version changed: ${OLD_VERSION} -> ${XCODE_BUILD_VERSION}"
|
||||
echo "Running bazel clean --expunge to clear stale toolchain config..."
|
||||
bazel clean --expunge 2>/dev/null || true
|
||||
|
||||
echo "$EXPECTED" > "$BAZELRC_XCODE"
|
||||
echo "Updated ${BAZELRC_XCODE} — next build will do a full rebuild with Xcode ${XCODE_BUILD_VERSION}"
|
||||
cat > "$BAZELRC_XCODE" << EOF
|
||||
${EXPECTED_LINE}
|
||||
common:mactools --repo_env=DEVELOPER_DIR=${DEVELOPER_DIR}
|
||||
EOF
|
||||
echo "Updated ${BAZELRC_XCODE} — next mactools build will rebuild with Xcode ${XCODE_BUILD_VERSION}"
|
||||
|
||||
Reference in New Issue
Block a user