Unable to build when using GzipSwift
alessandrodn opened this issue ยท 10 comments
Version 6.1.0 of the package can't be installed because of a typo in the file Package@swift-5.10.swift
.
Doing a simple package update during the build invalidates the whole project with Xcode presenting the error
Invalid manifest (compiled with: ["/Applications/Xcode-15.4.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-vfsoverlay", "/var/folders/7l/rszmbrmd6tv4pg52z6ql_5rc0000gn/T/TemporaryDirectory.vh9fZx/vfs.yaml", "-L", "/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks/SwiftPM.framework/SharedSupport/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks/SwiftPM.framework/SharedSupport/ManifestAPI", "-target", "arm64-apple-macos13.0", "-sdk", "/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk", "-swift-version", "5", "-I", "/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks/SwiftPM.framework/SharedSupport/ManifestAPI", "-sdk", "/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk", "-package-description-version", "5.10.0", "-Xfrontend", "-serialize-diagnostics-path", "-Xfrontend", "/Users/[REDACTED]/Library/Caches/org.swift.swiftpm/manifests/ManifestLoading/gzipswift.dia", "/Package@swift-5.10.swift", "-disallow-use-new-driver", "-o", "/var/folders/7l/rszmbrmd6tv4pg52z6ql_5rc0000gn/T/TemporaryDirectory.VUJWLU/gzipswift-manifest"])
<unknown>:0: warning: legacy driver is now deprecated; consider avoiding specifying '-disallow-use-new-driver'
/Package@swift-5.10.swift:14:78: error: expected ',' separator
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")])
^
,
/Package@swift-5.10.swift:15:9: error: expected expression in container literal
),
^ in https://github.com/1024jp/GzipSwift2024-06-17 13:25:24.715 xcodebuild[8695:42623] Writing error result bundle to /var/folders/7l/rszmbrmd6tv4pg52z6ql_5rc0000gn/T/ResultBundle_2024-17-06_13-25-0024.xcresult
xcodebuild: error: Could not resolve package dependencies:
Invalid manifest (compiled with: ["/Applications/Xcode-15.4.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-vfsoverlay", "/var/folders/7l/rszmbrmd6tv4pg52z6ql_5rc0000gn/T/TemporaryDirectory.vh9fZx/vfs.yaml", "-L", "/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks/SwiftPM.framework/SharedSupport/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks/SwiftPM.framework/SharedSupport/ManifestAPI", "-target", "arm64-apple-macos13.0", "-sdk", "/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk", "-swift-version", "5", "-I", "/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks/SwiftPM.framework/SharedSupport/ManifestAPI", "-sdk", "/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk", "-package-description-version", "5.10.0", "-Xfrontend", "-serialize-diagnostics-path", "-Xfrontend", "/Users/[REDACTED]/Library/Caches/org.swift.swiftpm/manifests/ManifestLoading/gzipswift.dia", "/Package@swift-5.10.swift", "-disallow-use-new-driver", "-o", "/var/folders/7l/rszmbrmd6tv4pg52z6ql_5rc0000gn/T/TemporaryDirectory.VUJWLU/gzipswift-manifest"])
<unknown>:0: warning: legacy driver is now deprecated; consider avoiding specifying '-disallow-use-new-driver'
/Package@swift-5.10.swift:14:78: error: expected ',' separator
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")])
^
,
/Package@swift-5.10.swift:15:9: error: expected expression in container literal
),
^ in https://github.com/1024jp/GzipSwift
The PR #64 fixes the issue.
As a workaround, you can ping the version to anything below 6.1.0.
Thanks @alessandrodn . Will you guys be making a new release soon? Just wondering if I should work around this or just wait for you guys to publish.
will there be a release for this fix soon? thanks
Could you please publish a new release with this fix? It's currently preventing me from building my project, which has dependencies that depend on GzipSwift. I can't pin a prior version without forking those dependencies.
@DePasqualeOrg @BenTincher as @alessandrodn suggested, you can force SPM to use an earlier version. I'm doing the following to achieve this:
.package(url: "https://github.com/1024jp/GzipSwift", "6.0.0"..<"6.1.0"),
@DePasqualeOrg ah gotcha, yeah that is a problem.
it sounds like you already tried this, but note that it's okay for the dependency to have different versions specified in your Package.swift vs your dependencies' Package.swift files, as long as they don't conflict.
I had this problem with a different dependency (swift-protobuf
), where both Firebase and my project depended on different versions.
In this case, Firebase had this version specifier:
.package(
url: "https://github.com/apple/swift-protobuf.git",
"1.19.0" ..< "2.0.0"
),
I wanted to lock to a specific commit, so I had my package.swift specify the version as follows:
.package(url: "https://github.com/apple/swift-protobuf.git", revision: "68c452eef4fc8a7c7764617f6fe0d9673906e310"),
I think this ended up working fine since the 68c452e
is still within "1.19.0" ..< "2.0.0"
. SPM (correctly) resolved to the 68c452e
revision.
Anyway, just sharing for posterity. Ultimately, GzipSwift does need to either unpublish 6.1.0 or release a fixed version.
The problem is mostly Xcode, which didn't seem to want to download the version of the package I specified. I had to remove it and add it back again from my own fork of the dependency. Stuff like this wastes hours of people's time, while publishing a patch version takes just a minute. I know people are busy and open source work is mostly unpaid, but please don't leave broken packages out there like this, especially after the fix already exists.
agreed, xcode and swift package manager are both pretty terrible.
one thing in particular that's pretty gnarly: if you (or your dependencies) are pulling a dependency in via from
, e.g.
.package(url: "https://github.com/1024jp/GzipSwift", from: "6.0.0"),
Note that the from
version is a MINIMUM version, not a fixed version. I found that incredibly not obvious and it has burned me before.
/// Adds a package dependency that uses the version requirement, starting with the given minimum version,
/// going up to the next major version.
///
/// This is the recommended way to specify a remote package dependency.
/// It allows you to specify the minimum version you require, allows updates that include bug fixes
/// and backward-compatible feature updates, but requires you to explicitly update to a new major version of the dependency.
/// This approach provides the maximum flexibility on which version to use,
/// while making sure you don't update to a version with breaking changes,
/// and helps to prevent conflicts in your dependency graph.
///
/// The following example allows the Swift Package Manager to select a version
/// like a `1.2.3`, `1.2.4`, or `1.3.0`, but not `2.0.0`.
///
///```swift
///.package(url: "https://example.com/example-package.git", from: "1.2.3"),
///```
///
/// - Parameters:
/// - url: The valid Git URL of the package.
/// - version: The minimum version requirement.
///
/// - Returns: A `Package.Dependency` instance.
public static func package(url: String, from version: PackageDescription.Version) -> PackageDescription.Package.Dependency
Is there any reason why 6.1.0
version is still available. Is there a rule of not removing published versions even if that version is broken?