Konstantinos Nikoloutsos
Konstantinos Nikoloutsos

Reputation: 2180

Suppress all warnings from my SPM package

Is there a way to suppress all warnings coming from my SPM Package in XCode?!

⚠️found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target

This warning shows because my SPM package contains .txt file.

I tried adding swiftSettings: [.unsafeFlags(["-suppress-warnings"])] in package.swift but didn't work.

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Sourcery",
    platforms: [.macOS(.v10_13)],
    dependencies: [
        .package(
           url: "https://github.com/pointfreeco/swift-snapshot-testing.git",
           from: "1.9.0"
         )
    ],
    targets: [
        .executableTarget(
            name: "Sourcery",
            dependencies: []
        ),
        .testTarget(
            name: "SourceryTests",
            dependencies: [.product(name: "SnapshotTesting", package: "swift-snapshot-testing")]        
        )
    ]
)

Upvotes: 3

Views: 1291

Answers (1)

Konstantinos Nikoloutsos
Konstantinos Nikoloutsos

Reputation: 2180

Looks like the exclude parameter supports folders as well. So I organized all .txt file in a folder and now I got rid of the warnings :)

import PackageDescription

let package = Package(
    name: "Sourcery",
    platforms: [.macOS(.v10_13)],
    dependencies: [
        .package(
           url: "https://github.com/pointfreeco/swift-snapshot-testing.git",
           from: "1.9.0"
         )
    ],
    targets: [
        .executableTarget(
            name: "Sourcery",
            dependencies: [],
            exclude: ["Templates"]
        ),
        .testTarget(
            name: "SourceryTests",
            dependencies: [.product(name: "SnapshotTesting", package: "swift-snapshot-testing")],
            exclude: ["__Snapshots__"]
        )
    ]
)

Upvotes: 1

Related Questions