Skip to content

swift run using the Swift Build system does not output executable content on terminal #8279

@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 #8276 , it was discovered that running swift run with the Swift Build build system does not output the executable content on the terminal.

Expected behavior

The executable's content is displayed on the terminal.

Actual behavior

No response

Steps to reproduce

If #8271 is not merged,

❯ cd $(git rev-parse --show-toplevel)

❯ swift run swift-run --package-path Fixtures/Miscellaneous/EchoExecutable secho 1 --hello world               
Building for debugging...
[1/1] Write swift-version--519CE54EEAEDB67B.txt
Build of product 'swift-run' complete! (0.56s)
Building for debugging...
[8/8] Applying secho
Build of product 'secho' complete! (4.05s)
"/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager" "1" "--hello" "world"

❯ swift run swift-run --package-path Fixtures/Miscellaneous/EchoExecutable --build-system swiftbuild secho 1 --hello world
warning: 'swift-package-manager': found 2 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
    /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Sources/SwiftBuildSupport/CMakeLists.txt
    /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Sources/SwiftBuildSupport/README.md
warning: 'swift-syntax': found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
    /Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/.build/checkouts/swift-syntax/Sources/SwiftLexicalLookup/CMakeLists.txt
[1/1] Planning build
Building for debugging...
[1/1] Write swift-version--519CE54EEAEDB67B.txt
Build of product 'swift-run' complete! (6.55s)
                                                                        
95% [========================================================================================================================-------]
secho_11B656C2C6F7_PackageProduct 20 / 21
100% [==============================================================================================================================]


If #8271 is merged,

❯ cd $(git rev-parse --show-toplevel)

❯ swift run --package-path Fixtures/Miscellaneous/EchoExecutable secho 1 --hello world               

❯ swift run --package-path Fixtures/Miscellaneous/EchoExecutable --build-system swiftbuild secho 1 --hello world

Swift Package Manager version/commit hash

N/A

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

❯ uname -a
Darwin BKs-Work-M1Pro-MacBook-Pro-2.local 24.3.0 Darwin Kernel Version 24.3.0: Mon Jan  6 22:01:36 PST 2025; root:xnu_development-11215.81.4~9/DEVELOPMENT_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugswift buildChanges impacting `swift build`swift runChanges impacting `swift run` subcommand

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions