swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.68k stars 1.32k forks source link

SwiftPM warns about unhandled files not in Sources folders #6440

Open adam-fowler opened 1 year ago

adam-fowler commented 1 year ago

Description

If I have a folder structure as follows for a package

- Sources
  - Generated
    - Package1
      - File.swift 
    - Package2
      - File.swift 
  - Extensions
    - Package1
      - ExtensionFile.swift 

and my Package.swift has targets

.target(name: "Package1", path: "./Sources/", sources: ["Generated/Package1", "Extensions/Package1"]),
.target(name: "Package2", path: "./Sources/Generated/Package2"),

When I run swift build I get the following warning

warning: 'swiftpm-bug': found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
    /.../Sources/Generated/Package2/test.swift

This was reported as an issue in Xcode (FB8741206 ) and appears to have been fixed there but is still an issue in the CLI.

Expected behavior

I would expect SwiftPM to not warn about Package2/test.swift as it is not in the sources folders for Package1 and is handled by the target Package2.

Actual behavior

No response

Steps to reproduce

No response

Swift Package Manager version/commit hash

No response

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

swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100) Target: arm64-apple-macosx13.0 Darwin Adams-MBP-M1-Max.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64

neonichu commented 1 year ago

I don't think any changes have been done here, if it appears "fixed" in newer Xcode that seems like a potential bug around missing diagnostics. cc @abertelrud