-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'Readium' prefix to all symbols #12
Add 'Readium' prefix to all symbols #12
Conversation
This depends on the following PR: readium/GCDWebServer#12 Together these solve issue readium#402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for tackling the name changes Ettore!
Build product name also remained the same. On the client side we'll continue to use import GCDWebServer. This is unfortunate because it seems like SPM uses the Package.name only for display purposes and instead uses the repo name (or rather the last path component of the package URL) as identifier for the module. This is discussed in a few places online (link 1 | Iterable/iterable-swift-sdk#537 (comment)). Modifying Package.swift to have ReadiumGCDWebServer as package and library name will produce package resolution errors when this is used as a dependency (e.g. in swift-toolkit) unless we also modify the repo name (I verified this would works).
What about changing only the library
and target
names? This should allow us to use import ReadiumGCDWebServer
even though in the Package Dependencies it will still appear as GCDWebServer
.
AFAIK in a Package.swift
, we never directly reference a package name. We use the full URL to a third-party package, then reference the names of its products.
I also merged your other PR on this repo, would you mind tacking a look at the conflicts? Thanks.
Once this PR is merged, I'll publish a 4.0.0 version of ReadiumGCDWebServer
.
Since this fork is not guaranteed to be compatible with the upstream repo, we need to ensure there are no symbols name collisions in case a host app needs to integrate our fork together with the original GCDWebServer as a dependency.
c53c25f
to
8c555d6
Compare
yep, I tried that too but this is what happens. If I understand well I think you meant this:
Then, if I leave swift-toolkit's
If I then modify swift-toolkit's
I misteriouly get these errors:
As you can see these last 2 errors are "incompatible" with the previous one. The only way that I have found that solves them and allow us to use |
Done!
👍 |
Maybe you're having some cache issues? I tried forking the project, changed the |
No, I have cleared derived data every time I attempted something new SPM related. But maybe it's because I'm using Xcode 15.0.1 (15A507) with macOS 13.5 (M1), so I'm not up to the latest. I wonder if this was a bug on my Xcode version which got fixed recently. Supporting this hunch I think it's also the fact that your Test project doesn't open for me. I get the following error when I try to resolve packages:
Removing and re-adding the package from your fork doesn't work either. Which version of Xcode are you using? I'll try using the latest. |
I'm using Xcode 15.3, but I think you might need to remove |
yep, I cleared However, I did miss something. I was still referencing v3.7.5 in my package definition which maybe (I thought) was confusing Xcode. So I pushed the package/library rename to a new branch on my fork and also created a new 4.0.0 version: https://github.com/ettore/GCDWebServer/releases/tag/4.0.0
I quit Xcode, re-cleared derived data and I DID find a way to make it work by using a different package dependency method, e.g.:
however this requires I'm still using Xcode 15.0.1 and I know I need to upgrade.... I hope to be able to do that soon. |
I upgraded to Sonoma 14.4 and Xcode 15.3. I am now able to open your Test project and that works fine. But that project specifies the |
I did more tests and found a solution that seems to work at least on Xcode 15.3. In let package = Package(
name: "GCDWebServer",
platforms: [.iOS(.v11)],
products: [
.library(name: "ReadiumGCDWebServer", targets: ["ReadiumGCDWebServer"]),
],
targets: [
.target(
name: "ReadiumGCDWebServer",
path: "GCDWebServer",
cSettings: [
.define("SWIFT_PACKAGE")
]
)
]
) Then in .target(
name: "ReadiumAdapterGCDWebServer",
dependencies: [
.product(name: "ReadiumGCDWebServer", package: "GCDWebServer"),
"R2Shared",
],
path: "Sources/Adapters/GCDWebServer"
), Not sure why You can try it out in my fork with the We could of course rename the repo, but then it would break the older versions of the toolkit for the same reason. I prefer not to maintain two separate |
that worked! 🎉 🎉 I just pushed my changes to this branch and to the other PR on swift-toolkit. Thank you for working with me on this, I was not familiar with that way of specifying product dependencies in targets! |
This depends on the following PR: readium/GCDWebServer#12 Together these solve issue readium#402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Ettore!
Since this fork is not guaranteed to be compatible with the upstream repo, we need to ensure there are no symbols name collisions in case a host app needs to integrate our fork together with the original GCDWebServer as a dependency.
This is part 1 to solving issue readium/swift-toolkit#402
Notes:
import GCDWebServer
. This is unfortunate because it seems like SPM uses thePackage.name
only for display purposes and instead uses the repo name (or rather the last path component of the package URL) as identifier for the module. This is discussed in a few places online (link 1 | link 2). ModifyingPackage.swift
to haveReadiumGCDWebServer
as package and library name will produce package resolution errors when this is used as a dependency (e.g. inswift-toolkit
) unless we also modify the repo name (I verified this would works).