Skip to content

[SwiftBuild] SwiftPM does not incrementally build when embedded resource files are modified #9528

@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

When only a resource file that is embedded in Swift source code is modified, SwiftPM does not rebuild the targets when using SwiftBuild.

Expected behavior

The resource files are considered as inputs to the build graph, causing modification of a resource file to rebuild the appropriate pieces.

Actual behavior

An incremental rebuild does not occur

Steps to reproduce

Option 1:
Search for this GitHub issue in swiftpm code base

Option 2:

  1. checkout swiftpm
  2. Run the following
❯ swift build  --package-path ./Fixtures/Resources/EmbedInCodeSimple --build-system swiftbuild

❯ $(swift build --show-bin-path --package-path ./Fixtures/Resources/EmbedInCodeSimple)/EmbedInCodeSimple  

❯ echo "This is a new message" > ./Fixtures/Resources/EmbedInCodeSimple/Sources/EmbedInCodeSimple/best.txt

❯ swift build  --package-path ./Fixtures/Resources/EmbedInCodeSimple --build-system swiftbuild

❯ $(swift build --show-bin-path --package-path ./Fixtures/Resources/EmbedInCodeSimple)/EmbedInCodeSimple  

❯ # We expect the new output here

❯ swift package clean --package-path ./Fixtures/Resources/EmbedInCodeSimple)

❯ swift build  --package-path ./Fixtures/Resources/EmbedInCodeSimple --build-system swiftbuild

❯ $(swift build --show-bin-path --package-path ./Fixtures/Resources/EmbedInCodeSimple)/EmbedInCodeSimple  
# This outputs the expected test

Swift Package Manager version/commit hash

branch main (commit ID 52f7c417c2949d9aadd950169c4ae3ab4a74f31c)

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

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions