Skip to content

Outputs of describe command contains warnings. #8402

Open
@mtj0928

Description

@mtj0928

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

The describe command can include warnings even when I specify JSON as the output format, if the package contains issues related to resources.

This seems the cause. The code emits the warning to stdout using print.

print("Found unhandled resource at \(resource.path)")

Because of this, I can’t parse the output as JSON.
While the resource issues in the package should be fixed, the describe command itself should avoid emitting warnings using print.

Expected behavior

The command should not emit the issue to stdout

Actual behavior

The outputs contains error message.

$ swift package describe --type json
Found unhandled resource at ..../Sources/sample/Resources // ← This line should not be contained.
{
  ...
}

Steps to reproduce

  1. Make a new package sample
$ swift package init --type library --name sample  
  1. Make a directory Resources to Sources/sample
$ mkdir Sources/sample/Resources 
  1. Update the package.swift.
.target(
     name: "sample",
    exclude: ["Resources"], // Added
    resources: [.copy("Resources")] // Added
),
  1. Run describe
$ swift package describe --type json 

Swift Package Manager version/commit hash

6.1.0

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

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.109.103 clang-1700.0.13.2)
Target: arm64-apple-macosx15.0
Darwin matsujiMacBook-Pro.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions