-
Notifications
You must be signed in to change notification settings - Fork 147
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
Use Xcode 15.0.1 #1377
Use Xcode 15.0.1 #1377
Conversation
This resolves a string overflow issue that appeared in tests in Xcode 15.0.1
Apple requires user interaction to allow using the pasteboard – this change allows us to mock the pasteboard while under test to avoid that
|
||
func isValidIndex(_ index: String.UTF16View.Index) -> Bool { | ||
(self.startIndex ... self.endIndex).contains(index) | ||
} |
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.
The endIndex
is not an accessible index.
A string’s “past the end” position—that is, the position one greater than the last valid subscript argument.
} | ||
|
||
func isValidIndex(_ index: String.UTF16View.Index) -> Bool { | ||
(self.startIndex ... self.endIndex).contains(index) |
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.
(self.startIndex ... self.endIndex).contains(index) | |
(self.startIndex ..< self.endIndex).contains(index) |
.buildkite/pipeline.yml
Outdated
# post a message in the logs | ||
cat .buildkite/validate_podspec_annotation.md | ||
# and also as an annotation | ||
cat .buildkite/validate_podspec_annotation.md | buildkite-agent annotate --style 'warning' |
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.
There is a new workaround for this issue: You can pass a --patch-cocoapods
option to validate_podspec
and the publish pod utilities. See https://github.com/wordpress-mobile/WordPressKit-iOS/pull/652/files.
b7d60ed
to
5f76bb3
Compare
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.
Maybe updating the publishing pod commands in.buildkite/publish-aztec-pod.sh
too, with the same --patch-cocoapods
option? Otherwise, future releasing jobs would fail.
.buildkite/pipeline.yml
Outdated
env: *common_env | ||
plugins: *common_plugins | ||
agents: | ||
queue: upload |
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.
This agents
configuration needs to be removed.
5f76bb3
to
4436946
Compare
@@ -495,7 +495,7 @@ open class TextView: UITextView { | |||
// MARK: - Intercept copy paste operations | |||
|
|||
open override func cut(_ sender: Any?) { | |||
let data = storage.attributedSubstring(from: selectedRange).archivedData() | |||
let data = try! storage.attributedSubstring(from: selectedRange).archivedData() |
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.
Does that mean this line crashes if the selected attributed string contains an "attribute value" that doesn't conform to NSCoding
? I don't really know anything about this library's implementation, not sure how likely that's going to happen...
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.
That's a good question, but also before the migration to Xcode 15 and newer Swift back when archivedData
was not marked as throws
, I'd expect the code would already crash (but maybe with an ObjC NSException rather than a Swift error being thrown)?
That being said, it would be a nice improvement to use let data = try? …
instead and then make the subsequent call to storeInPasteboard(encoded: data)
conditional on if let data
; but not sure if that fix belongs in this PR or separate.
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.
Also, looking at the deprecated vs new method signature for NSKeyedArchiver.archivedData
, I'm wondering if the only case where it could throw
is if you passed requiresSecureCoding: true
and the objects conformed to NSCoding
… but not NSSecureCoding
.
But since here we use requiresSecureCoding: false
in the implementation of archivedData
, maybe that means we'll never throw in practice? Or if we do, that would be under the same conditions as the ones the current version of the library already does, i.e. not related to Xcode 13->Xcode15 migration?
Breadcrumbs: I reverted the attribution of the cluster to this repo in Buildkite (https://github.com/Automattic/buildkite-ci/pull/331) — aka reverted this repo to use Intel infra — while this PR is still not merged. Once we land this PR, don't forget to redo the change in |
I wanted to help here and tried to address the unit tests failures via #1382 but didn't get very far. |
Migrates the project to Xcode 15 and Apple Silicon in CI
Also includes:
UITextView
subclass that injects aUIPasteboard
object. This allows us to mock access to the system pasteboard, which requires user interaction in recent iOS versionsThis can be reviewed by anyone, but I'd appreciate if @mokagio or @crazytonyli took a look at the project code adjustments!
Testing Details
Ensure CI passes
CHANGELOG.md
if necessary.