I am trying to use the output of swift package dump-package to reconstruct and transform a Package.swift file in python. However, the output of the dump-package command doesn’t seem to correspond with the format of the actual PackageDescription.Package type. For example,
-
Build flags are all grouped under the JSON key
'settings', but inPackage.Target.target(), they are passed in groupslinkerSettings:,cxxSettings:, etc. -
Local package dependencies come out of
dump-packagelike"{'name': 'foo', 'productFilter': None, 'requirement': {'localPackage': None}, 'url': '/absolute/file/path/'}", but the correspondingPackageDescriptioncall looks like.package(name:path:).
This means properly formatting the JSON output back into a Package.swift manifest involves a huge amount of trial-and-error, and a lot of python code to handle all the incongruous data entries.
Is there a better way to do this?