swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.76k stars 1.35k forks source link

diagnose-api-breaking-changes fails with 'redefinition of module' on first run #8103

Open vsarunas opened 2 weeks ago

vsarunas commented 2 weeks ago

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

Description

diagnose-api-breaking-changes started failing with Swift 6:

error: baseline for Benchmark contains no symbols, swift-api-digester output: /Users/sarunas/tmp/package-benchmark/.build/arm64-apple-macosx/debug/CDarwinOperatingSystemStats-tool.build/module.modulemap:1:8: error: redefinition of module 'CDarwinOperatingSystemStats'
module CDarwinOperatingSystemStats {
       ^
/Users/sarunas/tmp/package-benchmark/.build/arm64-apple-macosx/apidiff/d4909695344b6e1ef88f0a711df6ab8708dd135d-checkout/.build/debug/CDarwinOperatingSystemStats.build/module.modulemap:1:8: note: previously defined here
module CDarwinOperatingSystemStats {
       ^
/Users/sarunas/tmp/package-benchmark/.build/arm64-apple-macosx/debug/SwiftRuntimeHooks-tool.build/module.modulemap:1:8: error: redefinition of module 'SwiftRuntimeHooks'
module SwiftRuntimeHooks {
       ^
/Users/sarunas/tmp/package-benchmark/.build/arm64-apple-macosx/apidiff/d4909695344b6e1ef88f0a711df6ab8708dd135d-checkout/.build/debug/SwiftRuntimeHooks.build/module.modulemap:1:8: note: previously defined here
module SwiftRuntimeHooks {
       ^
/Users/sarunas/tmp/package-benchmark/.build/arm64-apple-macosx/debug/CLinuxOperatingSystemStats-tool.build/module.modulemap:1:8: error: redefinition of module 'CLinuxOperatingSystemStats'
module CLinuxOperatingSystemStats {
       ^
/Users/sarunas/tmp/package-benchmark/.build/arm64-apple-macosx/apidiff/d4909695344b6e1ef88f0a711df6ab8708dd135d-checkout/.build/debug/CLinuxOperatingSystemStats.build/module.modulemap:1:8: note: previously defined here
module CLinuxOperatingSystemStats {
       ^
/Users/sarunas/tmp/package-benchmark/.build/arm64-apple-macosx/debug/SwiftRuntimeHooks-tool.build/module.modulemap:1:8: error: redefinition of module 'SwiftRuntimeHooks'
module SwiftRuntimeHooks {
       ^
/Users/sarunas/tmp/package-benchmark/.build/arm64-apple-macosx/apidiff/d4909695344b6e1ef88f0a711df6ab8708dd135d-checkout/.build/debug/SwiftRuntimeHooks.build/module.modulemap:1:8: note: previously defined here
module SwiftRuntimeHooks {

The same behaviour is present on current main of SPM, Swift 6.1.0-dev

Expected behavior

No redefinition error

Actual behavior

No response

Steps to reproduce

  1. git clone https://github.com/ordo-one/package-benchmark.git
  2. cd package-benchmark; git checkout -b test
  3. swift package diagnose-api-breaking-changes main --targets Benchmark # will fail on compilation
  4. swift package diagnose-api-breaking-changes main --targets Benchmark # will succeed

Swift Package Manager version/commit hash

Swift 6.0.2-dev

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

swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4) Target: arm64-apple-macosx15.0 Darwin alpine-14.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000 arm64