Skip to content

Commit 403466a

Browse files
committed
swiftpm: Test only running host platform architecture
When adding a Swift Testing test to Swift PM repository, the `test` portion of t he OSX package pipeline was building against x86_64 and arm64. Ensure Swift PM testing only runs against the host platform architecture. .
1 parent 0c7c79d commit 403466a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

utils/build-presets.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,7 @@ swift-testing-macros
18461846
install-swift-testing
18471847
install-swift-testing-macros
18481848

1849+
infer-cross-compile-hosts-on-darwin
18491850
skip-test-swift
18501851

18511852
[preset: mixin_swiftpm_macos_platform]

utils/swift_build_support/swift_build_support/products/swiftpm.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ def is_before_build_script_impl_product(cls):
4242
def should_build(self, host_target):
4343
return True
4444

45-
def run_bootstrap_script(self, action, host_target, additional_params=[]):
45+
def run_bootstrap_script(
46+
self,
47+
action,
48+
host_target,
49+
additional_params=[],
50+
*,
51+
compile_only_for_running_host_architecture = False,
52+
):
4653
script_path = os.path.join(
4754
self.source_dir, 'Utilities', 'bootstrap')
4855

@@ -85,7 +92,7 @@ def run_bootstrap_script(self, action, host_target, additional_params=[]):
8592
]
8693

8794
# Pass Cross compile host info
88-
if self.has_cross_compile_hosts():
95+
if not compile_only_for_running_host_architecture and self.has_cross_compile_hosts():
8996
if self.is_darwin_host(host_target):
9097
helper_cmd += ['--cross-compile-hosts']
9198
for cross_compile_host in self.args.cross_compile_hosts:
@@ -114,7 +121,11 @@ def should_test(self, host_target):
114121
return self.args.test_swiftpm
115122

116123
def test(self, host_target):
117-
self.run_bootstrap_script('test', host_target)
124+
self.run_bootstrap_script(
125+
'test',
126+
host_target,
127+
compile_only_for_running_host_architecture=True,
128+
)
118129

119130
def should_clean(self, host_target):
120131
return self.args.clean_swiftpm

0 commit comments

Comments
 (0)