Skip to content

Commit

Permalink
Upgrade to Xcode 16.2 (#1404)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio authored Jan 21, 2025
2 parents b47ad59 + 2496cac commit c2a5686
Show file tree
Hide file tree
Showing 40 changed files with 385 additions and 274 deletions.
89 changes: 44 additions & 45 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,72 @@
# Nodes with values to reuse in the pipeline.
common_params:
plugins: &common_plugins
- automattic/a8c-ci-toolkit#3.3.0
# Common environment values to use with the `env` key.
env: &common_env
IMAGE_ID: xcode-15.0.1
agents:
queue: mac
env:
IMAGE_ID: $IMAGE_ID

# This is the default pipeline – it will build and test the app
steps:
#################
# Build and Test
#################
- label: "🧪 Build and Test"
key: "test"
command: |
build_and_test_pod
env: *common_env
plugins: *common_plugins
- label: 🧪 Build and Test
key: test
command: build_and_test_pod
plugins: [$CI_TOOLKIT_PLUGIN]
notify:
- github_commit_status:
context: Unit Tests

#################
# Validate Podspecs
#################
- label: "🔬 Validate Podspecs"
key: "validate"
command: |
validate_podspec --patch-cocoapods
env: *common_env
plugins: *common_plugins
agents:
queue: mac
- label: 🔬 Validate Podspecs
key: validate
# Ideally, --allow-warnings should be removed once the warnings have been addressed
command: validate_podspec --patch-cocoapods --allow-warnings
plugins: [$CI_TOOLKIT_PLUGIN]
notify:
- github_commit_status:
context: Validate Podspecs

#################
# Lint
#################
- label: "🧹 Lint"
key: "lint"
command: |
lint_pod
env: *common_env
plugins: *common_plugins
- label: 🧹 Lint
key: lint
command: lint_pod
plugins: [$CI_TOOLKIT_PLUGIN]
notify:
- github_commit_status:
context: Lint Pod

#################
# Publish the Podspec (if we're building a tag)
#################
- label: "⬆️ Publish Aztec Podspec"
key: "publish-aztec"
- label: ⬆️ Publish Aztec Podspec
key: publish-aztec
command: .buildkite/publish-aztec-pod.sh
env: *common_env
plugins: *common_plugins
plugins: [$CI_TOOLKIT_PLUGIN]
depends_on:
- "test"
- "validate"
- "lint"
- test
- validate
- lint
if: build.tag != null
agents:
queue: "mac"
notify:
- github_commit_status:
context: Publish Aztec Podspec

#################
# Publish the Podspec (if we're building a tag)
#################
- label: "⬆️ Publish Editor Podspec"
key: "publish-editor"
- label: ⬆️ Publish Editor Podspec
key: publish-editor
command: .buildkite/publish-editor-pod.sh
env: *common_env
plugins: *common_plugins
plugins: [$CI_TOOLKIT_PLUGIN]
depends_on:
- "test"
- "validate"
- "lint"
- test
- validate
- lint
if: build.tag != null
agents:
queue: "mac"
notify:
- github_commit_status:
context: Publish WordPress-Editor Podspec
11 changes: 11 additions & 0 deletions .buildkite/shared-pipeline-vars
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

# This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used
# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it.

# The ~> modifier is not currently used, but we check for it just in case
XCODE_VERSION=$(sed -E 's/^~> ?//' .xcode-version)
CI_TOOLKIT_PLUGIN_VERSION="3.8.0"

export IMAGE_ID="xcode-$XCODE_VERSION-macos-14.7.1-v1"
export CI_TOOLKIT_PLUGIN="automattic/a8c-ci-toolkit#$CI_TOOLKIT_PLUGIN_VERSION"
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.4
3.2.2
1 change: 1 addition & 0 deletions .xcode-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.2
4 changes: 0 additions & 4 deletions Aztec.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,6 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Aztec/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.15.0;
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
Expand All @@ -1947,7 +1946,6 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Aztec/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.15.0;
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
Expand Down Expand Up @@ -2064,7 +2062,6 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Aztec/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.15.0;
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
Expand Down Expand Up @@ -2172,7 +2169,6 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Aztec/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.15.0;
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
Expand Down
4 changes: 2 additions & 2 deletions Aztec/Classes/EditorView/EditorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public class EditorView: UIView {
// MARK: - Initializers

public required init?(coder aDecoder: NSCoder) {
guard let htmlTextView = aDecoder.decodeObject(forKey: EditorView.htmlTextViewKey) as? UITextView,
let richTextView = aDecoder.decodeObject(forKey: EditorView.richTextViewKey) as? TextView else {
guard let htmlTextView = aDecoder.decodeObject(of: UITextView.self, forKey: EditorView.htmlTextViewKey),
let richTextView = aDecoder.decodeObject(of: TextView.self, forKey: EditorView.richTextViewKey) else {
return nil
}

Expand Down
5 changes: 3 additions & 2 deletions Aztec/Classes/Extensions/NSAttributedString+Archive.swift
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import Foundation
import UIKit

// MARK: - NSAttributedString Archive methods
//
extension NSAttributedString
{
static let pastesboardUTI = "com.wordpress.aztec.attributedString"
static let pasteboardUTI = UIPasteboard.UTType(identifier: "com.wordpress.aztec.attributedString")

func archivedData() throws -> Data {
return try NSKeyedArchiver.archivedData(withRootObject: self, requiringSecureCoding: false)
}

static func unarchive(with data: Data) throws -> NSAttributedString? {
return try NSKeyedUnarchiver.unarchivedObject(ofClass: NSAttributedString.self, from: data)
return try NSKeyedUnarchiver.unarchivedObject(ofClasses: [NSAttributedString.self, HTMLRepresentation.self], from: data) as? NSAttributedString
}

}
30 changes: 15 additions & 15 deletions Aztec/Classes/Extensions/NSAttributedString+Attachments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension NSAttributedString
static let lengthOfTextAttachment = NSAttributedString(attachment: NSTextAttachment()).length

// MARK: - Initializers

/// Helper Initializer: returns an Attributed String, with the specified attachment, styled with a given
/// collection of attributes.
///
Expand All @@ -21,24 +21,24 @@ extension NSAttributedString

self.init(.textAttachment, attributes: attributesWithAttachment)
}

public convenience init(attachment: NSTextAttachment, caption: NSAttributedString, attributes: [NSAttributedString.Key: Any]) {
let figure = Figure()
let figcaption = Figcaption(defaultFont: UIFont.systemFont(ofSize: 14), storing: nil)

let figureAttributes = attributes.appending(figure)
let finalString = NSMutableAttributedString(attachment: attachment, attributes: figureAttributes)

let mutableCaption = NSMutableAttributedString(attributedString: caption)
mutableCaption.append(paragraphProperty: figure)
mutableCaption.append(paragraphProperty: figcaption)

let paragraphSeparator = NSAttributedString(.paragraphSeparator, attributes: [:])

finalString.append(paragraphSeparator)
finalString.append(mutableCaption)
finalString.append(paragraphSeparator)

self.init(attributedString: finalString)
}

Expand Down Expand Up @@ -103,47 +103,47 @@ extension NSAttributedString
guard let captionRange = self.captionRange(for: attachment) else {
return nil
}

let string = attributedSubstring(from: captionRange).mutableCopy() as! NSMutableAttributedString

for character in Character.paragraphBreakingCharacters {
string.replaceOcurrences(of: String(character), with: "")
}

return NSAttributedString(attributedString: string)
}

public func captionRange(for attachment: NSTextAttachment) -> NSRange? {
guard let figureRange = self.figureRange(for: attachment) else {
return nil
}

return figcaptionRanges(within: figureRange).first
}

// MARK: - Captions: Figure and Figcaption property ranges

private func figcaptionRanges(within range: NSRange) -> [NSRange] {
var ranges = [NSRange]()

enumerateParagraphRanges(spanning: range) { (_, enclosingRange) in
guard let paragraphStyle = attribute(.paragraphStyle, at: enclosingRange.lowerBound, effectiveRange: nil) as? ParagraphStyle else {
return
}

if paragraphStyle.hasProperty(where: { $0 is Figcaption }) {
ranges.append(enclosingRange)
}
}

return ranges
}

private func figureRange(for attachment: NSTextAttachment) -> NSRange? {
guard let attachmentRange = ranges(forAttachment: attachment).first else {
return nil
}

let paragraphRange = self.paragraphRange(for: attachmentRange)

guard let paragraphStyle = self.attribute(.paragraphStyle, at: paragraphRange.lowerBound, effectiveRange: nil) as? ParagraphStyle,
Expand Down
Loading

0 comments on commit c2a5686

Please sign in to comment.