Git Product home page Git Product logo

scipio's Introduction

Scipio

GitHub Workflow Status (with event) Swift 5.8 SwiftPM Documentation Platforms Xcode 14.3 Xcode 15.0 License

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

See Scipio Official Documentation for detail.

Prepare all dependencies for your application

The concept of Scipio, all dependencies wanted to be used in your application should be defined in one Package manifest.

prepare command is to build all dependencies as XCFrameworks in the manifest.

This mode is called prepare mode. See Prepare All Dependencies for Your Application for detail.

Define 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"),
            ]),
    ]
)

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.

Library Evolution support

Scipio disables to support Library Evolution feature by default.

It means built frameworks can be used only from products built with the same Swift version.

The primary reason why is Library Evolution limitation. In fact, some packages can't build with enabling Library Evolution. (https://developer.apple.com/forums/thread/123253, apple/swift-collections#94, apple/swift-nio#1257)

If you want to distribute generated XCFrameworks, it's recommended to enable Library Evolution. Pass --enable-library-evolution flag if you need. However, it means some packages can't be built.

Build Cache System

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 supports Project/Local Disk/Remote Disk cache backends.

Using a remote cache, share built XCFrameworks among developers.

See Learn the Cache System for details.

Create XCFramework from a single Swift Package

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.

See Convert Single Swift Package to XCFramework for detail.

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.

scipio's People

Contributors

giginet avatar omochi avatar mtj0928 avatar freddi-kit avatar r-plus avatar simorgh3196 avatar ldakhoa avatar ixerol avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.