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

- label: ':swift: Test Swift Package'
command: swift test
command: make test-swift-package REFRESH_L10N=1 REFRESH_JS_BUILD=1
plugins: *plugins

- label: ':ios: Test iOS E2E'
Expand Down
8 changes: 5 additions & 3 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 @@ -189,9 +192,8 @@ local.properties
/android/Gutenberg/src/main/assets/assets
/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
62 changes: 58 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,31 @@

import PackageDescription

// How releases work:
//
// On trunk, this is always `.local` — developers build from source.
// To cut a release, run `make release-on-ci NEW_VERSION=X.Y.Z`.
// That triggers a Buildkite build which:
// 1. Builds the XCFramework and computes its checksum
// 2. Runs `fastlane update_swift_package`, which rewrites this line to
// `.release(version: "X.Y.Z", checksum: "<sha256>")`
// 3. Commits the rewritten Package.swift, tags the commit, and pushes the tag
// 4. Uploads the XCFramework to S3
//
// Consumers pulling a tagged version get the `.release` binary target.
// The tag is an *output* of the release — never a trigger.
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 +36,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 +53,36 @@ 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.
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
)
}
}
}

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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.

12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/cy-Y92uX5SZ.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.

2 changes: 0 additions & 2 deletions ios/Sources/GutenbergKit/Gutenberg/assets/el-DGG3BdvZ.js

This file was deleted.

12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/en-au-DafKva9-.js

This file was deleted.

12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/en-ca-DMyUdabF.js

This file was deleted.

12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/en-gb-DmO7M5uL.js

This file was deleted.

8 changes: 0 additions & 8 deletions ios/Sources/GutenbergKit/Gutenberg/assets/en-nz-4qSPpwVd.js

This file was deleted.

8 changes: 0 additions & 8 deletions ios/Sources/GutenbergKit/Gutenberg/assets/en-za-DEN86H2e.js

This file was deleted.

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

This file was deleted.

12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/es-ar-CENgQNsN.js

This file was deleted.

12 changes: 0 additions & 12 deletions ios/Sources/GutenbergKit/Gutenberg/assets/es-cl-CzanCUJv.js

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions ios/Sources/GutenbergKit/Gutenberg/assets/fa-tDgbOSC6.js

This file was deleted.

16 changes: 0 additions & 16 deletions ios/Sources/GutenbergKit/Gutenberg/assets/fr-C-cf6WRC.js

This file was deleted.

13 changes: 0 additions & 13 deletions ios/Sources/GutenbergKit/Gutenberg/assets/gl-B2C_7IGZ.js

This file was deleted.

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

This file was deleted.

8 changes: 0 additions & 8 deletions ios/Sources/GutenbergKit/Gutenberg/assets/hr-2lPi5GVU.js

This file was deleted.

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

This file was deleted.

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

This file was deleted.

94 changes: 0 additions & 94 deletions ios/Sources/GutenbergKit/Gutenberg/assets/index-Ct2z7L49.js

This file was deleted.

Loading
Loading