SERVER-87442 Add variant and support for building on MacOS 14 x86_64 (#32181)

GitOrigin-RevId: cab282e269d31ad345b06f7eb21d34d2dda29803
This commit is contained in:
Zack Winter 2025-02-11 08:48:25 -08:00 committed by MongoDB Bot
parent cca935c5d3
commit 59c94a6b7b
5 changed files with 96 additions and 21 deletions

View File

@ -31,14 +31,8 @@ buildvariants:
tasks: tasks:
- name: compile_test_and_package_serial_TG - name: compile_test_and_package_serial_TG
- name: compile_test_parallel_unittest_stream_TG - name: compile_test_parallel_unittest_stream_TG
- name: .development_critical !.requires_large_host !.incompatible_community !.incompatible_mac - name: .development_critical !.incompatible_community !.incompatible_mac
- name: .development_critical .requires_large_host !.incompatible_community !.incompatible_mac - name: .release_critical !.incompatible_community !.incompatible_mac !publish_packages
distros:
- macos-14-arm64
- name: .release_critical !.requires_large_host !.incompatible_community !.incompatible_mac !publish_packages
- name: .release_critical .requires_large_host !.incompatible_community !.incompatible_mac !publish_packages
distros:
- macos-14-arm64
- name: enterprise-macos-arm64 - name: enterprise-macos-arm64
display_name: Enterprise macOS arm64 display_name: Enterprise macOS arm64
@ -66,11 +60,63 @@ buildvariants:
tasks: tasks:
- name: compile_test_and_package_serial_TG - name: compile_test_and_package_serial_TG
- name: compile_test_parallel_unittest_stream_TG - name: compile_test_parallel_unittest_stream_TG
- name: .development_critical !.requires_large_host !.incompatible_mac - name: .development_critical !.incompatible_mac
- name: .development_critical .requires_large_host !.incompatible_mac - name: .release_critical !.incompatible_mac !publish_packages
distros:
- macos-14-arm64 - name: macos
- name: .release_critical !.requires_large_host !.incompatible_mac !publish_packages display_name: macOS
- name: .release_critical .requires_large_host !.incompatible_mac !publish_packages tags: ["forbid_tasks_tagged_with_experimental"]
distros: cron: "0 4 * * *" # From the ${project_nightly_cron} parameter.
- macos-14-arm64 run_on:
- macos-14
expansions:
test_flags: >-
--excludeWithAnyTags=incompatible_with_macos,requires_external_data_source
--enableEnterpriseTests=off
push_path: osx
push_bucket: downloads.mongodb.org
push_name: macos
push_arch: x86_64
compile_env: DEVELOPER_DIR=/Applications/Xcode15.app
compile_flags: >-
--ssl
-j$(sysctl -n hw.logicalcpu)
--libc++
--variables-files=etc/scons/xcode_macosx.vars
--modules=
resmoke_jobs_max: 6
compile_variant: macos
tasks:
- name: compile_test_and_package_serial_TG
- name: compile_test_parallel_unittest_stream_TG
- name: .development_critical !.incompatible_community !.incompatible_mac
- name: .release_critical !.incompatible_community !.incompatible_mac !publish_packages
- name: enterprise-macos
display_name: Enterprise macOS
tags: ["bazel_check", "forbid_tasks_tagged_with_experimental"]
cron: "0 4 * * *" # From the ${project_nightly_cron} parameter.
run_on:
- macos-14
expansions:
test_flags: --excludeWithAnyTags=incompatible_with_macos,requires_gcm,requires_external_data_source
additional_package_targets: >-
archive-mongocryptd
archive-mongocryptd-debug
push_path: osx
push_bucket: downloads.10gen.com
push_name: macos
push_arch: x86_64-enterprise
compile_env: DEVELOPER_DIR=/Applications/Xcode15.app
compile_flags: >-
--ssl
-j$(sysctl -n hw.logicalcpu)
--libc++
--variables-files=etc/scons/xcode_macosx.vars
resmoke_jobs_max: 6
compile_variant: enterprise-macos
tasks:
- name: compile_test_and_package_serial_TG
- name: compile_test_parallel_unittest_stream_TG
- name: .development_critical !.incompatible_mac
- name: .release_critical !.incompatible_mac !publish_packages

View File

@ -0,0 +1,20 @@
# Configures the build to use XCode targeting macOS
import subprocess
import SCons
CC = subprocess.check_output(['xcrun', '-f', '--sdk', 'macosx', 'clang']).decode('utf-8').strip()
CXX = subprocess.check_output(['xcrun', '-f', '--sdk', 'macosx', 'clang++']).decode('utf-8').strip()
DSYMUTIL = subprocess.check_output(['xcrun', '-f', '--sdk', 'macosx', 'dsymutil']).decode('utf-8').strip()
STRIP = subprocess.check_output(['xcrun', '-f', '--sdk', 'macosx', 'strip']).decode('utf-8').strip()
# TAPI is less useful when running with Bazel + Remote Execution. Disable since the initial implementation
# of the build system with Bazel will not support it.
# TODO(SERVER-88612): Uncomment if we decide to implement TAPI support in Bazel
# TAPI = subprocess.check_output(['xcrun', '-f', '--sdk', 'macosx', 'tapi']).decode('utf-8').strip()
sdk_path = subprocess.check_output(['xcrun', '--sdk', 'macosx', '--show-sdk-path']).decode('utf-8').strip()
CCFLAGS = "-isysroot {} -mmacosx-version-min=14.0 --target=darwin20.0.0 -arch x86_64".format(sdk_path)
ASFLAGS = "-isysroot {} -mmacosx-version-min=14.0 --target=darwin20.0.0 -arch x86_64".format(sdk_path)
LINKFLAGS = "-Wl,-syslibroot,{} -mmacosx-version-min=14.0 --target=darwin20.0.0 -arch x86_64".format(sdk_path)

View File

@ -1462,7 +1462,7 @@ def generate(env: SCons.Environment.Environment) -> None:
bazel_internal_flags.append( bazel_internal_flags.append(
f"--developer_dir={os.environ.get('DEVELOPER_DIR', '/Applications/Xcode.app')}" f"--developer_dir={os.environ.get('DEVELOPER_DIR', '/Applications/Xcode.app')}"
) )
minimum_macos_version = "11.0" if normalized_arch == "arm64" else "10.14" minimum_macos_version = "11.0"
bazel_internal_flags.append(f"--macos_minimum_os={minimum_macos_version}") bazel_internal_flags.append(f"--macos_minimum_os={minimum_macos_version}")
if normalized_os == "windows": if normalized_os == "windows":
@ -1596,7 +1596,7 @@ def generate(env: SCons.Environment.Environment) -> None:
# We always use --compilation_mode debug for now as we always want -g, so assume -dbg location # We always use --compilation_mode debug for now as we always want -g, so assume -dbg location
out_dir_platform = "$TARGET_ARCH" out_dir_platform = "$TARGET_ARCH"
if normalized_os == "macos": if normalized_os == "macos":
out_dir_platform = "darwin_arm64" if normalized_arch == "arm64" else "darwin" out_dir_platform = "darwin_arm64" if normalized_arch == "arm64" else "darwin_x86_64"
elif normalized_os == "windows": elif normalized_os == "windows":
out_dir_platform = "x64_windows" out_dir_platform = "x64_windows"
elif normalized_os == "linux" and normalized_arch == "amd64": elif normalized_os == "linux" and normalized_arch == "amd64":

View File

@ -35,6 +35,18 @@
namespace mongo::query_shape { namespace mongo::query_shape {
namespace { namespace {
// Compare the raw size of each class, ignoring any padding added from differences in size when
// compared with alignment.
static constexpr auto kExpectedAlignment =
std::max(alignof(Shape), alignof(FindCmdShapeComponents));
static constexpr auto kExpectedPadding =
(kExpectedAlignment - (sizeof(Shape) + sizeof(FindCmdShapeComponents)) % kExpectedAlignment) %
kExpectedAlignment;
static_assert(
sizeof(FindCmdShape) == sizeof(Shape) + sizeof(FindCmdShapeComponents) + kExpectedPadding,
"If the class's members have changed, this assert and the extraSize() calculation may "
"need to be updated with a new value.");
BSONObj projectionShape(const boost::optional<projection_ast::Projection>& proj, BSONObj projectionShape(const boost::optional<projection_ast::Projection>& proj,
const SerializationOptions& opts = const SerializationOptions& opts =
SerializationOptions::kRepresentativeQueryShapeSerializeOptions) { SerializationOptions::kRepresentativeQueryShapeSerializeOptions) {

View File

@ -134,7 +134,4 @@ H AbslHashValue(H h, const FindCmdShapeComponents::HasField& hasField) {
return H::combine( return H::combine(
std::move(h), hasField.projection, hasField.sort, hasField.limit, hasField.skip); std::move(h), hasField.projection, hasField.sort, hasField.limit, hasField.skip);
} }
static_assert(sizeof(FindCmdShape) == sizeof(Shape) + sizeof(FindCmdShapeComponents),
"If the class' members have changed, this assert and the extraSize() calculation may "
"need to be updated with a new value.");
} // namespace mongo::query_shape } // namespace mongo::query_shape