Skip to content
Open
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
6 changes: 5 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ steps:
plugins: *plugins

- label: ':swift: Test Swift Package'
command: swift test
depends_on: build-react
command: |
buildkite-agent artifact download dist.tar.gz .
tar -xzf dist.tar.gz
make test-swift-package
plugins: *plugins

- label: ':ios: Test iOS E2E'
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ playground.xcworkspace
.build/
.swiftpm

# Ruby tooling
vendor/bundle

# Logs
logs
*.log
Expand Down Expand Up @@ -190,8 +193,8 @@ local.properties
/android/Gutenberg/src/main/assets/index.html

# Disabled removing these files until this is published like Android in CI.
# /ios/Sources/GutenbergKit/Gutenberg/assets
# /ios/Sources/GutenbergKit/Gutenberg/index.html
# /ios/Sources/GutenbergKitResources/Gutenberg/assets
# /ios/Sources/GutenbergKitResources/Gutenberg/index.html

# Translation files
src/translations/*
Expand Down
29 changes: 20 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DEFAULT_GOAL := help

SIMULATOR_DESTINATION := platform=iOS Simulator,name=iPhone 17
SIMULATOR_DESTINATION := OS=latest,name=iPhone 17

.PHONY: help
help: ## Display this help menu
Expand All @@ -15,9 +15,10 @@ help: ## Display this help menu
define XCODEBUILD_CMD
@set -o pipefail && \
xcodebuild $(1) \
-scheme GutenbergKit \
-scheme $(2) \
-sdk iphonesimulator \
-destination '${SIMULATOR_DESTINATION}' \
CODE_SIGNING_ALLOWED=NO \
| xcbeautify
endef

Expand Down Expand Up @@ -99,16 +100,27 @@ build: npm-dependencies prep-translations ## Build the project for all platforms
echo "--- :node: Building Gutenberg"; \
npm run build; \
echo "--- :open_file_folder: Copying Build Products into place"; \
rm -rf ./ios/Sources/GutenbergKit/Gutenberg/ ./android/Gutenberg/src/main/assets/; \
cp -r ./dist/. ./ios/Sources/GutenbergKit/Gutenberg/; \
cp -r ./dist/. ./android/Gutenberg/src/main/assets; \
$(MAKE) copy-dist-ios; \
$(MAKE) copy-dist-android; \
else \
echo "--- :white_check_mark: Skipping JS build (dist already exists). Use REFRESH_JS_BUILD=1 to force refresh."; \
fi

.PHONY: copy-dist-ios
copy-dist-ios:
@rm -rf ./ios/Sources/GutenbergKitResources/Gutenberg/
@mkdir -p ./ios/Sources/GutenbergKitResources/Gutenberg
@cp -r ./dist/. ./ios/Sources/GutenbergKitResources/Gutenberg/
@touch ./ios/Sources/GutenbergKitResources/Gutenberg/.gitkeep

.PHONY: copy-dist-android
copy-dist-android:
@rm -rf ./android/Gutenberg/src/main/assets/
@cp -r ./dist/. ./android/Gutenberg/src/main/assets

.PHONY: build-swift-package
build-swift-package: build ## Build the Swift package for iOS
$(call XCODEBUILD_CMD, build)
$(call XCODEBUILD_CMD, build, GutenbergKit)

.PHONY: local-android-library
local-android-library: build ## Build the Android library to local Maven
Expand Down Expand Up @@ -215,7 +227,7 @@ test-js-watch: npm-dependencies ## Run JavaScript tests in watch mode

.PHONY: test-swift-package
test-swift-package: build ## Run Swift package tests
$(call XCODEBUILD_CMD, test)
$(call XCODEBUILD_CMD, test, GutenbergKit-Package)

.PHONY: test-ios-e2e
test-ios-e2e: ## Run iOS E2E tests against the production build
Expand All @@ -225,8 +237,7 @@ test-ios-e2e: ## Run iOS E2E tests against the production build
echo "--- :white_check_mark: Using existing build. Use 'make build REFRESH_JS_BUILD=1' to rebuild."; \
fi
@echo "--- :open_file_folder: Copying build into iOS bundle"
@rm -rf ./ios/Sources/GutenbergKit/Gutenberg/
@cp -r ./dist/. ./ios/Sources/GutenbergKit/Gutenberg/
@$(MAKE) copy-dist-ios
@echo "--- :ios: Running iOS E2E Tests (production build)"
@set -o pipefail && \
xcodebuild test \
Expand Down
54 changes: 50 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@

import PackageDescription

// Always building the resources framework from local source for the time being.
//
// We'll follow up with more automation to build and use the binary target option later on.
let resourcesMode: DependencyMode = .local

let gutenbergKitResources: Target = resourcesMode.target

// MARK: - Package

let package = Package(
name: "GutenbergKit",
platforms: [.iOS(.v17), .macOS(.v14)],
products: [
.library(name: "GutenbergKit", targets: ["GutenbergKit"])
.library(name: "GutenbergKit", targets: ["GutenbergKit"]),
.library(name: "GutenbergKitResources", targets: ["GutenbergKitResources"]),
],
dependencies: [
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.7.5"),
Expand All @@ -16,11 +26,12 @@ let package = Package(
targets: [
.target(
name: "GutenbergKit",
dependencies: ["SwiftSoup", "SVGView"],
dependencies: ["SwiftSoup", "SVGView", "GutenbergKitResources"],
path: "ios/Sources/GutenbergKit",
exclude: [],
resources: [.copy("Gutenberg")]
exclude: ["Gutenberg"],
packageAccess: false
),
gutenbergKitResources,
.testTarget(
name: "GutenbergKitTests",
dependencies: ["GutenbergKit"],
Expand All @@ -32,3 +43,38 @@ let package = Package(
)
]
)

// MARK: - Helpers

/// Controls whether `GutenbergKitResources` resolves to a local source target
/// or a pre-built XCFramework fetched from CDN.
///
/// - `.local`: Builds from local source and resources. Use during development.
/// - `.release(version:checksum:)`: Fetches a pre-built XCFramework from CDN.
/// The version and checksum are updated by CI during the release process.
///
/// Always `.local` at this point, but useful to have the infrastructure to switch already in place.
enum DependencyMode {
case local
case release(version: String, checksum: String)

var target: Target {
switch self {
case .local:
return .target(
name: "GutenbergKitResources",
path: "ios/Sources/GutenbergKitResources",
// The directory is named "Gutenberg" instead of "Resources" because
// a directory named "Resources" inside a flat .bundle confuses codesign:
// it can't distinguish iOS flat layout from macOS deep layout.
resources: [.copy("Gutenberg")]
)
case let .release(version, checksum):
return .binaryTarget(
name: "GutenbergKitResources",
url: "https://cdn.a8c-ci.services/gutenbergkit/\(version)/GutenbergKitResources.xcframework.zip",
checksum: checksum
)
}
}
}
12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/ca-Cze21B_Q.js

This file was deleted.

12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/cs-DRnnscY4.js

This file was deleted.

1 change: 0 additions & 1 deletion ios/Sources/GutenbergKit/Gutenberg/assets/da-Cfo9MW58.js

This file was deleted.

12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/de-BjSDNWt3.js

This file was deleted.

5 changes: 0 additions & 5 deletions ios/Sources/GutenbergKit/Gutenberg/assets/editor-F1M7Y6NI.js

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/it-CyNKAAqf.js

This file was deleted.

Loading
Loading