-
Notifications
You must be signed in to change notification settings - Fork 2
Description
As noted by the guys doing Scipio in giginet/Scipio#231, they've replaced the usage of the SwiftPM lib with relying on the PIF representation of packages (run via swift package dump-pif). We should evaluate its tradeoffs and see if it would be a good fit for spmgraph. Below are some thoughts on the potential benefits and known downsides of SPM as a lib.
Context
This project depends on the swift-package-manager's SwiftPM library to load the graph for a given package—the backbone that provides the capabilities on top of the graph.
SwiftPM works pretty magically; it's built into SPM, it provides all the needed APIs, it has built-in cache and resolution, etc.
However, it comes with its own downsides:
- The
SwiftPMlib is unstable, meaning that upcoming releases are likely to break backward compatibility - Similarly, the swift-package-manager doesn't follow semver, and its releases are tied to Swift toolchain releases, which also possess a considerable risk of requiring bumping up the minimum supported Swift toolchain on spmgraph, and therefore, the need also constantly to remove support for older Xcode toolchains
- It brings many transitive dependencies, which increases build time and makes the
SPMGraphConfigalso heavier
As also highlighted by the guys doing Scipio: giginet/Scipio#231
PIF
Since the release of swift-build, the Project Interchange Format (PIF) has become public. It's a structured universal representation of the project model created by clients (Xcode/SwiftPM), and it's expected to stay relatively stable moving forward.
/// The Project Interchange Format (PIF) is a structured representation of the
/// project model created by clients to send to SwiftBuild.
///
/// The PIF is a representation of the project model describing the static
/// objects which contribute to building products from the project, independent
/// of "how" the user has chosen to build those products in any particular
/// build. This information can be cached by SwiftBuild between builds (even
/// between builds which use different schemes or configurations), and can be
/// incrementally updated by clients when something changes.
Goal
Try out PIF in a branch and see how it goes! The swift CLI can be leveraged to dump the PIF representation of packages.
Besides the points mentioned above, even though it will require more work to use PIF and define a graph structure in code, it may enable smarter evaluation of graphs, such as allowing to solve ##31 cheaply.