This PR is a WIP of fixes for issues in #189, #191 as well as some other things I'll mention in notes below.
The changes are primarily trying to address importing dependencies from a package that may not go by the same name as the package, or situations where there are multiple libraries from a package that you are trying to import. Along the way, I noticed some issues with the Master Package Description and the way it acts as a template for the Package.swift files used in every script. As a result, in this current WIP code, the Master Package.swift is mostly unused and package update functionality is currently disabled.
I was mostly working with MarathonCore directly, not via CLI, but problems with the Master Package Description pattern I saw were:
After running Marathon a few times the dependencies of dependencies start getting added to the Master Package.swift, which are then copied over into the script Package.swift files.
This also means that if you have many scripts with dependencies then copying from the Master Package.swift will make the scripts depend on each other's libraries
Updating all packages to run some scripts that may not even have many dependencies can make simple script executions take longer
I found the versions depended upon in the Package.swift files weren't consistent enough because they only used the major version. It could cause issues during swift package update as it tried to resolve the dependencies correctly
Notes:
a new Dependency struct has been introduced that maintains the name of the specific library you want to include, not just the name of the package.
if swift tools version is 4.2 or greater then local references use the .package(path:"") format
This work is currently incomplete but I wanted to open a PR with my first shot at the problem as a proposal. Since it's a big change and there is lots of room for discussion.
This PR is a WIP of fixes for issues in #189, #191 as well as some other things I'll mention in notes below.
The changes are primarily trying to address importing dependencies from a package that may not go by the same name as the package, or situations where there are multiple libraries from a package that you are trying to import. Along the way, I noticed some issues with the Master Package Description and the way it acts as a template for the
Package.swift
files used in every script. As a result, in this current WIP code, the MasterPackage.swift
is mostly unused and package update functionality is currently disabled.I was mostly working with MarathonCore directly, not via CLI, but problems with the Master Package Description pattern I saw were:
Package.swift
, which are then copied over into the scriptPackage.swift
files.Package.swift
will make the scripts depend on each other's librariesPackage.swift
files weren't consistent enough because they only used the major version. It could cause issues duringswift package update
as it tried to resolve the dependencies correctlyNotes:
Dependency
struct has been introduced that maintains the name of the specific library you want to include, not just the name of the package..package(path:"")
formatThis work is currently incomplete but I wanted to open a PR with my first shot at the problem as a proposal. Since it's a big change and there is lots of room for discussion.
Thanks for reading/reviewing!