Skip to content

SwiftBuild does not support the same ModuleAliasing features as the native build system #8987

@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

The SwiftBuild integration with SwiftPM does not support the same module aliasing features as the native build system. This can be observed by building sample packaged in SwiftPM's code base.

it appears the PIF Builder does not handle module aliasing as the following error occurs

error: The workspace contains multiple targets with the same GUID 'PACKAGE-PRODUCT:Utils'

Expected behavior

The sample package are successfully build

Actual behavior

the following errors occur.

error: The workspace contains multiple targets with the same GUID 'PACKAGE-PRODUCT:Utils'

Steps to reproduce

  1. Clone the Swift PM repository
  2. Run the following, which builds successfully:
    ❯ swift run swift-build --package-path Fixtures/ModuleAliasing/DirectDeps1/AppPkg --build-system swiftbuild --configuration debug
    ❯ swift run swift-build --package-path Fixtures/ModuleAliasing/DirectDeps1/AppPkg --build-system swiftbuild --configuration release
    
  3. Run the following, which failed to build
    ❯ swift run swift-build --package-path Fixtures/ModuleAliasing/DirectDeps2/AppPkg --build-system swiftbuild --configuration debug
    ❯ swift run swift-build --package-path Fixtures/ModuleAliasing/DirectDeps2/AppPkg --build-system swiftbuild --configuration release
    ❯ swift run swift-build --package-path Fixtures/ModuleAliasing/NestedDeps1/AppPkg --build-system swiftbuild --configuration debug
    ❯ swift run swift-build --package-path Fixtures/ModuleAliasing/NestedDeps1/AppPkg --build-system swiftbuild --configuration release
    ❯ swift run swift-build --package-path Fixtures/ModuleAliasing/NestedDeps2/AppPkg --build-system swiftbuild --configuration debug
    
    

Swift Package Manager version/commit hash

cacb4fb70693e4c517614dc3d1904f1a4b689c7f

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

❯ uname -a
Darwin BKs-Work-M1Pro-MacBook-Pro-5.local 25.0.0 Darwin Kernel Version 25.0.0: Sat Jul 12 00:30:16 PDT 2025; root:xnu_development-12377.0.154.0.2~25/DEVELOPMENT_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugswift buildChanges impacting `swift build`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions