Improving manifest loading performance for declarative package manifests

I also don’t love yaml but it‘d also be fine IMO. Personally I’m fine with the original direction suggested in the OP

Thanks for working on this, interesting approach.

This is a hack for the fact that the manifest format currently does not support building these executables only for certain platforms, a hack that only works when natively compiling for desktop platforms and breaks when cross-compiling, eg from macOS to Android. It would be great to fix this properly in the manifest format instead, as @Geordie_J also refers to later:

Another way to slim down manifests is to rely more on "convention over configuration", as ruby on rails has been successful doing. While this can sometimes make packages more difficult to explore, as it would rely on everybody knowing the conventions, a way to remedy that would be a SwiftPM command to dump the package structure in some readable format, with perhaps a convention to always do so for read-only consumption.

Regarding adding other declarative formats, a way to do this sanely would be to have SwiftPM be able to generate swift/JSON/pkl/yaml/toml/name-your-format from the in-memory package manifest, then let contributors add support for their favorite format to SwiftPM, provided it parsed to the same in-memory manifest without requiring new features. Then when their package is built, SwiftPM would dump the same declarative format for all their dependencies, eg if they chose toml for their package, it would dump a toml file for each dependency in that package's source repo, translated from its Package.swift or Package.yaml.

I don't know if this would be worth the effort, but it would let the various format proponents have their preferred format.

1 Like