Skip to content
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.3 in CI #1392

Open
wants to merge 20 commits into
base: tooling/fix-sync-pod-publication
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
dccf8ef
DRY `env` and `agents` in Buildkite pipeline
mokagio Apr 16, 2024
afc4064
Address an access control warning
mokagio Apr 16, 2024
168f40e
Centralize deployment target definition at projects level
mokagio Apr 16, 2024
2f50d83
Bump deployment target to iOS 12.0, minimum for Xcode 15.3
mokagio Apr 16, 2024
380e6ac
Use Xcode 15.3 in CI
mokagio Apr 16, 2024
0b59180
Use Ruby 3.2.2 and update RuboCop to compatible version
mokagio Apr 16, 2024
34808d7
Bump iOS and Simulator versions for CI
mokagio Apr 16, 2024
5baf0b9
Allow warnings when validating podspec
mokagio Apr 16, 2024
78bd117
Update Fastlane in the hope it helps with stuck tests in CI
mokagio Apr 16, 2024
e41da8f
Don't waste time cleaning up Simulators in CI
mokagio Apr 16, 2024
04e4fc8
Merge remote-tracking branch 'origin/develop' into mokagio/xcode-15.3
mokagio Apr 16, 2024
210f02c
Merge remote-tracking branch 'origin/tooling/fix-sync-pod-publication…
mokagio Apr 17, 2024
665b15b
Fix NSSecureCoding implementations
AliSoftware Apr 18, 2024
90c0e4d
Use `UTType.utf8PlainText` (explicit encoding) instead of `kUTTypePla…
AliSoftware Apr 18, 2024
5c3004b
Fix overriding non-open class outside module
AliSoftware Apr 18, 2024
e21dbff
Revert "Fix overriding non-open class outside module"
AliSoftware Apr 18, 2024
c67821c
Declare `class var supportsSecureCoding` as `open`
AliSoftware Apr 18, 2024
83e548f
Simpler code style on UIPasteboard+Helpers > UTType
AliSoftware Apr 19, 2024
ce0726e
Fix shorcode test by using an attribute with key-value
geriux May 21, 2024
7531747
Merge pull request #1395 from wordpress-mobile/fix/shortcode-test
geriux May 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 7 additions & 15 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
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: xcode-15.3-v3

# This is the default pipeline – it will build and test the app
steps:
Expand All @@ -15,20 +17,17 @@ steps:
key: "test"
command: |
build_and_test_pod
env: *common_env
plugins: *common_plugins

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

#################
# Lint
Expand All @@ -37,7 +36,6 @@ steps:
key: "lint"
command: |
lint_pod
env: *common_env
plugins: *common_plugins

#################
Expand All @@ -46,28 +44,22 @@ steps:
- label: "⬆️ Publish Aztec Podspec"
key: "publish-aztec"
command: .buildkite/publish-aztec-pod.sh
env: *common_env
plugins: *common_plugins
depends_on:
- "test"
- "validate"
- "lint"
if: build.tag != null
agents:
queue: "mac"

#################
# Publish the Podspec (if we're building a tag)
#################
- label: "⬆️ Publish Editor Podspec"
key: "publish-editor"
command: .buildkite/publish-editor-pod.sh
env: *common_env
plugins: *common_plugins
depends_on:
- "test"
- "validate"
- "lint"
if: build.tag != null
agents:
queue: "mac"
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
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
75 changes: 66 additions & 9 deletions Aztec/Classes/Extensions/UIPasteboard+Helpers.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import UniformTypeIdentifiers
import MobileCoreServices
import UIKit

Expand Down Expand Up @@ -30,24 +31,80 @@ extension UIPasteboard {
}

func html() -> String? {
guard let htmlData = data(forPasteboardType: String(kUTTypeHTML)) else {
guard let htmlData = data(forPasteboardType: UTType.html.identifier) else {
return nil
}

return String(data: htmlData, encoding: .utf8)
}

// Compatibility Helper for using UTType before iOS14's UniformTypeIdentifiers
// Feel free to remove once Deployment Target of the project gets bumped to >14.0
struct UTType {
let identifier: String

static let html: UTType = {
if #available(iOS 14.0, *) {
UTType(identifier: UniformTypeIdentifiers.UTType.html.identifier)
} else {
UTType(identifier: kUTTypeHTML as String)
}
}()
static let plainText: UTType = {
if #available(iOS 14.0, *) {
UTType(identifier: UniformTypeIdentifiers.UTType.utf8PlainText.identifier)
} else {
UTType(identifier: kUTTypeUTF8PlainText as String)
}
}()
static let richText: UTType = {
if #available(iOS 14.0, *) {
UTType(identifier: UniformTypeIdentifiers.UTType.text.identifier)
} else {
UTType(identifier: kUTTypeText as String)
}
}()
static let RTFText: UTType = {
if #available(iOS 14.0, *) {
UTType(identifier: UniformTypeIdentifiers.UTType.rtf.identifier)
} else {
UTType(identifier: kUTTypeRTF as String)
}
}()
static let RTFDText: UTType = {
if #available(iOS 14.0, *) {
UTType(identifier: UniformTypeIdentifiers.UTType.flatRTFD.identifier)
} else {
UTType(identifier: kUTTypeFlatRTFD as String)
}
}()
static let URL: UTType = {
if #available(iOS 14.0, *) {
UTType(identifier: UniformTypeIdentifiers.UTType.url.identifier)
} else {
UTType(identifier: kUTTypeURL as String)
}
}()
}

func store(_ data: Any, as type: UTType) {
if numberOfItems > 0 {
items[0][type.identifier] = data
} else {
addItems([[type.identifier: data]])
}
}
}

// MARK: - Attributed String Conversion

private extension UIPasteboard {

// MARK: -

/// Attempts to unarchive the Pasteboard's Aztec-Archived String
///
private func aztecAttributedString() -> NSAttributedString? {
guard let data = data(forPasteboardType: NSAttributedString.pastesboardUTI) else {
guard let data = data(forPasteboardType: NSAttributedString.pasteboardUTI.identifier) else {
return nil
}

Expand All @@ -57,25 +114,25 @@ private extension UIPasteboard {
/// Attempts to unarchive the Pasteboard's Plain Text contents into an Attributed String
///
private func plainTextAttributedString() -> NSAttributedString? {
return unarchiveAttributedString(fromPasteboardCFType: kUTTypePlainText, with: StringOptions.plainText)
return unarchiveAttributedString(fromPasteboardType: .plainText, with: StringOptions.plainText)
}

/// Attempts to unarchive the Pasteboard's Text contents into an Attributed String
///
private func richTextAttributedString() -> NSAttributedString? {
return unarchiveAttributedString(fromPasteboardCFType: kUTTypeText, with: StringOptions.RTFText)
return unarchiveAttributedString(fromPasteboardType: .richText, with: StringOptions.RTFText)
}

/// Attempts to unarchive the Pasteboard's RTF contents into an Attributed String
///
private func rtfAttributedString() -> NSAttributedString? {
return unarchiveAttributedString(fromPasteboardCFType: kUTTypeRTF, with: StringOptions.RTFText)
return unarchiveAttributedString(fromPasteboardType: .RTFText, with: StringOptions.RTFText)
}

/// Attempts to unarchive the Pasteboard's RTFD contents into an Attributed String
///
private func rtfdAttributedString() -> NSAttributedString? {
return unarchiveAttributedString(fromPasteboardCFType: kUTTypeFlatRTFD, with: StringOptions.RTFDText)
return unarchiveAttributedString(fromPasteboardType: .RTFDText, with: StringOptions.RTFDText)
}

// MARK: - Helpers
Expand All @@ -97,8 +154,8 @@ private extension UIPasteboard {
///
/// - Returns: NSAttributed String with the contents of the specified Pasteboard entry, if any.
///
private func unarchiveAttributedString(fromPasteboardCFType type: CFString, with options: [DocumentReadingOptionKey: Any]) -> NSAttributedString? {
guard let data = data(forPasteboardType: String(type)) else {
private func unarchiveAttributedString(fromPasteboardType type: UTType, with options: [DocumentReadingOptionKey: Any]) -> NSAttributedString? {
guard let data = data(forPasteboardType: type.identifier) else {
return nil
}

Expand Down