Skip to content
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
28 changes: 2 additions & 26 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,11 @@ env:
IMAGE_ID: $IMAGE_ID

steps:
- label: ':react: Build React App'
command: make build REFRESH_L10N=1
plugins: &plugins
- $CI_TOOLKIT_PLUGIN
- $NVM_PLUGIN

- label: ':eslint: Lint React App'
command: make lint-js
plugins: *plugins

- label: ':javascript: Test JavaScript'
command: make test-js
plugins: *plugins

- label: ':android: Publish Android Library'
command: |
make build REFRESH_L10N=1
echo "--- :android: Publishing Android Library"
./android/gradlew -p ./android :gutenberg:prepareToPublishToS3 $(prepare_to_publish_to_s3_params) :gutenberg:publish
agents:
queue: android
plugins: *plugins

- label: ':android: Test Android Library'
command: make test-android
agents:
queue: android
plugins: *plugins

- label: ':swift: Test Swift Package'
command: swift test
# With the HTML assets in the GutenbergKitResources package and ignored by Git, we need to generated on demand for the moment
command: make build && swift test
plugins: *plugins
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ build: npm-dependencies prep-translations ## Build the project for all platforms
@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/. ./ios/Sources/GutenbergKitResources/Resources/
cp -r ./dist/. ./android/Gutenberg/src/main/assets

.PHONY: build-swift-package
Expand Down
12 changes: 11 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ let package = Package(
targets: [
.target(
name: "GutenbergKit",
dependencies: ["SwiftSoup", "SVGView"],
dependencies: [
"SwiftSoup",
"SVGView",
.target(name: "GutenbergKitResources")
],
path: "ios/Sources/GutenbergKit",
exclude: [],
resources: [.copy("Gutenberg")]
Expand All @@ -29,6 +33,12 @@ let package = Package(
resources: [
.process("Resources")
]
),

.target(
name: "GutenbergKitResources",
path: "ios/Sources/GutenbergKitResources",
resources: [.copy("Resources")]
)
]
)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Foundation

struct GutenbergKitResources {

/// Loads the Gutenberg CSS from the bundled assets.
public static func loadGutenbergCSS() -> String? {
guard let assetsURL = Bundle.module.url(forResource: "Gutenberg", withExtension: nil) else {
assertionFailure("Gutenberg resource not found in bundle")
return nil
}

let assetsDirectory = assetsURL.appendingPathComponent("assets")
guard let files = try? FileManager.default.contentsOfDirectory(at: assetsDirectory, includingPropertiesForKeys: nil),
let cssURL = files.first(where: { $0.lastPathComponent.hasPrefix("index-") && $0.lastPathComponent.hasSuffix(".css") }),
let css = try? String(contentsOf: cssURL, encoding: .utf8) else {
assertionFailure("Failed to load Gutenberg CSS from bundle")
return nil
}
return css
}
}
Loading