Sorry to ping this old thread, but its right inline with my problems:
Let's say I have a package with "MyFiles" in the name
parameter in its Package.swift file. It happens to live in a folder called "MyFiles_2024". FWIW, The package has been git init-ed and has a brach called main
, which it didn't actually need to be except to work with SPM.
To include "MyFiles" into a different package living in a neighboring directory locally there are some options:
.package(url:"../MyFiles_2024", branch:"main")
.package(path:"../MyFiles_2024")
which apparently requires the use of .product(name: "MyFiles", package: "MyFiles_2024"),
in the target dependencies. Which is sort of workable but hard to discover and confusing because there is no package called "MyFiles_2024" anywhere. It's just not a real thing.
There is also the option to use either:
.package(name: "MyFiles", path: "../MyFiles2024"),
.package(name: "MyFiles", url:"../MyFiles_2024", branch:"main"),
Which means I can go ahead and use .product(name: "MyFiles", package: "MyFiles")
in the target dependencies. BUT as pointed out above .package(name:url:XXX)
is deprecated so:
- Is it super duper settled that it will not be possible to detach the package name from the URL's final component? can the initializer be de-deprecated?
- Also, to confirm, product(name:url:XXX)/product(url:XXX) seem to expect something like git (or other SP registry server?) at the endpoint and that external-to-swift package server is the ONLY way to specify a version?
I care about the deprecation of the product(name:url:XXX) initializer / restricting it to folders with an endpoint type requirement because packages included with (:path) dependency initializers are not allowed in packages that are they themselves depended on using versioning. I get why, good code hygiene and all, but sometimes you're just trying break up the code into pieces and try some things out. Seems like package(id:) would be the rightful place to be helpfully strict and let (:url) initializers be more permissive?
I re-raise the issue because sometimes it's not just "move the package" solvable. It's more like - "change absolutely everything about the customary workflow in order to use SPM" which is a harder sell.
Anyway, the real answer for this one project might be that git-submodules or symlinks or hand compiling would be a better fit, but those are a whole other layers of shenanigans and will make the code less straightforward to share. TBD. Thank you for reading.