You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 11, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+14-6Lines changed: 14 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# swift-create-xcframework
2
2
3
-
`swift-create-xcframework` is a very simple tool designed to wrap `xcodebuild` and the process of creating multiple frameworks for a Swift Package and merging them into a single XCFramework.
3
+
swift-create-xcframework is a very simple tool designed to wrap `xcodebuild` and the process of creating multiple frameworks for a Swift Package and merging them into a single XCFramework.
4
4
5
5
## Usage
6
6
@@ -10,9 +10,9 @@ Inside your Swift Package folder you can just run:
10
10
swift create-xcframework
11
11
```
12
12
13
-
By default `swift-create-xcframework` will build XCFrameworks for all library products in your Package.swift, or any targets you specify on the command line (this can be for any dependencies you include as well).
13
+
By default swift-create-xcframework will build XCFrameworks for all library products in your Package.swift, or any targets you specify on the command line (this can be for any dependencies you include as well).
14
14
15
-
Then for every target or product specified, `swift-create-xcframework` will:
15
+
Then for every target or product specified, swift-create-xcframework will:
16
16
17
17
1. Generate an Xcode Project for your package (in `.build/swift-create-xcframework`).
18
18
2. Build a `.framework` for each supported platform/SDK.
@@ -42,14 +42,14 @@ var package = Package(
42
42
)
43
43
```
44
44
45
-
By default `swift-create-xcframework` will build `ExampleGenerator.xcframework` that supports: macosx, iphoneos, iphonesimulator. Additional `.library` products would be built automatically as well.
45
+
By default swift-create-xcframework will build `ExampleGenerator.xcframework` that supports: macosx, iphoneos, iphonesimulator. Additional `.library` products would be built automatically as well.
46
46
47
47
### Choosing Platforms
48
48
49
49
You can narrow down what gets built
50
50
If you omit the platforms specification, we'll build for all platforms that support Swift Binary Frameworks, which at the time of writing is just the Apple SDKs: macosx, iphoneos, iphonesimulator, watchos, watchsimulator, appletvos, appletvsimulator.
51
51
52
-
**Note:** Because only Apple's platforms are supported at this time, `swift-create-xcframework` will ignore Linux and other platforms in the Package.swift.
52
+
**Note:** Because only Apple's platforms are supported at this time, swift-create-xcframework will ignore Linux and other platforms in the Package.swift.
53
53
54
54
You can specify a subset of the platforms to build using the `--platform` option, for example:
55
55
@@ -79,6 +79,14 @@ By default it builds all top-level library products in your Package.swift.
79
79
80
80
Because of the low-friction to adding command line options with [swift-argument-parser](https://github.com/apple/swift-argument-parser), there are a number of useful command line options available, so `--help` should be your first port of call.
81
81
82
+
## Packaging for distribution
83
+
84
+
swift-create-xcframework provides a `--zip` option to automatically zip up your newly created XCFrameworks ready for upload to GitHub as a release artefact, or anywhere you choose.
85
+
86
+
If the target you are creating an XCFramework happens to be a dependency, swift-create-xcframework will look back into the package graph, locate the version that dependency resolved to, and append the version number to your zip file name. eg: `ArgumentParser-0.0.6.zip`
87
+
88
+
If the target you are creating is a product from the root package, unfortunately there is no standard way to identify the version number. For those cases you can specify one with `--zip-version`.
89
+
82
90
## Installation
83
91
84
92
You can install using mint:
@@ -95,7 +103,7 @@ cd swift-create-xcframework
95
103
make install
96
104
```
97
105
98
-
Either should pop the `swift-create-xcframework` binary into `/usr/local/bin`. And because the `swift` binary is extensible, you can then call it as a subcommand of `swift` itself:
106
+
Either should pop the swift-create-xcframework binary into `/usr/local/bin`. And because the `swift` binary is extensible, you can then call it as a subcommand of `swift` itself:
Copy file name to clipboardExpand all lines: Sources/CreateXCFramework/Command+Options.swift
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,9 @@ extension Command {
43
43
@Flag(help:"Whether to wrap the .xcframework(s) up in a versioned zip file ready for deployment")
44
44
varzip:Bool
45
45
46
+
@Option(help:ArgumentHelp("The version number to append to the name of the zip file\n\nIf the target you are packaging is a dependency, swift-create-xcframework will look into the package graph and locate the version number the dependency resolved to. As there is no standard way to specify the version inside your Swift Package, --zip-version lets you specify it manually.", valueName:"version"))
0 commit comments