New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-13393] Swift Tools 5.3-5.5 Package Manager (& Xcode 12-13.0) incorrectly emit errors for .swift files as "unhandled" #4509
Comments
Still an issue in Xcode tools 12b6. Significant problem in that it seems to mean that a command line tool (`.executable` product) cannot use modules which makes it hard to write automated tests. Only option seems to be to dial back to swift 5.2 and not use resource files (test data files) which makes the `.resources` enhancement unusable in this context. |
Still an issue in Xcode tools 12GM 12A7209 🙁
and downloading the package and running the indicated command produces the same output: bugtest % xcrun swift package describe
warning: found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
/Users/tyler/Desktop/bugtest/Sources/module1/file1.swift
Name: bugtest
Path: /Users/tyler/Desktop/bugtest
Modules:
Name: module1
C99name: module1
Type: library
Module type: SwiftTarget
Path: /Users/tyler/Desktop/bugtest/Sources/module1
Sources: file1.swift
Name: bugtestTests
C99name: bugtestTests
Type: test
Module type: SwiftTarget
Path: /Users/tyler/Desktop/bugtest/Tests/bugtestTests
Sources: XCTestManifests.swift, bugtestTests.swift
Name: bugtest
C99name: bugtest
Type: executable
Module type: SwiftTarget
Path: /Users/tyler/Desktop/bugtest/Sources
Sources: main.swift and switching `swift-tools-version:5.3` to use 5.2 fixes is as before, but then one can't use resources... :-/ |
Issue still present in Xcode 13.0 / Swift 5.5. Further, if I update the swift-tools-version line in the Package.swift file to 5.5, and updated the `target` for "bugtest" to be an `.executableTarget` for swift 5.4 and later, then I get the same warning whenever I use the package or describe it (though it executes properly)… bugtest % swift run
'bugtest' /Users/tyler/Desktop/bugtest: warning: found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
/Users/tyler/Desktop/bugtest/Sources/module1/file1.swift
[5/5] Build complete!
Hello cruel world... and bugtest % swift test
'bugtest' /Users/tyler/Desktop/bugtest: warning: found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
/Users/tyler/Desktop/bugtest/Sources/module1/file1.swift
[4/4] Build complete!
Test Suite 'All tests' started at 2021-09-24 15:32:44.982
Test Suite 'bugtestPackageTests.xctest' started at 2021-09-24 15:32:44.982
Test Suite 'bugtestTests' started at 2021-09-24 15:32:44.982
Test Case '-[bugtestTests.bugtestTests testExample]' started.
Test Case '-[bugtestTests.bugtestTests testExample]' passed (0.001 seconds).
Test Suite 'bugtestTests' passed at 2021-09-24 15:32:44.984.
Executed 1 test, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'bugtestPackageTests.xctest' passed at 2021-09-24 15:32:44.984.
Executed 1 test, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'All tests' passed at 2021-09-24 15:32:44.984.
Executed 1 test, with 0 failures (0 unexpected) in 0.001 (0.002) seconds An updated package that uses swift-tools 5.5 will be attached: updated_bugtest.zip |
Attachment: Download
Environment
macOS 10.15.6
Xcode 12 beta 4:
Additional Detail from JIRA
md5: 3707421ab7f141cc629e3e38c88758b8
Issue Description:
Swift package manager (and Xcode 12 b 4) have trouble in a simple command line tool package with a single module. It gets confused about the swift files in the module sub-directory and shows errors about "found N file(s) which are unhandled; ..."
Changing the swift-tools-version:5.3 to 5.2 resolves the issue.
This error makes it impossible to build these packages on the command line or in Xcode because the targets do not seem to be recognized properly.
Here's the package file:
and the file hierarchy:
If you run package describe you get the following:
change the first line of the Package.swift file to 5.2 and it works as expected (the files are auto-discovered in the module source folder inside the Sources directory):
Explicit specification of the path: and sources: in the "module1" target does not work around this issue. It prevents building on the command line or in Xcode because the targets are not understood properly.
Sample package directory attached.
Also filed via FeedbackAssistant:
{{ https://feedbackassistant.apple.com/feedback/8401865}}
The text was updated successfully, but these errors were encountered: