Skip to content

Commit 74cd0d3

Browse files
author
Carlos Cabanero
committed
GH workflow for Xcframework
1 parent c191bbe commit 74cd0d3

File tree

15 files changed

+113
-35
lines changed

15 files changed

+113
-35
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

.github/workflows/build.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI
2+
3+
# On workflows change, while we test.
4+
# Run the script (add Downloads to frameworks)
5+
# Create release, etc...
6+
7+
on:
8+
push:
9+
branches:
10+
- 'workflows*'
11+
tags:
12+
- 'v*'
13+
14+
jobs:
15+
build:
16+
name: Building release assets
17+
runs-on: macOS-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: xcode-select
23+
run: sudo xcode-select -s /Applications/Xcode.app
24+
25+
- name: Delete release notes
26+
run: rm -f .build/release.md
27+
28+
- name: Run build
29+
run: swift run
30+
31+
- name: Create Release
32+
id: create_release
33+
uses: actions/create-release@v1
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
tag_name: ${{ github.ref }}
38+
release_name: Release ${{ github.ref }}
39+
body_path: release.md
40+
draft: false
41+
prerelease: false
42+
43+
- name: Upload vim Xcframework
44+
id: upload-release-vim-xcframework-zip
45+
uses: actions/upload-release-asset@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
upload_url: ${{ steps.create_release.outputs.upload_url }}
50+
asset_path: ./vim.xcframework.zip
51+
asset_name: vim.xcframework.zip
52+
asset_content_type: application/zip
53+
54+
- name: Upload xxd Xcframework
55+
id: upload-release-xxd-xcframework-zip
56+
uses: actions/upload-release-asset@v1
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
upload_url: ${{ steps.create_release.outputs.upload_url }}
61+
asset_path: ./xxd.xcframework.zip
62+
asset_name: xxd.xcframework.zip
63+
asset_content_type: application/zip

Package.swift

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
// swift-tools-version:5.3
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
23

34
import PackageDescription
45

56
let package = Package(
6-
name: "vim",
7-
products: [
8-
.library(name: "vim", targets: ["vim"])
9-
],
10-
dependencies: [
11-
],
12-
targets: [
13-
.binaryTarget(
14-
name: "vim",
15-
url: "https://github.com/holzschu/vim/releases/download/ios_1.0/vim.xcframework.zip",
16-
checksum: "02acb74bec3e6b4ba9c120873a19a770773e3c3e2d141365808a9342ddf41fe7"
17-
),
18-
.binaryTarget(
19-
name: "xxd",
20-
url: "https://github.com/holzschu/vim/releases/download/ios_1.0/xxd.xcframework.zip",
21-
checksum: "1c48b9f77310b71499a7bd76a16882405c8a81b55f56c7c7577ae2a0ce347ba6"
22-
)
23-
]
7+
name: "vim",
8+
platforms: [.macOS("11")],
9+
dependencies: [
10+
.package(url: "https://github.com/blinksh/FMake", from : "0.0.16"),
11+
// .package(path: "../FMake")
12+
],
13+
targets: [
14+
// Targets are the basic building blocks of a package, defining a module or a test suite.
15+
// Targets can depend on other targets in this package and products from dependencies.
16+
.target(
17+
name: "vim",
18+
dependencies: ["FMake"]),
19+
]
2420
)

Sources/vim/main.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import FMake
2+
import Foundation
3+
4+
OutputLevel.default = .error
5+
6+
try? sh("./get_frameworks.sh")
7+
try? sh("./build_vim_xcframework.sh")
8+
9+
let vimXcframeworkZipName = "vim.xcframework.zip"
10+
let xxdXcframeworkZipName = "xxd.xcframework.zip"
11+
12+
let releaseMD =
13+
"""
14+
| File | SHA256 |
15+
| ----------------------------- |:--------------------------------------------:|
16+
| \(vimXcframeworkZipName) | \(try sha(path: vimXcframeworkZipName)) |
17+
| \(xxdXcframeworkZipName) | \(try sha(path: xxdXcframeworkZipName)) |
18+
"""
19+
20+
try write(content: releaseMD, atPath: "release.md")

build_vim_xcframework.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ SIM_SDKROOT=$(xcrun --sdk iphonesimulator --show-sdk-path)
99

1010
echo "Building for iOS:"
1111
FRAMEWORKS=$PWD/Frameworks_iOS
12-
# rm Frameworks
13-
# ln -s Frameworks Frameworks_iOS
12+
mkdir -p $FRAMEWORKS
13+
rm $FRAMEWORKS/ios_system.framework
14+
ln -s $PWD/Frameworks/ios_system.xcframework/ios-arm64/ios_system.framework $FRAMEWORKS/ios_system.framework
1415

1516
make distclean
1617
# 1) configure
@@ -50,11 +51,11 @@ signature=${framework//_/-}
5051
plutil -replace CFBundleIdentifier -string Nicolas-Holzschuch.$signature $FRAMEWORKS/$framework.framework/Info.plist
5152
install_name_tool -id @rpath/$framework.framework/$framework $FRAMEWORKS/$framework.framework/$framework
5253

53-
5454
echo "Building for Simulator:"
5555
FRAMEWORKS=$PWD/Frameworks_Simulator
56-
# rm Frameworks
57-
# ln -s Frameworks Frameworks_Simulator
56+
mkdir -p $FRAMEWORKS
57+
rm $FRAMEWORKS/ios_system.framework
58+
ln -s $PWD/Frameworks/ios_system.xcframework/ios-arm64_x86_64-simulator/ios_system.framework $FRAMEWORKS/ios_system.framework
5859

5960
make distclean
6061
# --disable-channel

get_frameworks.sh

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
#!/bin/bash
22

3-
IOS_SYSTEM_VER="2.4"
4-
5-
HHROOT="https://github.com/holzschu"
6-
73
mkdir -p "${BASH_SOURCE%/*}/Frameworks"
84

95
(cd "${BASH_SOURCE%/*}/Frameworks"
10-
# ios_system
6+
# ios_system - Blink only depends on ios_system, as it doesn't include lua or python, etc...
117
echo "Downloading Frameworks:"
12-
curl -OL $HHROOT/ios_system/releases/download/v$IOS_SYSTEM_VER/release.tar.gz
13-
( tar -xzf release.tar.gz --strip 1 && rm release.tar.gz ) || { echo "ios_system failed to download"; exit 1; }
14-
)
15-
16-
(cd "${BASH_SOURCE%/*}/src/"
17-
# ios_error.h
18-
curl -OL $HHROOT/ios_system/releases/download/v$IOS_SYSTEM_VER/ios_error.h
8+
curl -OL https://github.com/holzschu/ios_system/releases/download/v3.0.3/ios_system.xcframework.zip
9+
sha=$( shasum -a 256 ios_system.xcframework.zip | cut -d' ' -f1 )
10+
[[ "$sha" == "50f1692873e73fd862f45f73f2c08745e822c01ff5e0a0e0aec7fed6bb946e7f" ]] && echo "sha matches" || exit 1
11+
unzip ios_system.xcframework.zip && rm ios_system.xcframework.zip
1912
)
2013

14+
# Commented. Made part of the repo to simplify Blink customization
15+
# (cd "${BASH_SOURCE%/*}/src/"
16+
# # ios_error.h
17+
# curl -OL $HHROOT/ios_system/releases/download/v$IOS_SYSTEM_VER/ios_error.h
18+
# )

0 commit comments

Comments
 (0)