cgrindel / rules_swift_package_manager

Collection of utilities and Bazel rules to aid in the development and maintenance of Swift repositories using Bazel.
Apache License 2.0
72 stars 26 forks source link

Gazelle plugin erroneously pulls in test target #380

Open AttilaTheFun opened 1 year ago

AttilaTheFun commented 1 year ago

Hello! I'm trying to use this Swift package: https://github.com/Peter-Schorn/SpotifyAPI through rules_swift_package_manager.

Initially I encountered this other issue: https://github.com/cgrindel/rules_swift_package_manager/issues/379 Which I was able to work around by forking OpenCombine to remove the driverkit platform, and SpotifyAPI to use the forked OpenCombine.

Now I'm trying to use my forked SpotifyAPI: https://github.com/AttilaTheFun/SpotifyAPI but the gazelle plugin is adding additional test-only dependencies which it should not.

In Swift I just do:

import SpotifyWebAPI

But the gazelle plugin is adding:

        "@swiftpkg_spotifyapi//:Sources_SpotifyAPITestUtilities",
        "@swiftpkg_spotifyapi//:Sources_SpotifyExampleContent",
        "@swiftpkg_spotifyapi//:Sources_SpotifyWebAPI",

If you look at the Package.swift file this does not look correct: https://github.com/AttilaTheFun/SpotifyAPI/blob/master/Package.swift

For now I guess I will modify my fork again to rip out the SpotifyAPITestUtilities but I'm pretty sure this is a bug.

cgrindel commented 1 year ago

Yeah. This is weird. At first glance, I am not sure why the undeclared SPM targets are being pulled in.