Skip to content

Fix C++ interop CI script to work with changes in SwiftPM#3510

Merged
simonjbeaumont merged 4 commits intomainfrom
sb/fix-cxx-interop-ci
Feb 11, 2026
Merged

Fix C++ interop CI script to work with changes in SwiftPM#3510
simonjbeaumont merged 4 commits intomainfrom
sb/fix-cxx-interop-ci

Conversation

@simonjbeaumont
Copy link
Copy Markdown
Contributor

@simonjbeaumont simonjbeaumont commented Feb 11, 2026

Motivation:

SwiftPM behaviour has changed in recent Swift nightlies.

In most recent released version of Swift, SwiftPM will use the parent directory name for the source and test target directory too, even when it contains a period:

% docker run -it swift:6.2 bash -c 'mkdir -p /tmp/foo.bar && cd /tmp/foo.bar && swift package init'
Creating library package: foo.bar
Creating Package.swift
Creating .gitignore
Creating Sources
Creating Sources/foo.bar/foo_bar.swift
Creating Tests/
Creating Tests/foo.barTests/
Creating Tests/foo.barTests/foo_barTests.swift

Note in the above how it replaces the . with a _ in the source files, but the directories retain the ..

In the recent nightly-main, SwiftPM has also started replacing . with _ in the target directory names:

% docker run -it swiftlang/swift:nightly-main bash -c 'cat /etc/motd && mkdir -p /tmp/foo.bar && cd /tmp/foo.bar && swift package init'
################################################################
#                                                              #
# Swift Nightly Docker Image                                   #
# Tag: swift-DEVELOPMENT-SNAPSHOT-2026-02-06-a                 #
#                                                              #
################################################################
Creating library package: foo.bar
Creating Package.swift
Creating .gitignore
Creating Sources
Creating Sources/foo_bar/foo_bar.swift
Creating Tests/
Creating Tests/foo_barTests/
Creating Tests/foo_barTests/foo_barTests.swift

Probably this swiftlang/swift-package-manager#9252.

This breaks our CI automation, only on nightly-main, because we run swift package init in a directory created by mktemp -d, which, by default, follows the pattern tmp.XXXXXXX.

Modifications:

Create temporary directory for Swift package using explicit pattern containing no periods.

Result:

C++ interop CI should now work again on nightly-main Swift, and continue to work on all supported Swift versions.

@simonjbeaumont simonjbeaumont added the semver/none No version bump required. label Feb 11, 2026
@simonjbeaumont
Copy link
Copy Markdown
Contributor Author

OK, this is working now, for all versions (link):

** Checking for Cxx interoperability compatibility...
Creating library package: tmp_swift_package_gmT0FrWiZh
Creating Package.swift
Creating .gitignore
Creating Sources
Creating Sources/tmp_swift_package_gmT0FrWiZh/tmp_swift_package_gmT0FrWiZh.swift
Creating Tests/
Creating Tests/tmp_swift_package_gmT0FrWiZhTests/
Creating Tests/tmp_swift_package_gmT0FrWiZhTests/tmp_swift_package_gmT0FrWiZhTests.swift

Once this is approved I'll revert the TEMPORARY COMMIT that uses the branch-based script before merging.

@simonjbeaumont simonjbeaumont marked this pull request as ready for review February 11, 2026 15:32
@simonjbeaumont simonjbeaumont enabled auto-merge (squash) February 11, 2026 15:34
@simonjbeaumont
Copy link
Copy Markdown
Contributor Author

Now that this is mergeable it will use the main-branch for the script so will be failing again. We can see the commit in the PR history that shows everything is working, so once all the other CIs are passing I will disable auto-merge and merge over this one failing CI. This will restore CI functionality for future PRs.

@simonjbeaumont simonjbeaumont merged commit c329d1e into main Feb 11, 2026
54 of 55 checks passed
@simonjbeaumont simonjbeaumont deleted the sb/fix-cxx-interop-ci branch February 11, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants