Uploaded image for project: 'Swift'
  1. Swift
  2. SR-3346

SwiftPM: Support for optional sub products

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Medium
    • Resolution: Duplicate
    • Component/s: Package Manager
    • Labels:
      None

      Description

      There doesn't seem to be a way for a project to define multiple packages, but allow developers to only depend on a subset of them. But there are times where it makes sense to expose subtargets from a repository to allow developers to depend on exactly what they need minimizing build times and not relying on stripping to pull back out the code that wasn't needed.

      Examples:

      https://github.com/apple/swift-protobuf defines SwiftProtobuf which is the runtime support for the generate code. It also defines protoc-gen-swift which is a binary (protoc plugin) to actually generate the Swift code. When building an app, developers will likely checkin their generated Swift protobuf code, so they only need the dependency on SwiftProtobuf, but currently they have to also build protoc-gen-swift even though it isn't needed by their app.

      Another case this could be useful is something like what was done in the Podspec for GTLR. CocoaPods allows there to be a default target (the Core there) and then there are optional targets for different sub components. A developer can then pick up the specific dependencies they need and don't have to waste the time building all the sub dependencies (and hope they will get stripped out because they weren't needed).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              thomasvl Thomas Van Lenten
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: