sochi.toml
Every key in sochi.toml, the file that lists your project's Swift packages.
sochi.toml sits in the folder that contains your .xcodeproj or .xcworkspace. Today sochi reads only its packages section. Any other tables and comments you add are left as they are.
The Xcode project and Package.resolved stay what Xcode reads. sochi.toml is the readable version you edit and review, and sochi keeps the two in step. See Swift packages.
Example
Section titled “Example”# sochi.toml: your project's packages, kept in sync with the Xcode project by sochi.# Edit it by hand or with `sochi add package`; Package.resolved stays the lockfile.
[packages.swift-dependencies]url = "https://github.com/pointfreeco/swift-dependencies"from = "1.17.1"products = { App = ["Dependencies"], Forecast = ["Dependencies"] }
[packages.swift-collections]url = "https://github.com/apple/swift-collections"exact = "1.1.4"products = { App = ["OrderedCollections"] }
[packages.mykit]path = "../MyKit"products = { App = ["MyKit"] }Package names
Section titled “Package names”Each package is keyed by its identity: the last part of its URL or folder, in lowercase, without .git. https://github.com/apple/swift-collections.git is swift-collections. This is the name sochi packages, sochi update and sochi remove package use.
| Key | Type | Meaning |
|---|---|---|
url |
string | The repository URL. Required unless path is set. |
path |
string | A local package folder, relative to the project folder. Used instead of url if both are set. |
from |
string | Up to the next major version from this one. Xcode’s default, and what sochi writes when you don’t choose a rule. |
minor |
string | Up to the next minor version from this one. |
exact |
string | Exactly this version. |
range |
string | A version range, written "1.0.0..<2.0.0". |
branch |
string | The latest commit on this branch. |
revision |
string | This exact commit. |
products |
table | Each target’s name mapped to the list of products it links. |
A url package needs exactly one of from, minor, exact, range, branch or revision. A path package doesn’t take a rule.
Inline form
Section titled “Inline form”sochi writes one table per package, but it also reads packages written inline under [packages], and keeps them inline when it updates them:
[packages]swift-algorithms = { url = "https://github.com/apple/swift-algorithms", range = "1.0.0..<2.0.0", products = { App = ["Algorithms"] } }swift-markdown = { url = "https://github.com/swiftlang/swift-markdown", branch = "main", products = { App = ["Markdown"] } }Supported TOML
Section titled “Supported TOML”sochi reads tables, dotted keys, bare and quoted keys, basic and literal strings, integers, booleans, arrays (including multi-line), inline tables and # comments.
It rejects floats, dates, multi-line strings, arrays of tables ([[x]]) and duplicate keys with an error, rather than misreading them.
Errors
Section titled “Errors”Mistakes are reported with the line number and the key:
sochi.toml line 7: packages.swift-collections: needs one of from, minor, exact, range, branch, revisionThe possible problems are:
- The entry isn’t a table.
- It has neither
urlnorpath. - It has no version rule.
- A
rangeisn’t in the"1.0.0..<2.0.0"form. productsisn’t lists of names.