Skip to content

swift migrate fails to find diagnostics file with Native build system in release configuration #9006

@bkhouri

Description

@bkhouri

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

While working on a change to migrate the PackageCommandTests to Swift Testing and augmenting the test to run against the SwiftBuild and both build configuration, it was discovered that, using the Native build system in release configuration, applying the fix-its fails as the swift package migrate is unable to find the .dia file.

Expected behavior

Running swift run swift-package migrate --package-path Fixtures/SwiftMigrate/StrictMemorySafetyMigration -c release --to-feature StrictMemorySafety is successful.

Actual behavior

Running swift run swift-package migrate --package-path Fixtures/SwiftMigrate/StrictMemorySafetyMigration -c release --to-feature StrictMemorySafety fails.

❯ swift run swift-package reset --package-path Fixtures/SwiftMigrate/StrictMemorySafetyMigration

❯ swift run swift-package migrate --package-path Fixtures/SwiftMigrate/StrictMemorySafetyMigration -c release --to-feature StrictMemorySafety
[1/1] Planning build
Building for debugging...
[1/1] Write swift-version-61A6B76668897818.txt
Build of product 'swift-package' complete! (5.20s)
> Starting the build
Building for production...
/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Fixtures/SwiftMigrate/StrictMemorySafetyMigration/Sources/Test.swift:4:3: warning: expression uses unsafe constructs but is not marked with 'unsafe' [#StrictMemorySafety]
2 | 
3 | func g() {
4 |   f()
  |   |- warning: expression uses unsafe constructs but is not marked with 'unsafe' [#StrictMemorySafety]
  |   `- note: reference to unsafe global function 'f()'
5 | }
6 | 

[#StrictMemorySafety]: <https://docs.swift.org/compiler/documentation/diagnostics/strict-memory-safety>

Build complete! (0.33s)
> Applying fix-its
error: /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Fixtures/SwiftMigrate/StrictMemorySafetyMigration/.build/arm64-apple-macosx/release/Diagnostics.build/Test.dia doesn't exist in file system

❯ find Fixtures/SwiftMigrate/StrictMemorySafetyMigration -iname "*.dia"                                                                       
Fixtures/SwiftMigrate/StrictMemorySafetyMigration/.build/arm64-apple-macosx/release/Diagnostics.build/Diagnostics.dia

Steps to reproduce

  1. clone the repository
  2. change to the root of the cloned swift-package-manager repository
  3. Run swift run swift-package migrate --package-path Fixtures/SwiftMigrate/StrictMemorySafetyMigration -c release --to-feature StrictMemorySafety

Swift Package Manager version/commit hash

53116b54c0f7a18df28a559bcb9edd9c06f7add6

Swift & OS version (output of swift --version ; uname -a)

❯ uname -a
Darwin BKs-Work-M1Pro-MacBook-Pro-6.local 25.0.0 Darwin Kernel Version 25.0.0: Fri Jul 25 23:57:38 PDT 2025; root:xnu_development-12377.0.187.0.2~21/DEVELOPMENT_ARM64_T6000 arm64

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions