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

WordPress-iOS Edition [Do Not Merge] #816

Draft
wants to merge 23 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .buildkite/create-xcframeworks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ROOT="./.build/xcframeworks"

rm -rf $ROOT

for SDK in iphoneos iphonesimulator
do
xcodebuild archive \
-workspace WordPressKit.xcworkspace \
-scheme WordPressKit \
-archivePath "$ROOT/WordPressKit-$SDK.xcarchive" \
-sdk $SDK \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
DEBUG_INFORMATION_FORMAT=DWARF
done

xcodebuild -create-xcframework \
-framework "$ROOT/WordPressKit-iphoneos.xcarchive/Products/Library/Frameworks/WordPressKit.framework" \
-framework "$ROOT/WordPressKit-iphonesimulator.xcarchive/Products/Library/Frameworks/WordPressKit.framework" \
-output "$ROOT/WordPressKit.xcframework"

cd $ROOT
zip -r -X WordPressKit.zip *.xcframework
rm -rf *.xcframework

swift package compute-checksum WordPressKit.zip
cd -
10 changes: 0 additions & 10 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ steps:
env: *common_env
plugins: *common_plugins

#################
# Validate Podspec
#################
- label: "🔬 Validate Podspec"
key: "validate"
command: |
validate_podspec --patch-cocoapods
env: *common_env
plugins: *common_plugins

#################
# Linters
#################
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ playground.xcworkspace
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved

# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.swiftpm
Package.resolved
.build/

# CocoaPods
Expand Down
122 changes: 0 additions & 122 deletions Package.resolved

This file was deleted.

46 changes: 7 additions & 39 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,50 +1,18 @@
// swift-tools-version: 5.9
// swift-tools-version: 5.10

import PackageDescription

let package = Package(
name: "WordPressKit",
platforms: [.iOS(.v13)],
platforms: [.iOS(.v15)],
products: [
.library(name: "APIInterface", targets: ["APIInterface"]),
.library(name: "CoreAPI", targets: ["CoreAPI"]),
],
dependencies: [
// .package(url: "https://github.com/wordpress-mobile/WordPress-iOS-Shared.git", from: "2.3.1"),
// See https://github.com/wordpress-mobile/WordPress-iOS-Shared/pull/354
.package(url: "https://github.com/wordpress-mobile/WordPress-iOS-Shared.git", branch: "mokagio/swiftlint-read-as-dependency"),
.package(url: "https://github.com/wordpress-mobile/wpxmlrpc", from: "0.10.0"),
// Test dependencies
.package(url: "https://github.com/AliSoftware/OHHTTPStubs", from: "9.1.0"),
.package(url: "https://github.com/Alamofire/Alamofire", from: "5.8.1"),
.library(name: "WordPressKit", targets: ["WordPressKit"]),
],
targets: [
.target(name: "APIInterface"),
.target(
name: "CoreAPI",
dependencies: [
.target(name: "APIInterface"),
.product(
name: "WordPressShared",
package: "WordPress-iOS-Shared",
// Constrain to iOS only to avoid having to explicitly set a macOS version because of this library's requirements.
condition: .when(platforms: [.iOS])
),
"wpxmlrpc"
]
),
.testTarget(
name: "CoreAPITests",
dependencies: [
.target(name: "CoreAPI"),
.product(name: "OHHTTPStubs", package: "OHHTTPStubs"),
.product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs"),
"Alamofire",
],
path: "Tests/CoreAPITests",
resources: [
.process("Stubs") // Relative to path
]
.binaryTarget(
name: "WordPressKit",
url: "https://github.com/user-attachments/files/16531883/WordPressKit.zip",
checksum: "ca916824c64a6061814a69a37bc9a6560aafcc35559983e945fdfa5c3bbcc23d"
),
]
)
26 changes: 1 addition & 25 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,14 @@ use_frameworks!
APP_IOS_DEPLOYMENT_TARGET = Gem::Version.new('13.0')

platform :ios, APP_IOS_DEPLOYMENT_TARGET
workspace './WordPressKit.xcworkspace'

def swiftlint_version
require 'yaml'

YAML.load_file('.swiftlint.yml')['swiftlint_version']
end

def wordpresskit_pods
pod 'WordPressShared', '~> 2.0.0-beta.2'
pod 'NSObject-SafeExpectations', '~> 0.0.4'
pod 'wpxmlrpc', '~> 0.10.0'
pod 'UIDeviceIdentifier', '~> 2.0'
end

## WordPress Kit
## =============
##
target 'WordPressKit' do
project 'WordPressKit.xcodeproj'
wordpresskit_pods
end

target 'WordPressKitTests' do
project 'WordPressKit.xcodeproj'
wordpresskit_pods

pod 'OHHTTPStubs', '~> 9.0'
pod 'OHHTTPStubs/Swift', '~> 9.0'
pod 'OCMock', '~> 3.4'
pod 'Alamofire', '~> 5.0'
end

abstract_target 'Tools' do
pod 'SwiftLint', swiftlint_version
end
Expand Down
45 changes: 1 addition & 44 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,59 +1,16 @@
PODS:
- Alamofire (5.8.1)
- NSObject-SafeExpectations (0.0.6)
- OCMock (3.9.3)
- OHHTTPStubs (9.1.0):
- OHHTTPStubs/Default (= 9.1.0)
- OHHTTPStubs/Core (9.1.0)
- OHHTTPStubs/Default (9.1.0):
- OHHTTPStubs/Core
- OHHTTPStubs/JSON
- OHHTTPStubs/NSURLSession
- OHHTTPStubs/OHPathHelpers
- OHHTTPStubs/JSON (9.1.0):
- OHHTTPStubs/Core
- OHHTTPStubs/NSURLSession (9.1.0):
- OHHTTPStubs/Core
- OHHTTPStubs/OHPathHelpers (9.1.0)
- OHHTTPStubs/Swift (9.1.0):
- OHHTTPStubs/Default
- SwiftLint (0.54.0)
- UIDeviceIdentifier (2.3.0)
- WordPressShared (2.0.1)
- wpxmlrpc (0.10.0)

DEPENDENCIES:
- Alamofire (~> 5.0)
- NSObject-SafeExpectations (~> 0.0.4)
- OCMock (~> 3.4)
- OHHTTPStubs (~> 9.0)
- OHHTTPStubs/Swift (~> 9.0)
- SwiftLint (= 0.54.0)
- UIDeviceIdentifier (~> 2.0)
- WordPressShared (~> 2.0.0-beta.2)
- wpxmlrpc (~> 0.10.0)

SPEC REPOS:
trunk:
- Alamofire
- NSObject-SafeExpectations
- OCMock
- OHHTTPStubs
- SwiftLint
- UIDeviceIdentifier
- WordPressShared
- wpxmlrpc

SPEC CHECKSUMS:
Alamofire: 3ca42e259043ee0dc5c0cdd76c4bc568b8e42af7
NSObject-SafeExpectations: c01c8881cbd97efad6f668286b913cd0b7d62ab5
OCMock: 300b1b1b9155cb6378660b981c2557448830bdc6
OHHTTPStubs: 90eac6d8f2c18317baeca36698523dc67c513831
SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211
UIDeviceIdentifier: 442b65b4ff1832d4ca9c2a157815cb29ad981b17
WordPressShared: f93f99269258b46dad04f4e4dbf540ce2e5c1e66
wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd

PODFILE CHECKSUM: 64af6d71574c7a92d01a9446aa874e066917ebe5
PODFILE CHECKSUM: c0da9313733b88a1d938ba6a329dd46b895c7dea

COCOAPODS: 1.15.2
6 changes: 3 additions & 3 deletions Sources/CoreAPI/HTTPRequestBuilder.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Foundation
import wpxmlrpc
@_implementationOnly import wpxmlrpc

/// A builder type that appends HTTP request data to a URL.
///
/// Calling this class's url related functions (the ones that changes path, query, etc) does not modify the
/// original URL string. The URL will be perserved in the final result that's returned by the `build` function.
final class HTTPRequestBuilder {
enum Method: String, CaseIterable {
public final class HTTPRequestBuilder {
public enum Method: String, CaseIterable {
case get = "GET"
case post = "POST"
case put = "PUT"
Expand Down
1 change: 0 additions & 1 deletion Sources/CoreAPI/NonceRetrieval.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import WordPressShared

enum NonceRetrievalMethod {
case newPostScrap
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreAPI/WordPressAPIError.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public enum WordPressAPIError<EndpointError>: Error where EndpointError: LocalizedError {
@frozen public enum WordPressAPIError<EndpointError>: Error where EndpointError: LocalizedError {
static var unknownErrorMessage: String {
NSLocalizedString(
"wordpress-api.error.unknown",
Expand Down
Loading