Relationship between the output of `dump-package` and `Package.swift`

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 in Package.Target.target(), they are passed in groups linkerSettings:, cxxSettings:, etc.

  • Local package dependencies come out of dump-package like "{'name': 'foo', 'productFilter': None, 'requirement': {'localPackage': None}, 'url': '/absolute/file/path/'}", but the corresponding PackageDescription call 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?

Terms of Service

Privacy Policy

Cookie Policy