• Stars
    star
    455
  • Rank 96,175 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 2 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A new build tool to generate XCFramework

Scipio

⚠️ This project is currently under development. Please moment until a stable release. Of-course, feedbacks and pull requests are welcome.

Carthago delenda est

Scipio proposes a new workflow to integrate dependencies into your applications.

This product is highly inspired by Carthage and swift-create-xcframework.

Abstract

SwiftPM is the best way to integrate dependencies into your app. However, build artifacts built by Xcode are difficult to cache.

On the other hand, XCFramework is a good way to keep binaries portable.

Scipio provides a new hybrid way to manage dependencies.

First, use SwiftPM to resolve dependencies and checkout repositories. After that, this tool converts each dependency into XCFramework.

Usage

Prepare all dependencies for your application.

1. Create a new Swift Package to describe dependencies

$ cd path/to/MyAppDependencies
$ swift package init

2. Edit Package.swift to describe your application's dependencies

// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "MyAppDependencies",
    platforms: [
        // Specify platforms to build
        .iOS(.v14),
    ],
    products: [],
    dependencies: [
        // Add dependencies
        .package(url: "https://github.com/onevcat/APNGKit.git", exact: "2.2.1"),
    ],
    targets: [
        .target(
            name: "MyAppDependency",
            dependencies: [
                // List all dependencies to build
                .product(name: "APNGKit", package: "APNGKit"),
            ]),
    ]
)

3. Run prepare command

$ scipio prepare path/to/MyAppDependencies
> 🔁 Resolving Dependencies...
> 🗑️ Cleaning MyAppDependencies...
> 📦 Building APNGKit for iOS
> 🚀 Combining into XCFramework...
> 📦 Building Delegate for iOS
> 🚀 Combining into XCFramework...
> ❇️ Succeeded.

All XCFrameworks are generated into MyAppDependencies/XCFramework by default.

Options

Flag Description Default
--configuration, -c Build configuration for generated frameworks (debug / release) release
--output, -o Path indicates a XCFrameworks output directory $PACKAGE_ROOT/XCFrameworks
--embed-debug-symbols Whether embed debug symbols to frameworks or not -
--static Whether generated frameworks are Static Frameworks or not -
--support-simulators Whether also building for simulators of each SDKs or not -
--cache-policy How to reuse built frameworks project
--disable-library-evolution Whether to enable Library Evolution feature or not -

See --help for details.

Library Evolution support

Scipio enables Library Evolution feature by default.

It means built frameworks always keep compatibility even if linked from products built in other Swift versions. (ABI stability)

However, as known, some packages doesn't support Library Evolution or there are issues to generate swiftinterface. (https://developer.apple.com/forums/thread/123253)

You can disable Library Evolution with --disable-library-evolution flag if you need.

Build cache

By default, Scipio checks whether re-building is required or not for existing XCFrameworks.

$ swift run scipio prepare --cache-policy project path/to/MyAppDependencies
> 🔁 Resolving Dependencies...
> 🗑️ Cleaning MyAppDependency...
> ✅ Valid APNGKit.xcframework is exists. Skip building.
> ✅ Valid Delegate.xcframework is exists. Skip building.
> ❇️ Succeeded.

Scipio generates VersionFile to describe built framework details within building XCFrameworks.

VersionFile contains the following information:

  • Revision
    • Revision of packages. If resolved versions are updated, they may change.
  • Build Options
    • Build options built with.
  • Compiler Version
    • Xcode or Swift compiler version.

They are stored on $OUTPUT_DIR/.$FRAMEWORK_NAME.version as a JSON file.

{
  "buildOptions" : {
    "buildConfiguration" : "release",
    "isDebugSymbolsEmbedded" : false,
    "frameworkType" : "dynamic",
    "sdks" : [
      "iOS"
    ],
    "isSimulatorSupported" : false
  },
  "targetName" : "APNGKit",
  "clangVersion" : "clang-1400.0.29.102",
  "pin" : {
    "version" : "2.2.1",
    "revision" : "f1807697d455b258cae7522b939372b4652437c1"
  }
}

If they are changed, Spicio regards them as a cache are invalid, and then it's re-built.

Cache Policy

You can specify cache behavior with --cache-policy option. Default value is project.

disabled

Never reuse already built frameworks. Overwrite existing frameworks everytime.

project(default)

VersionFiles are stored in output directories. Skip re-building when existing XCFramework is valid.

local

Copy every build artifacts to ~/Library/Caches. If there are same binaries are exists in cache directory, skip re-building and copy them to the output directory.

Thanks to this strategy, you can reuse built artifacts in past.

Create XCFramework for single Swift Packages

Scipio also can generate XCFrameworks from a specific Swift Package. This feature is similar to swift-create-xcframework.

$ scipio create path/to/MyPackage
> 🔁 Resolving Dependencies...
> 🗑️ Cleaning MyPackage...
> 📦 Building MyPackage for iOS
> 🚀 Combining into XCFramework...
> ❇️ Succeeded.

Reliability

Scipio only builts with standard dependencies and Apple official tools to keep reliability.

How to resolve dependencies

Just run swift package resolve.

How to parse package manifests and generate Xcode projects

Scipio depends on swift-package-manager as a library.

Parsing package manifests and generating Xcode project is provided from the package. So it will be maintained in the future.

How to build XCFrameworks

Scipio only uses xcodebuild to build Frameworks and XCFrameworks.

Why Scipio

Scipio names after a historical story about Carthage.

More Repositories

1

Crossroad

🚍 Route URL schemes easily
Swift
417
star
2

xcprofiler

📈 CLI to profile compilation time of Swift project
Ruby
332
star
3

RxSpriteKit

👾 Reactive Extensions for SpriteKit
Swift
132
star
4

Toybox

🧸 Xcode Playground management made easy
Swift
130
star
5

NESEmulator-watchOS

👾 ⌚ NES Emulator on Apple Watch
Swift
122
star
6

Peafowl

🀄 Play Japanese Mahjong in Swift
Swift
91
star
7

SimRecorder

GIF Recorder for iOS Simulator
Swift
74
star
8

MinSwift-workshop

♻️ minimum Swift compiler written in Swift
Swift
55
star
9

danger-xcprofiler

🚫 danger plugin for asserting Swift compilation time
Ruby
52
star
10

Wormhole

🐛 Wormhole invites you to the fastest trip to AppStore Connect. (NOT STABLE)
Swift
38
star
11

Milepost

🚥 SwiftPM Build Plugin to show Git info on your app
Swift
34
star
12

KawazBuster

かわずたんたたき! for iPhone
Objective-C
25
star
13

FCEUX-watchOS

👾 ⌚ Play NES on watchOS
C++
21
star
14

CustomKeyboardTextField

Provides easy way to make type safety TextField with custom keyboards
Swift
20
star
15

NibLoaderKit

Tiny utility to load UIView/NSView from nibs
Swift
15
star
16

castle

🏰 All my dotfile are belong to us. BUT MY CREDENTIALS ARE IN ANOTHER CASTLE.
Vim Script
15
star
17

JSONMatcher

A JSON matcher extension in Swift for Nimble
Swift
14
star
18

xcode-opener

Open Xcode project by context
Shell
13
star
19

alfred-autojump-workflow

Alfred 2 workflow to provide you a faster way to navigate your filesystem via autojump
Python
12
star
20

KawazCatch

C++
10
star
21

aws-lambda-swift-runtime

Swift
10
star
22

RubyJang

るびじゃん!〜Rubyで麻雀実装してみた〜
Ruby
10
star
23

CCSocialShare

Ultimate SNS adapter for cocos2d-x
Java
10
star
24

beddit-python

API Client for Beddit Sleep Tracker 😴
Python
10
star
25

KawazJet

C++
9
star
26

django-debug-toolbar-vcs-info

Add VCS info onto your django-debug-toolbar
Python
8
star
27

dqx_helper

useful tool collection for DragonQuest X
Python
8
star
28

alfred-ghq-workflow

Search and get repository on GHQ via Alfred
Python
7
star
29

Jubiol

Jubiol is new type shooting game written in CoffeeScript.
CoffeeScript
6
star
30

swift-evolution-gpt

Python
5
star
31

RikoBuster

Swift
5
star
32

peco-anyenv

Switch interpreter versions interactively with fooenv(rbenv, pyenv and others) + peco
Shell
5
star
33

django-slack-invitation

Automatic invitation to Slack team
Python
5
star
34

Kaleidscope-cpp

C++
4
star
35

fastlane-plugin-influxdb

fastlane plugin to post to InfluxDB
Ruby
4
star
36

MachiMatch

新感覚アクションパズルゲー!
Python
4
star
37

jquery-3dsmenu

jQuery plugin for listing like Nintendo 3DS home menu.
JavaScript
4
star
38

Heqet

Heqet is an useful utility collection for game development on Kobold2D.
Objective-C
4
star
39

modern-gb

C
3
star
40

KawazCrash

C++
3
star
41

BrushRush

Rush the doodle by your Brush
Objective-C
3
star
42

Hatena-Bookmark-for-Safari

Safari Extention
JavaScript
3
star
43

ribbit

ribbit is the perfect collaboration tool for all creators.
Python
2
star
44

scipio-s3-storage

Scipio cache storage backend for AWS S3
Swift
2
star
45

pokedex-legacy

Python
2
star
46

docker-gbdk

👾 🐳 Docker image to build Gameboy ROMs with GBDK.
Dockerfile
2
star
47

XI

XI[sai] Clone on Unity3D in Boo
C#
2
star
48

Sockwaz

Sockwaz is live tweet viewer written in CoffeeScript.
CoffeeScript
2
star
49

SantaRochka

Sample Game for GGJ12 on Kobold2D
Objective-C
2
star
50

denops-deckset.vim

Vim/Neovim plugin which enpowers editing Deckset slides
TypeScript
2
star
51

gb-sprite-generator

My first Rust execise.
Rust
2
star
52

UDON-for-iPhone

iPhone習作。UDONを移植してみた。
Objective-C
2
star
53

LoopyLooper

Objective-C
2
star
54

libjwt-swift

Swift modulemaps for libjwt
Swift
2
star
55

django-thumbnailfield

An ImageField with auto thumbnail generation for Django.
2
star
56

RentalDayNotifier

レンタルの返却日を通知します
Objective-C
2
star
57

AutomationTestDemo

This is a demo project for ui testing with TuneupJS
JavaScript
2
star
58

django-star

django plugin
Python
1
star
59

SoukobanSolver

倉庫番解くよ!
Java
1
star
60

Tekitirs

An old-style shooting game on Unity
Boo
1
star
61

Fortress

スタイリッシュ落城ストラテジー!
Objective-C
1
star
62

ComplexNetwork

情報工学実験Ⅱ第2回課題
Java
1
star
63

CCADX2Manager

C++
1
star
64

iGEM-Wiki

JavaScript
1
star
65

MyList

はてな課題2
Perl
1
star
66

experiments

課題用
C++
1
star
67

alfred-irkit-workflow

Alfred workflow to send signal for IRKit.
Python
1
star
68

CCMessageWindow

Message Window node for cocos2d-x
C++
1
star
69

kwing.coffee

useful utils for game developing via Kawaz. It extends enchant.js
CoffeeScript
1
star
70

9leapShooting

9leapハッカソン用
JavaScript
1
star
71

Cockatrice

新感覚パズルゲーム
Python
1
star
72

NazoShooting

2010年4月の春のゲーム祭りで開発したシューティングゲーです
Ruby
1
star
73

BeatleFlick

A beat'll flick the beetles.
Objective-C
1
star
74

expeiment3

実験その3
R
1
star
75

LeDA

Level Design Assistant System via Crowdsourcing
Python
1
star
76

PatternMatch

情報工学実験Ⅰの課題です
Python
1
star
77

TwitterClone

はてな課題3
Perl
1
star
78

jquery.pingboard.js

生存戦略しましょうか
CoffeeScript
1
star
79

gbdev-tools

Python
1
star
80

cocos2d-html5-demo

JavaScript
1
star
81

VirusSimulator

情報工学演習Ⅱの課題
Java
1
star
82

Kwing4Py

Kwing is not Geek!
1
star
83

gl.enchant.js

CoffeeScript
1
star
84

GCControllerWrapper

GameController.framework for C++
C
1
star
85

Kukuri

Kukuri is a PatternMatching Engine for iPad via OpenCV.
C++
1
star
86

RailDesigner

C++
1
star
87

Barca

⚡Barca hastens Carthage packages like lightning.
Swift
1
star
88

Flamesc

けしからんゲームです
Python
1
star
89

ElmsAutoLoginSafariExtension

auto login to ELMS
JavaScript
1
star
90

DanketsuTrokko-kun

This is a demo project of P2P amount multiple devices via GKSession on Kobold2D
Objective-C
1
star
91

FormationPuzzle

Python
1
star