soto-project / soto

Swift SDK for AWS that works on Linux, macOS and iOS
https://soto.codes
Apache License 2.0
880 stars 83 forks source link

Build log noise `warning: 'soto': found 779 file(s) which are unhandled` #729

Closed finestructure closed 2 months ago

finestructure commented 2 months ago

I've noticed that building Soto injects lots of noise into the build logs:

❯ swift build
warning: 'soto': found 779 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
    /Users/sas/Downloads/soto/Sources/Soto/Services/CognitoSync/CognitoSync_shapes.swift
    /Users/sas/Downloads/soto/Sources/Soto/Services/MigrationHubConfig/MigrationHubConfig_api.swift
    ... hundreds of lines ...

The problem appears to be the following target declaration:

       .target(name: "SotoCognitoIdentity", dependencies: [.product(name: "SotoCore", package: "soto-core")], path: "./Sources/Soto/", sources: ["Services/CognitoIdentity", "Extensions/CognitoIdentity"], swiftSettings: swiftSettings),

The path: of this target references but does not use the source files of all the other targets (of which there are a few 😅).

An impractical solution would be to exclude: list all the other target source dirs but that clearly would be very tedious and noisy in the manifest file.

Unfortunately, since path: takes only a single path, it can't be set up to reference two distinct source dirs under which to locate the folders references in sources:. Perhaps the source files could be re-arranged to move them under their own source dir?

Sources/
  CognitoIdentity
    Extensions
      ... swift files ....
    Services
      ... swift files ....

and

       .target(name: "SotoCognitoIdentity", dependencies: [.product(name: "SotoCore", package: "soto-core")], path: "./Sources/CognitoIdentity/", sources: ["Services", "Extensions"], swiftSettings: swiftSettings),

In my testing this does fix the issue.

It's obviously not an ideal source layout but perhaps it could be a template to find a solution that has better layout?

adam-fowler commented 2 months ago

This is a bug in swiftPM (https://github.com/swiftlang/swift-package-manager/issues/6440). You'll notice in the manifest file I've told it to find source code inside the folders "Services/CognitoIdentity", "Extensions/CognitoIdentity" and not anywhere else, but it still proceeds to tell me about files outside of those two directories

finestructure commented 2 months ago

Ah, I see. Thanks for the pointer to the underlying issue!