Closed vinivendra closed 1 year ago
Hey @vinivendra! Yesterday I managed to solve the build errors that were occurring on the GryphonSwiftLibrary that Gryphon generates on our project, so I forked this repository and tried my hand at implementing these changes to Gryphon itself, however I had some issues trying to running the tests
I unfortunately couldn't work around on the issue with the new xcodebuild
output yet, so I couldn't test my solution with the test script. However, I thought it could be useful sharing what I've done to get the source code to compile at least. I can confirm that these changes also enables the Gryphon package to build on Xcode 13.4 (and even on Xcode 14.0 beta (Swift 5.7))
Just like last year, it seems that there has been some changes to the Collection protocol conformance requirements. When trying to build the GryphonSwiftLibrary
with swift GryphonSwiftLibrary.swift
it seems that both _ListSlice
and MutableList
were missing the replaceSubrange(_:with:) method, so I added it to both types:
// on _ListSlice
public func replaceSubrange<C>(_ subrange: Range<Int>, with newElements: C) where C: Collection, Element == C.Element {
list.array[range].replaceSubrange(subrange, with: newElements)
}
// and on MutableList
public func replaceSubrange<C>(_ subrange: Range<Index>, with newElements: C) where C: Collection, Element == C.Element {
array.replaceSubrange(subrange, with: newElements)
}
Fulfilling this requirement from the protocol was enough to get the project to build on Swift 5.6/5.7
Also, another thing that was stopping Gryphon from working was that SourceKitten released a new version (0.33) a couple of weeks ago, which now has a macOS 12.0 as a minimum target, while Gryphon's is macOS 10.13. This may be related to what has been reported on issue #118. To fix this on my fork, I've increased the target to 12.0, but we could try using a previous version of SourceKitten if Gryphon still must support older versions of the OS
I've tried building the GryphonSwiftFile
on beta 6 and noticed that there was another missing requirement. For Swift 5.7, it seems that MutableCollection
require us to set explicit setters and getters for the subscript(bounds:)
method, so I added the following:
// on _ListSlice
public subscript(bounds: Range<Index>) -> _ListSlice<Element> {
// From Collection.swift
get {
_failEarlyRangeCheck(bounds, bounds: startIndex ..< endIndex)
return _ListSlice(list: list, range: bounds)
}
set {}
}
// and on MutableList
override public subscript(bounds: Range<List<Element>.Index>) -> _ListSlice<Element> {
get {
_failEarlyRangeCheck(bounds, bounds: startIndex ..< endIndex)
return _ListSlice(list: List(array), range: bounds)
}
set {}
}
I'm aware that these are not a real solution, more like an unblocker for now. If anyone could shed some light on how to set these properly I'd appreciate it!
Hi @tfmart! Thanks a lot, this will definitely help.
Just like last year, it seems that there has been some changes to the Collection protocol conformance requirements. When trying to build the GryphonSwiftLibrary with swift GryphonSwiftLibrary.swift it seems that both ListSlice and MutableList were missing the [replaceSubrange(:with:) method](https://developer.apple.com/documentation/swift/rangereplaceablecollection/replacesubrange(_:with:)-6x76a), so I added it to both types:
That looks good, would you like to open a PR from your fork to my development
branch so that I can accept those changes? Otherwise I can also replicate them myself here.
Also, another thing that was stopping Gryphon from working was that SourceKitten released a new version (0.33) a couple of weeks ago, which now has a macOS 12.0 as a minimum target, while Gryphon's is macOS 10.13.
Hmm that's surprising to me, in the Package.swift
file the SourceKitten version is locked at 0.31.1
... but if that worked, then it's one less problem too. If you could, please include that change in your PR as well.
I've tried building the GryphonSwiftFile on beta 6 and noticed that there was another missing requirement. For Swift 5.7, it seems that MutableCollection require us to set explicit setters and getters for the subscript(bounds:) method, so I added the following:
This one I'm not sure I understand... in the current release
branch, these methods are already implemented (here and here). Is there something missing?
Hey @vinivendra! I just tried running the project with the newly released Xcode 14 RC and the project built fine with the changes I mentioned above. In the end, I didn't end having any issues with the subscript(bounds:)
, guess it might could've been an issue with the beta.
I've opened #119, if you have any questions we can discuss further here or in the PR!
Hey, I've decided to open a pull request for #118 as well, if you want to take a look at one issue at a time. But my previous PR #119 contains all the changes from #120 as well.
Hey folks, thanks for the work you did for this issue. I’m moving this discussion to issue #127 which is more up to date, so please chime in there if you think these changes are still worth considering for Xcode 14.3 and Swift 5.8.
The Xcode integration is still working for Xcode 13.2.1, but not for Xcode 13.3 and later. This is easy to see when running the automated Xcode tests (
./Scripts/runTests.sh -x
).We need to implement support for Xcode 13.3+'s new format for
xcodebuild
output messages, and then fix any future bugs that might show up after that.