Skip to content

Commit 4409c2f

Browse files
Merge pull request #63271 from AnthonyLatsis/min-size-xcode
build: Override default build variant for `--xcode`
2 parents 3302b27 + 3f4f4ff commit 4409c2f

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

Diff for: docs/HowToGuides/GettingStarted.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ while retaining the option of building with Ninja on the command line.
357357
358358
Assuming that you have already [built the toolchain via Ninja](#the-actual-build),
359359
several more steps are necessary to set up this environment:
360-
* Generate Xcode projects with `utils/build-script --release --swift-darwin-supported-archs "$(uname -m)" --xcode --clean`.
360+
* Generate Xcode projects with `utils/build-script --swift-darwin-supported-archs "$(uname -m)" --xcode --clean`.
361361
This will first build a few LLVM files that are needed to configure the
362362
projects.
363363
* Create a new Xcode workspace.

Diff for: utils/build_swift/build_swift/driver_arguments.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,20 @@ def _apply_default_arguments(args):
5656
args.lldb_build_with_xcode is not None:
5757
args.build_lldb = True
5858

59+
# Set the default CMake generator.
60+
if args.cmake_generator is None:
61+
args.cmake_generator = 'Ninja'
62+
elif args.cmake_generator == 'Xcode':
63+
# Building with Xcode is deprecated.
64+
args.skip_build = True
65+
args.build_early_swift_driver = False
66+
args.build_early_swiftsyntax = False
67+
5968
# Set the default build variant.
6069
if args.build_variant is None:
61-
args.build_variant = 'Debug'
70+
args.build_variant = (
71+
'MinSizeRel' if args.cmake_generator == 'Xcode' else 'Debug'
72+
)
6273

6374
if args.llvm_build_variant is None:
6475
args.llvm_build_variant = args.build_variant
@@ -119,15 +130,6 @@ def _apply_default_arguments(args):
119130
if args.lldb_assertions is None:
120131
args.lldb_assertions = args.assertions
121132

122-
# Set the default CMake generator.
123-
if args.cmake_generator is None:
124-
args.cmake_generator = 'Ninja'
125-
elif args.cmake_generator == 'Xcode':
126-
# Building with Xcode is deprecated.
127-
args.skip_build = True
128-
args.build_early_swift_driver = False
129-
args.build_early_swiftsyntax = False
130-
131133
# --ios-all etc are not supported by open-source Swift.
132134
if args.ios_all:
133135
raise ValueError('error: --ios-all is unavailable in open-source '

Diff for: utils/build_swift/tests/build_swift/test_driver_arguments.py

+1
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ def test_implied_defaults_swift_disable_dead_stripping(self):
644644
def test_implied_defaults_xcode(self):
645645
namespace = self.parse_default_args(['--xcode'])
646646
self.assertEqual(namespace.cmake_generator, 'Xcode')
647+
self.assertEqual(namespace.build_variant, 'MinSizeRel')
647648
self.assertTrue(namespace.skip_build)
648649
self.assertFalse(namespace.build_early_swift_driver)
649650
self.assertFalse(namespace.build_early_swiftsyntax)

0 commit comments

Comments
 (0)