You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
It seems that files in exclude may not actually be ignored if they are part of a build. For example, a header file is marked in excludes but a source file that imports it is not excluded. Currently SPM successfully builds in this case even though the header file should be excluded from the build (at least what seems to be expected given exclude documentation).
Reproducing the issue
There are real examples of packages that have this issue: https://github.com/microsoft/plcrashreporter, this package excludes several .hpp files but the .cpp are not excluded, the build passes.
For a simple reproducible example the following works:
I'm not entirely sure how this is intended to work from the SPM side of things, it feels like this should be a failed build since the header is excluded. Or the documentation should be made clearer as to what exclude actually does.
Our use-case is over in https://github.com/cgrindel/rules_swift_package_manager where we generate BUILD files based on the Package.swift representation and we are currently excluding files from exclude which causes our Bazel builds to fail while SPM builds do not. We are more trying to understand what the expected behavior is here.
Actual behavior
exclude files are still able to be included as part of a swift build
Steps to reproduce
Make example project like the one in this issue
swift build passes
Delete Source/Foo.hpp, swift build fails.
Swift Package Manager version/commit hash
Swift Package Manager - 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-macosx14.0
Darwin local 23.6.0 Darwin Kernel Version 23.6.0: Thu Sep 12 23:36:23 PDT 2024; root:xnu-10063.141.1.701.1~1/RELEASE_ARM64_T6031 arm64
The text was updated successfully, but these errors were encountered:
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
It seems that files in
exclude
may not actually be ignored if they are part of a build. For example, a header file is marked inexcludes
but a source file that imports it is not excluded. Currently SPM successfully builds in this case even though the header file should be excluded from the build (at least what seems to be expected givenexclude
documentation).Reproducing the issue
There are real examples of packages that have this issue: https://github.com/microsoft/plcrashreporter, this package excludes several
.hpp
files but the.cpp
are not excluded, the build passes.For a simple reproducible example the following works:
Expected behavior
I'm not entirely sure how this is intended to work from the SPM side of things, it feels like this should be a failed build since the header is excluded. Or the documentation should be made clearer as to what
exclude
actually does.Our use-case is over in https://github.com/cgrindel/rules_swift_package_manager where we generate BUILD files based on the
Package.swift
representation and we are currently excluding files fromexclude
which causes our Bazel builds to fail while SPM builds do not. We are more trying to understand what the expected behavior is here.Actual behavior
exclude
files are still able to be included as part of aswift build
Steps to reproduce
swift build
passesSource/Foo.hpp
,swift build
fails.Swift Package Manager version/commit hash
Swift Package Manager - Swift 6.0.2-dev
Swift & OS version (output of
swift --version ; uname -a
)The text was updated successfully, but these errors were encountered: