Skip to content

Swift CLI tool that provides information about a Swift Package

License

Notifications You must be signed in to change notification settings

marinofelipe/swift-package-info

Repository files navigation

CI Toolchain Mint Swift Package Manager Twitter

Swift Package Info

CLI tool, built on top of Swift Argument Parser, that provides information about a given Swift Package product, such as a measurement of its binary size impact.
Binary size calculation is also available as a library via the SwiftPackageInfo package product.

Usage

Examples

  • Run a complete analysis
swift-package-info --for https://github.com/ReactiveX/RxSwift -v 6.0.0 --product RxSwift
  • Check supported platforms (sub command)
swift-package-info platforms --for https://github.com/krzyzanowskim/CryptoSwift -v 1.3.8 --product CryptoSwift
  • See the binary size of a local package (e.g., under development framework)
swift-package-info binary-size --path ../project/my-framework

Report

swift-package-info --for https://github.com/ReactiveX/RxSwift -v 6.0.0 --product RxSwift
+------------------------------------------------+
|               Swift Package Info               |
|                                                |
|                 RxSwift, 6.0.0                 |
+--------------+---------------------------------+
| Provider     | Results                         |
+--------------+---------------------------------+
| Binary Size  | Binary size increases by 963 KB |
| Platforms    | System default                  |
| Dependencies | No third-party dependencies :)  |
+--------------+---------------------------------+
> Total of 3 providers used.

A custom report strategy can be passed via the report argument (check --help for supported values)

swift-package-info --for https://github.com/ReactiveX/RxSwift -v 6.0.0 --product RxSwift --report jsonDump
{
  "binarySize" : {
    "amount" : 962560,
    "formatted" : "963 KB"
  },
  "dependencies" : [

  ],
  "platforms" : {

  }
}

Requirements

  • Swift >= 6.1
  • Xcode >= 16.4

Installation

Running

  • mint run swift-package-info
  • or simply, swift-package-info in case it was symlinked

Binary size report

Its methodology is inspired by cocoapods-size, and thus works by comparing archives with no bitcode and ARM64 arch. Such a strategy has proven consistent with the size of iOS apps downloaded and installed via TestFlight.

Thanks

Special thanks to @unnamedd for sharing his experience with swift-tools-support-core and on how to build a pretty 👌 report.

Contributing

Check the CONTRIBUTING.md file.

About

Swift CLI tool that provides information about a Swift Package

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages