Compare commits

..

251 Commits

280 changed files with 27329 additions and 12365 deletions
+8
View File
@@ -0,0 +1,8 @@
*
!/Package.swift
!/Package.resolved
!/Sources
!/Tests
!/Linux
/Linux/packages
/Linux/staging
+37
View File
@@ -0,0 +1,37 @@
---
name: Bug report
about: Report a bug
title: ''
labels: bug
assignees: ''
---
## Description
A clear and concise description of what the bug is.
## Environment
Please provide as much of the following information as is relevant.
Host OS (macOS/Linux/WSL):
Host OS version:
<!-- macOS: Apple Logo > About this Mac -->
<!-- Linux: -->
<!-- cat /etc/*-release -->
<!-- Windows: -->
<!-- Get-WinVer; wsl -l -v -->
iOS device version:
<!-- Settings > General > About > iOS Version -->
Swift version:
<!-- swift --version -->
SDK version:
<!-- macOS: -->
<!-- xcodebuild -version; xcrun -sdk iphoneos -show-sdk-version -->
<!-- Linux/WSL: -->
<!-- swift sdk configure darwin arm64-apple-ios --show-configuration | grep -o 'iPhoneOS[0-9.]*\.sdk$' -->
+10
View File
@@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea
title: ''
labels: enhancement
assignees: ''
---
+17
View File
@@ -0,0 +1,17 @@
## What does this PR do?
<!-- Focus on *what* the PR does in essence. The *how* should come second, if it's relevant. -->
## How was it tested?
<!-- e.g. Ran locally on macOS and added unit tests -->
## AI tool usage
How much of this PR was AI-assisted? (check one)
- [ ] **0** - No AI was used to write code
- [ ] **1** - I was assisted by AI. I reviewed the finished result.
- [ ] **2** - I set the AI going and left it to it; nobody has read the result - no review, or AI review only
<!-- If an AI agent is filling this in: declare the level honestly, and open as a draft if it is #2. Do not lower the declared level to get the PR reviewed. -->
@@ -0,0 +1,9 @@
name: 'Configure Xcode'
description: 'Set up Xcode version'
runs:
using: composite
steps:
- name: Set up Xcode
shell: bash
run: |
sudo xcode-select -s /Applications/Xcode_26.4.app
-20
View File
@@ -1,20 +0,0 @@
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: |
docker compose run --build --rm supersign -c Linux/build.sh
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
Linux/packages/Supersign.AppImage
+53
View File
@@ -0,0 +1,53 @@
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
XTL_CI: "1"
jobs:
build-linux:
strategy:
fail-fast: false
matrix:
host:
- runner: ubuntu-24.04
arch: x86_64
- runner: ubuntu-24.04-arm
arch: aarch64
runs-on: ${{ matrix.host.runner }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build and test
run: |
docker compose run --build -e XTL_CI=1 xtool bash -c \
"swift build --product xtool && .build/debug/xtool --help && swift test"
build-macos:
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: ./.github/actions/configure-xcode
- name: Build
run: |
swift build --product xtool && .build/debug/xtool --help
- name: Run tests
run: |
swift test
build-ios:
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: ./.github/actions/configure-xcode
- name: Build
run: |
set -o pipefail \
&& xcodebuild build \
-skipMacroValidation -skipPackagePluginValidation \
-scheme XKit -destination generic/platform=iOS \
| xcbeautify
+18
View File
@@ -0,0 +1,18 @@
on:
push:
branches:
- main
pull_request:
concurrency:
group: integration-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
integration-test-linux:
# https://github.com/xtool-org/mac-actions-runner
runs-on: ubuntu-on-macos
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run integration tests
run: |
./integration-tests/run.sh
+108
View File
@@ -0,0 +1,108 @@
on:
push:
tags:
- "*"
env:
XTL_CI: "1"
jobs:
build-linux:
strategy:
fail-fast: false
matrix:
host:
- runner: ubuntu-24.04
arch: x86_64
- runner: ubuntu-24.04-arm
arch: aarch64
runs-on: ${{ matrix.host.runner }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build
run: |
docker compose run --build \
-e XTOOL_VERSION=${{ github.ref_name }} \
-e XTL_CI=1 \
--rm xtool Linux/build.sh
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: xtool-${{ matrix.host.arch }}
path: |
Linux/packages/xtool-${{ matrix.host.arch }}.AppImage
Linux/packages/xtool-${{ matrix.host.arch }}.AppImage.zsync
build-mac:
runs-on: macos-26
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: ./.github/actions/configure-xcode
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: macOS
bundler-cache: true
- name: Build
env:
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }}
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }}
IDENTITY_P12: ${{ secrets.IDENTITY_P12 }}
DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM }}
XTOOL_VERSION: ${{ github.ref_name }}
run: |
cd macOS
bundle exec fastlane package
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: xtool-mac
path: |
macOS/Build/Output/xtool.app.zip
macOS/Build/Output/xtool.app.dSYM.zip
release:
needs: [build-linux, build-mac]
runs-on: ubuntu-24.04
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v6
- name: Download artifact
uses: actions/download-artifact@v8
with:
pattern: xtool-*
path: output
- name: Create and publish release
run: |
TAG="${{ github.ref_name }}"
gh release create "$TAG" --draft --title "v$TAG"
gh release upload "$TAG" output/**/*.{AppImage,AppImage.zsync,app.zip,app.dSYM.zip}
docker:
uses: docker/github-builder/.github/workflows/build.yml@v1
permissions:
contents: read # to fetch the repository content
id-token: write # for signing attestations and cache entries with GitHub OIDC
packages: write # to push built images to GitHub Container Registry
with:
build-args: |
XTL_CI=1
output: image
push: true
platforms: linux/amd64,linux/arm64
meta-images: |
ghcr.io/xtool-org/xtool
meta-tags: |
type=semver,pattern={{version}}
secrets:
registry-auths: |
- registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
+19
View File
@@ -0,0 +1,19 @@
on:
push:
branches:
- main
pull_request:
paths:
- '.github/workflows/swiftlint.yml'
- '.swiftlint.yml'
- '**/*.swift'
jobs:
swiftlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Lint
run: |
make lint SWIFTLINT_FLAGS='--reporter=github-actions-logging' | tee swiftlint.log
# fail if there are any errors or warnings
! grep -Eq '^::(error|warning)' swiftlint.log
+5 -3
View File
@@ -1,5 +1,5 @@
/Tests/SupersignTests/config/*
!/Tests/SupersignTests/config/config-template.json
/Tests/XKitTests/config/*
!/Tests/XKitTests/config/config-template.json
*.ipa
.DS_Store
/.build
@@ -9,5 +9,7 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
.docc-build
/openapi.json
/openapi
/.tmp
+73
View File
@@ -0,0 +1,73 @@
swiftlint_version: 0.59.1
disabled_rules:
- trailing_comma
- nesting
- fallthrough
- shorthand_operator
- todo
- large_tuple
- identifier_name
- type_name
- unneeded_override
- optional_data_string_conversion
- for_where
- blanket_disable_command
opt_in_rules:
- closure_end_indentation
- closure_spacing
- empty_count
- explicit_init
- fatal_error_message
- first_where
- implicit_return
- joined_default_parameter
- literal_expression_end_indentation
- overridden_super_call
- prohibited_super_call
- sorted_first_last
- unneeded_parentheses_in_closure_argument
- vertical_parameter_alignment_on_call
- yoda_condition
- nslocalizedstring_key
- unused_setter_value
- optional_enum_case_matching
- prefer_self_type_over_type_of_self
- contains_over_range_nil_comparison
- flatmap_over_map_reduce
- empty_collection_literal
- contains_over_first_not_nil
- contains_over_filter_count
- contains_over_filter_is_empty
- reduce_into
analyzer_rules:
- unused_import
custom_rules:
spaces_not_tabs:
name: "Spaces not Tabs"
regex: ^\t
message: "Use four spaces, not tabs"
point_zero:
name: "Point Zero"
regex: '(?<!iOS\s)(?<!macOS\s)(?<!\.)\b[\d_]+\.0\b'
match_kinds:
- number
- attribute.builtin
message: "Don't add a .0 to the end of floating point literals"
force_try: warning
force_cast: warning
function_body_length: 100
line_length: 135
file_length: 1000
type_body_length: 500
cyclomatic_complexity: 12
function_parameter_count: 7
implicit_return:
included:
- closure
included:
- Package.swift
- Sources
- Tests
- macOS/XToolMac
excluded:
- Sources/DeveloperAPI/Generated
@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Supersign"
BuildableName = "Supersign"
BlueprintName = "Supersign"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Supersign"
BuildableName = "Supersign"
BlueprintName = "Supersign"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+1
View File
@@ -0,0 +1 @@
/launch.json
+6
View File
@@ -0,0 +1,6 @@
{
"recommendations": [
"swiftlang.swift-vscode",
"vknabel.vscode-swiftlint",
]
}
+13
View File
@@ -0,0 +1,13 @@
{
"swiftlint.path": "./.tmp/swiftlint/swiftlint",
"files.watcherExclude":{
"*/.git/**": true,
"*/.build/**": true,
"*/.tmp/**": true,
},
"search.exclude": {
"*/.git/**": true,
"*/.build/**": true,
"*/.tmp/**": true,
}
}
+16
View File
@@ -0,0 +1,16 @@
# About
xtool is a cross-platform replacement for Xcode (including build system, provisioning, deployment).
The `xtool` CLI supports macOS, Linux, WSL. The lower-level XKit (provisioning and device interaction) library additionally supports iOS.
## Development
- The majority of the code is in the Swift Package. You can use `swift build` / `swift test` / etc for iteration.
- Caveat: on macOS, xtool is distributed as an app bundle (allows entitlements like Keychain). To build the Mac app, use `make mac`. You can then invoke the CLI at `./macOS/Build/xtool`.
- Make sure to run `make lint` (swiftlint) when you're done
## Conventions
- Use modern Swift 6. Strict concurrency is enabled.
- Use swift-dependencies for Dependency Injection. Passing dependencies around as arguments is an anti-pattern.
+1
View File
@@ -0,0 +1 @@
@AGENTS.md
+128
View File
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
conduct@xtool.sh.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
+18
View File
@@ -0,0 +1,18 @@
# Contributing to xtool
## Bug reports and feature requests
We welcome all bug reports and feature requests! Please create a [new issue](https://github.com/xtool-org/xtool/issues/new/choose) via GitHub.
## Code and documentation
External contributions are very welcome. Take a look at [/Documentation/Contributing/README.md](/Documentation/Contributing/README.md) for details regarding the development process.
## AI tool usage
You may use AI tools to assist your contributions. You are fully responsible
for everything you submit.
- **Understand it**: You must be able to explain every line of your code.
- **Disclose it**: Pick an AI assistance level (0/1/2) in the PR template.
- **Own it**: You are the author. If a reviewer asks "why?", you answer - not the AI. [Don't be a meat proxy.](https://dontbeameatproxy.com)
+61 -52
View File
@@ -1,7 +1,7 @@
# Note: We use 20.04 since AppImage recommends building on the
# Note: We use 22.04 since AppImage recommends building on the
# oldest configuration that you support
FROM ubuntu:focal AS limd-build
FROM swift:6.3-jammy AS build-base
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -16,78 +16,63 @@ RUN apt-get update \
pkg-config \
libxml2 \
curl libcurl4-openssl-dev \
zip unzip \
liblzma-dev zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /prefix
RUN curl -fsS https://dlang.org/install.sh | bash -s ldc
FROM build-base AS build-limd
RUN git clone https://github.com/libimobiledevice/libplist.git \
&& cd libplist \
RUN mkdir -p /prefix
ADD --keep-git-dir=true https://github.com/libimobiledevice/libplist.git#2.6.0 /libplist
RUN cd libplist \
&& ./autogen.sh --prefix /usr --without-cython \
&& make \
&& make install \
&& make install DESTDIR=/prefix \
&& cd .. \
&& rm -rf libplist
&& make install DESTDIR=/prefix
RUN git clone https://github.com/libimobiledevice/libimobiledevice-glue.git \
&& cd libimobiledevice-glue \
ADD --keep-git-dir=true https://github.com/libimobiledevice/libimobiledevice-glue.git#1.3.1 /libimobiledevice-glue
RUN cd libimobiledevice-glue \
&& ./autogen.sh --prefix /usr \
&& make \
&& make install \
&& make install DESTDIR=/prefix \
&& cd .. \
&& rm -rf libimobiledevice-glue
&& make install DESTDIR=/prefix
RUN git clone https://github.com/libimobiledevice/libusbmuxd.git \
&& cd libusbmuxd \
ADD --keep-git-dir=true https://github.com/libimobiledevice/libusbmuxd.git#2.1.0 /libusbmuxd
RUN cd libusbmuxd \
&& ./autogen.sh --prefix /usr \
&& make \
&& make install \
&& make install DESTDIR=/prefix \
&& cd .. \
&& rm -rf libusbmuxd
&& make install DESTDIR=/prefix
RUN git clone https://github.com/libimobiledevice/libtatsu.git \
&& cd libtatsu \
ADD --keep-git-dir=true https://github.com/libimobiledevice/libtatsu.git#1.0.4 /libtatsu
RUN cd libtatsu \
&& ./autogen.sh --prefix /usr \
&& make \
&& make install \
&& make install DESTDIR=/prefix \
&& cd .. \
&& rm -rf libtatsu
&& make install DESTDIR=/prefix
RUN git clone https://github.com/libimobiledevice/libimobiledevice.git \
&& cd libimobiledevice \
&& ./autogen.sh --prefix /usr --without-cython --enable-debug \
ADD --keep-git-dir=true https://github.com/libimobiledevice/libimobiledevice.git#master /libimobiledevice
RUN cd libimobiledevice \
&& ./autogen.sh --prefix /usr --without-cython \
&& make \
&& make install \
&& make install DESTDIR=/prefix \
&& cd .. \
&& rm -rf libimobiledevice
ADD https://api.github.com/repos/SuperchargeApp/SupersetteD/git/refs/heads/main Supersette-version.json
RUN git clone https://github.com/SuperchargeApp/SupersetteD.git \
&& cd SupersetteD \
&& /bin/bash -c 'source $(/root/dlang/install.sh ldc -a) && dub build --build=release' \
&& cp -r bin/libsupersette.so /prefix/usr/lib/libsupersette.so \
&& cd .. \
&& rm -rf SupersetteD
FROM swift:6.0-focal
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libssl-dev \
ca-certificates \
zip unzip \
&& rm -rf /var/lib/apt/lists/*
&& make install DESTDIR=/prefix
COPY --from=limd-build /prefix/usr /usr
FROM build-base AS build-xtool-base
COPY --from=build-limd /prefix/usr /usr
WORKDIR /xtool
FROM build-xtool-base AS dev
# Docker doesn't support FUSE
ENV APPIMAGE_EXTRACT_AND_RUN=1
@@ -97,6 +82,30 @@ ENV APPIMAGE_EXTRACT_AND_RUN=1
# socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/usbmuxd
ENV USBMUXD_SOCKET_ADDRESS=host.docker.internal:27015
WORKDIR /Supersign
CMD [ "/bin/bash" ]
ENTRYPOINT [ "/bin/bash" ]
FROM dev AS dev-test
ENV XTL_TEST_ENV=1
COPY --from=bats/bats:latest /opt/bats /opt/bats
COPY --from=bats/bats:latest /usr/lib/bats /usr/lib/bats
RUN ln -s /opt/bats/bin/bats /usr/local/bin/bats
FROM build-xtool-base AS build-xtool
ARG XTL_CI
ADD Package.swift Package.resolved /xtool/
RUN swift package resolve
ADD . /xtool
RUN ./Linux/build.sh
FROM swift:6.3 AS xtool
COPY --from=build-xtool /xtool/Linux/packages/xtool-*.AppImage /xtool/xtool.AppImage
RUN (cd /xtool && ./xtool.AppImage --appimage-extract) \
&& mv /xtool/squashfs-root /usr/local/xtool \
&& rm -rf /xtool \
&& ln -s /usr/local/xtool/AppRun /usr/local/bin/xtool
+20
View File
@@ -0,0 +1,20 @@
# Debugging
## Environment variables
Some environment variables that help with debugging. Use these as e.g. `XTL_FOO=1 xtool ...`
### General
- `XTL_DEBUG_ERRORS`: If xtool terminates with an error, it normally prints a user-friendly error description. Set `XTL_DEBUG_ERRORS=1` for more verbose error logging.
### Disk
- `XTL_DEBUG_TMP`: Set to `1` to log details when xtool creates/destroys temporary directories.
- `XTL_TMPDIR`: Control the location where xtool stores temporary directories. We also respect `TMPDIR` and (on Linux) `XDG_CACHE_HOME`.
### Networking
- `XTL_DEV_LOG`: Regex. When making AppStoreConnect API requests, operation IDs that match the regex will log their response status and body. Set `XTL_DEV_LOG='.*'` to match all.
- `XTL_DISABLE_TLS_VALIDATION`: Set to `1` to disable all TLS validation on HTTP requests. Useful when using an MITM proxy to inspect API requests. Use sparingly, since disabling TLS is generally unsafe.
- `XTL_HTTP_PROXY`: non-Darwin only. Set to `<host>:<port>` to point the HTTP client to a proxy. e.g. `XTL_HTTP_PROXY=localhost:8080`. On Darwin (macOS/iOS), we instead use the system proxy configuration.
+31
View File
@@ -0,0 +1,31 @@
# Contributing to xtool
## Code
When making code changes, please make sure to test them on both macOS and Linux if possible. If you can also test on Windows with WSL, that is ideal.
To build xtool for debugging, run `make` in the project directory. There are a few considerations depending on your host OS:
### macOS
On macOS, you'll firstly need to have Xcode set up.
The first time you run `make`, we'll try to detect your codesigning identity. If you have multiple, you'll see an interactive prompt to select the team you want to use. The team ID is saved to `./macOS/Support/Private-Team.xcconfig`. You can run `make team` to update it (or do so by hand).
After building, a symlink to the product will be created at `./macOS/Build/xtool`. We generate an Xcode project at `./macOS/XToolMac.xcodeproj` that you can open in order to work in Xcode.
### Linux
You need to have a few dependencies on Linux; see [Dockerfile](/Dockerfile) for specifics. It's often easiest to develop within Docker itself: see [Linux/README.md](/Linux/README.md) for details.
## Debugging
Check out [./Debugging.md](./Debugging.md) for help with debugging xtool issues during development.
## Updating Documentation
The xtool documentation at <https://xtool.sh> is built with [swift-docc](https://github.com/swiftlang/swift-docc) and resides at [Documentation/xtool.docc](/Documentation/xtool.docc). It's hosted on Netlify, the configuration for which is in [netlify.toml](/netlify.toml).
When editing the DocC bundle, you can preview it with `make docs-preview`.
Once you make a pull request with your changes, we'll also generate a [Netlify Deploy Preview](https://docs.netlify.com/site-deploys/deploy-previews/) under your pull request. You can open this preview to see how the changes will look in production.
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
rm -rf docs
if type -p xcrun &>/dev/null; then
docc="$(xcrun -f docc)"
else
docc="docc"
fi
if [[ $# == 0 ]]; then
command="convert"
elif [[ $# == 1 && ( "$1" == "preview" || "$1" == "convert" ) ]]; then
command="$1"
else
echo "Usage: $0 [convert|preview]"
exit 1
fi
"$docc" "$command" xtool.docc \
--enable-experimental-code-block-annotations \
--experimental-enable-custom-templates
+143
View File
@@ -0,0 +1,143 @@
# Create App Extensions
Add app extensions to your iOS app.
## Overview
iOS includes several [App Extension Points](https://developer.apple.com/documentation/technologyoverviews/app-extensions) to deeply integrate with system functionality: such as Widgets, Share Extensions, and Safari Extensions. With a little setup, you can create App Extensions with xtool.
This guide will show you how to add a **Widget Extension** to your app. The steps are similar for other extensions as well.
> Note: This guide assumes you already have an xtool-based application up and running. If you don't, create one first with <doc:First-app>.
## Step 1: Add a new product
Start by adding a new product declaration to your `Package.swift`.
```diff
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "Hello",
platforms: [.iOS(.v17)],
products: [
.library(
name: "Hello",
targets: ["Hello"]
),
+ .library(
+ name: "HelloWidget",
+ targets: ["HelloWidget"]
+ ),
],
targets: [
.target(name: "Hello"),
+ .target(name: "HelloWidget"),
]
)
```
## Step 2: Update xtool.yml
Now that we have two products, we'll need to tell xtool which one corresponds to the _application_ and which one corresponds to the _extension_.
You should already have a bare-bones `xtool.yml` file that describes metadata about your package (the bundle ID, at the bare minimum.) We'll add the new information to this file.
```diff
version: 1
bundleID: com.example.Hello
+ product: Hello
+ extensions:
+ - product: HelloWidget
+ infoPath: HelloWidget-Info.plist
```
## Step 3: Add an Info.plist
App extensions require an `Info.plist` file that tells the system what kind of extension they are, amongst other things. In the previous step, we promised xtool that this file will be located at `./HelloWidget-Info.plist` in your project. We'll now create this file.
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widgetkit-extension</string>
</dict>
</dict>
</plist>
```
> Note:
>
> The value `com.apple.widgetkit-extension` tells the system that this is a Widget Extension. If you're creating a different type of Extension, your `Info.plist` might look different.
>
> For a list of possible `NSExtensionPointIdentifier` values, see [Apple's documentation](https://developer.apple.com/documentation/bundleresources/information-property-list/nsextension/nsextensionpointidentifier) on the subject. You may also need other keys like `NSExtensionPrincipalClass`: refer to Apple's ~better~ legacy [documentation library](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/AppExtensionKeys.html) for details.
>
> Finally, note that the above refers to the old paradigm of **Foundation Extensions**. Apple has started moving towards a newer framework called **ExtensionKit** for recent extension types. The main difference for extension consumers is that you replace `NSExtension -> EXAppExtensionAttributes`, and `NSExtensionPointIdentifier -> EXExtensionPointIdentifier`. xtool doesn't support ExtensionKit yet, but it's [planned](https://github.com/xtool-org/xtool/issues/138).
## Step 4: Code your widget
We can finally write the code for the widget. Create a new file at `Sources/HelloWidget/Widget.swift` with these contents:
```swift
import WidgetKit
import SwiftUI
@main struct Bundle: WidgetBundle {
var body: some Widget {
HelloWidget()
}
}
struct HelloWidget: Widget {
var body: some WidgetConfiguration {
StaticConfiguration(
kind: "HelloWidget",
provider: Provider()
) { entry in
VStack {
Text(entry.date, style: .date)
}
.containerBackground(.fill.tertiary, for: .widget)
}
.configurationDisplayName("HelloWidget")
.description("This is an example widget.")
}
struct Entry: TimelineEntry {
var date = Date()
}
struct Provider: TimelineProvider {
func placeholder(in context: Context) -> Entry {
Entry()
}
func getSnapshot(
in context: Context,
completion: @escaping (Entry) -> Void
) {
completion(Entry())
}
func getTimeline(
in context: Context,
completion: @escaping (Timeline<Entry>) -> Void
) {
completion(Timeline(
entries: [Entry()],
policy: .after(.now + 3600)
))
}
}
}
```
> Note: Blindly refreshing once an hour isn't a great strategy in practice but it makes for a short snippet. I never said this was a tutorial on writing _good_ WidgetKit code; there's plenty of other resources online if that's your goal, including Apple's own [documentation](https://developer.apple.com/documentation/widgetkit).
Finally, build and run with `xtool dev`. You should be able to locate the widget in your widget library and add it to your home screen!
+142
View File
@@ -0,0 +1,142 @@
# Control your app's structure
Add resources, modify your `Info.plist`, and more.
## Overview
When building your app, xtool provides many knobs to add resources and modify files in its `.app` bundle. This article explains how to perform some common tasks along these lines.
Many of the tasks here involve modifying the `xtool.yml` file. The default `xtool new` template should generate this file for you. If you don't have it, make sure you create one first.
```bash
cat > xtool.yml << EOF
version: 1
bundleID: com.example.Hello
EOF
```
## Change your bundle ID
You can update your app's bundle ID by editing the `bundleID` field in `xtool.yml`.
> Note:
>
> xtool adds a prefix to your bundle ID when signing and installing the app on a real device. For example, it may update the above bundle id to `XTL-1234.com.example.Hello`. This is because, at least with free accounts (those not enrolled in the Apple Developer Program), two accounts cannot use the same bundle ID. Prefixing ensures that if you share your app with someone else, they won't run into a bundle ID conflict when installing it.
>
> With additional engineering effort, this limitation could be lifted for paid Developer Program users by leveraging wildcard provisioning profiles. If you have a concrete use case for this and/or wish to contribute, please [file an issue](https://github.com/xtool-org/xtool/issues/new).
## Customize Info.plist
xtool automatically generates a bare-bones `Info.plist` file for you. However, you may need to add new `Info.plist` keys or edit existing ones.
To do this, create an `Info.plist` file in your project containing just the keys you want to add/update, and tell xtool about it by adding the `infoPath` key:
```yaml
infoPath: path/to/Info.plist
```
> Tip:
>
> After running `xtool dev [build]`, you can inspect the built app bundle at `./xtool/YourApp.app` to view its `Info.plist` and other resources.
For example, you might create an `Info.plist` file that looks something like
```plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleDisplayName</key>
<string>My App</string>
</dict>
</plist>
```
- The default `Info.plist` has a `UISupportedInterfaceOrientations` value of portrait. This will replace it with landscape-only.
- We don't include a `CFBundleDisplayName` by default, so this will add the key and specify a display name of "My App".
## Copy resources (SwiftPM)
If you need to include non-code resource files, like images, the easiest way to do so is to use [SwiftPM Resources](https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package). These "just work" with xtool.
For example, if you have `Sources/Hello/Blob.png`, you can include it in your app by updating the `targets` in your `Package.swift` to
```swift
targets: [
.target(
name: "Hello",
resources: [.copy("Blob.png")]
),
]
```
Then, to draw it on screen, you can use
```swift
Image("Blob", bundle: Bundle.module)
```
## Copy resources (top level)
SwiftPM resources are copied into `.bundle` directories nested inside your `.app`. Sometimes, you need to place a file in a specific location in the app directory instead.
To achieve this, you can include a `resources` array in your `xtool.yml` containing a list of files that should be directly included at the root level of the app bundle.
For example, if you use Firebase, you usually need to include a [`GoogleServices-Info.plist`](https://firebase.google.com/docs/ios/setup#add-config-file) file in your root bundle. If you saved this file in your project directory at `./Resources/GoogleServices-Info.plist`, you can update your `xtool.yml` with
```yaml
resources:
- Resources/GoogleServices-Info.plist
```
The file will be copied to `Hello.app/GoogleServices-Info.plist`.
## Add an app icon
Say your app icon is saved at `Resources/AppIcon.png`. You can make this your app icon by setting the `iconPath` key in `xtool.yml`:
```yaml
iconPath: Resources/AppIcon.png
```
> Tip:
>
> Your app icon must be a png, and it should ideally have a resolution of 1024x1024px.
## Add entitlements
You may need to add special [entitlements](https://developer.apple.com/documentation/bundleresources/entitlements) to your app, for example you need the `com.apple.developer.homekit` entitlement in order to connect to HomeKit devices.
First create an `App.entitlements` file with the necessary entitlements:
```plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.homekit</key>
<true/>
</dict>
</plist>
```
Then, tell xtool about it via `xtool.yml`:
```yaml
entitlementsPath: App.entitlements
```
> Troubleshooting:
>
> There are a number of situations in which xtool may not be able to successfully apply an entitlement to your app.
>
> - Some entitlements, such as [Network Extension](https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.networking.networkextension), don't work with free developer accounts. You might need to enrol in one of the Apple Developer Programs to use these.
> - Other entitlements, like [User Notifications Filtering](https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.usernotifications.filtering), require special permission from Apple. If you do have the appropriate permission, these may or may not work with xtool.
> - Many entitlements require specific "Capabilities" to be enabled on your app in the Developer Services portal. xtool handles this for you, but we need to add code to xtool for each Entitlement-Capability mapping. If you run into a Capability that we don't handle yet, please let us know.
>
> Entitlements are a large surface area. If you find any bugs or missing functionality, please [create a GitHub Issue](https://github.com/xtool-org/xtool/issues/new/choose).
@@ -0,0 +1,5 @@
Hello$
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (4.94s)
@@ -0,0 +1,5 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (4.94s)
@@ -0,0 +1,6 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (4.94s)
Waiting for device to be connected...
@@ -0,0 +1,17 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (4.94s)
Waiting for device to be connected...
Installing to device: Kabir's iPhone (udid: *****)
[Unpacking app] 100%
[Logging in] 100%
[Preparing device] 100%
[Provisioning] 100%
[Signing] 100%
[Packaging] 100%
[Connecting] 100%
[Installing] 100%
[Verifying] 100%
@@ -0,0 +1,13 @@
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
}
}
@@ -0,0 +1,15 @@
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
.bold()
.foregroundStyle(.purple)
}
.padding()
}
}
@@ -0,0 +1,17 @@
Hello$
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (5s)
Waiting for device to be connected...
Installing to device: Kabir's iPhone (udid: *****)
[Unpacking app] 100%
[Logging in] 100%
[Preparing device] 100%
[Provisioning] 100%
[Signing] 100%
[Packaging] 100%
[Connecting] 100%
[Installing] 100%
[Verifying] 100%
@@ -0,0 +1,17 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (5s)
Waiting for device to be connected...
Installing to device: Kabir's iPhone (udid: *****)
[Unpacking app] 100%
[Logging in] 100%
[Preparing device] 100%
[Provisioning] 100%
[Signing] 100%
[Packaging] 100%
[Connecting] 100%
[Installing] 100%
[Verifying] 100%
@@ -0,0 +1,17 @@
Hello$ xtool dev
Planning...
Building for debugging...
[8/8] Linking Hello-App
Build of product 'Hello-App' complete! (5s)
Waiting for device to be connected...
Installing to device: Kabir's iPhone (udid: *****)
[Unpacking app] 100%
[Logging in] 100%
[Preparing device] 100%
[Provisioning] 100%
[Signing] 100%
[Packaging] 100%
[Connecting] 100%
[Installing] 100%
[Verifying] 100%
@@ -0,0 +1,10 @@
Developer$
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .bsp/xtool.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
@@ -0,0 +1,10 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .bsp/xtool.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
@@ -0,0 +1,18 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .bsp/xtool.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$
Hello$
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .bsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
@@ -0,0 +1,18 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .bsp/xtool.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .bsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
@@ -0,0 +1,22 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .bsp/xtool.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .bsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
Hello$
version: 1
bundleID: com.example.Hello
@@ -0,0 +1,22 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .bsp/xtool.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .bsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
Hello$ cat xtool.yml
version: 1
bundleID: com.example.Hello
@@ -0,0 +1,25 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .bsp/xtool.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .bsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
Hello$ cat xtool.yml
version: 1
bundleID: com.example.Hello
Hello$
{ "swiftPM": { "swiftSDK": "arm64-apple-ios" } }
@@ -0,0 +1,29 @@
Developer$ xtool new Hello
Creating package: Hello
Creating Package.swift
Creating xtool.yml
Creating .gitignore
Creating .bsp/xtool.json
Creating Sources/Hello/HelloApp.swift
Creating Sources/Hello/ContentView.swift
Finished generating project Hello.
Developer$ cd Hello
Hello$ ls -la
-rw-rw-r-- 1 user user 187 .gitignore
drwxrwxr-x 2 user user 4096 .bsp
-rw-rw-r-- 1 user user 463 Package.swift
drwxrwxr-x 3 user user 4096 Sources
-rw-rw-r-- 1 user user 39 xtool.yml
Hello$ cat xtool.yml
version: 1
bundleID: com.example.Hello
Hello$ cat .bsp/xtool.json
{
"name": "xtool",
...
"argv": ["/usr/bin/env", "xtool", "dev", "build-server"]
}
+161
View File
@@ -0,0 +1,161 @@
@Tutorial(time: 30) {
@Intro(title: "Build your first iOS app on Linux / Windows") {
Once you've completed <doc:Installation-Linux>, use xtool to build and deploy an iOS app from your Linux/Windows machine.
}
@Section(title: "Create an xtool project") {
We'll start by creating a project from xtool's default template.
@Steps {
@Step {
xtool comes with a template for iOS-capable Swift Packages. Run `xtool new` to create a new package.
@Code(name: "Terminal", file: "template-1b.sh", previousFile: "template-1a.sh") {}
}
@Step {
At this point, feel free to poke around.
Observe that the package is structured a lot like a regular SwiftPM library, with a few extra files.
@Code(name: "Terminal", file: "template-2b.sh", previousFile: "template-2a.sh") {}
}
@Step {
Read `xtool.yml`.
This file describes how to bundle the Swift library into an iOS app. At minimum, you need to provide a Bundle ID. This defaults to `com.example.<PackageName>`, in this case `com.example.Hello`.
@Code(name: "Terminal", file: "template-3b.sh", previousFile: "template-3a.sh") {}
}
@Step {
Read `.bsp/xtool.json`.
This file tells your IDE to ask xtool for build information (via the Build Server Protocol). It enables features like syntax highlighting and documentation lookup.
@Code(name: "Terminal", file: "template-4b.sh", previousFile: "template-4a.sh") {}
}
}
}
@Section(title: "Build and run") {
Now that we have a skeleton project, let's get it running on your device.
@Steps {
@Step {
From inside the package directory, run `xtool dev`.
The first time you run this, SwiftPM might take a few minutes to build the app. This is because it needs to build the Swift Modules for the iOS SDK. Subsequent runs should be a lot faster since SwiftPM caches these modules globally.
@Code(name: "Terminal", file: "build-1b.sh", previousFile: "build-1a.sh")
}
@Step {
After the build is complete, xtool will attempt to install it on your device.
At this point, connect your iOS device to your computer via USB. If you installed `libimobiledevice-utils` during setup, you can verify that your device is connected by running `ideviceinfo`. xtool will continue after automatically detecting that your device is connected.
@Code(name: "Terminal", file: "build-2.sh", reset: true)
}
@Step {
Pair your device if prompted.
The first time you run `xtool dev`, you may see a "Trust" dialog on your iOS device to proceed with pairing. Tap **Trust** and enter your passcode on iOS. xtool may throw an error after this: if so, just run `xtool dev` again.
@Code(name: "Terminal", file: "build-2.sh", reset: true) {
@Image(source: "Trust", alt: "Prompt alerting user to trust device")
}
}
@Step {
xtool will now connect to Apple Developer Services, register your device with your Apple ID, generate a Certificate + App ID + Provisioning Profile, sign the app, and then install it.
@Code(name: "Terminal", file: "build-3.sh", reset: true) {}
}
@Step {
Enable Developer Mode if needed.
At this point, you may run into an error asking you to enable **Development Mode** on your iOS device. Follow [these instructions](https://developer.apple.com/documentation/xcode/enabling-developer-mode-on-a-device) and then run `xtool dev` again.
@Code(name: "Terminal", file: "build-3.sh", reset: true) {
@Image(source: "Developer", alt: "Developer mode in Settings")
}
}
@Step {
You should now see the app on your iOS device's home screen / App Library. Tap it to launch the app.
@Image(source: "Home", alt: "Hello app on the home screen")
}
@Step {
The first time you launch the app, observe that you may get an "Untrusted Developer" alert.
@Image(source: "UntrustedDev", alt: "Alert prompting user to trust certificate")
}
@Step {
Go to **Settings** > **General** > **VPN & Device Management** > _[your email]_ > **Trust**.
@Image(source: "Verified", alt: "Trust settings")
}
@Step {
You should now be able to launch the app!
@Image(source: "HelloWorld", alt: "Hello world app")
}
}
}
@Section(title: "Edit and re-run") {
We'll make a small change to the app in your favorite code editor, and then re-run it.
@Steps {
@Step {
Follow the instructions to configure [SourceKit-LSP](https://github.com/swiftlang/sourcekit-lsp/blob/242609dcad55824d9eb23269c0aeead187fd0faa/Documentation/Editor%20Integration.md) for your IDE.
For example, if you're using Visual Studio Code, this means you need to install the [Swift extension](https://marketplace.visualstudio.com/items?itemName=swiftlang.swift-vscode). If you're on Windows, make sure you're [connected to the WSL remote](https://code.visualstudio.com/docs/remote/wsl).
@Image(source: "SwiftExtension", alt: "Swift extension for VSCode")
}
@Step {
Open the project folder in your editor, and drill down to `Sources/Hello/ContentView.swift`.
@Code(name: "ContentView.swift", file: "edit-2.swift") {}
}
@Step {
If you've configured SourceKit-LSP correctly, you should see rich documentation when you hover over the various types and methods.
@Code(name: "ContentView.swift", file: "edit-2.swift") {
@Image(source: "Hover", alt: "Intellisense")
}
}
@Step {
Let's update the "Hello, world!" text to be bold and purple.
@Code(name: "ContentView.swift", file: "edit-4.swift") {}
}
@Step {
Run `xtool dev` again to re-build and re-install. This should go a lot faster than the first time.
@Code(name: "Terminal", file: "rerun-5b.sh", previousFile: "rerun-5a.sh") {}
}
@Step {
Launch the app again to see the updated text!
@Code(name: "Terminal", file: "rerun-6.sh") {
@Image(source: "HelloWorld-Purple", alt: "Updated Hello app")
}
}
}
}
}
@@ -0,0 +1,145 @@
# Installation (Linux/Windows)
Set up xtool for iOS app development on Linux or Windows.
## Overview
This article outlines the steps to install `xtool` and begin developing iOS apps on Linux (or Windows via WSL).
## Prerequisites
### WSL (for Windows users)
If you're on Windows, you can use xtool via [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) (WSL).
Once you install WSL, you'll also need to set up USB passthrough. See Microsoft's instructions on [installing USBIPD](https://learn.microsoft.com/en-us/windows/wsl/connect-usb). Make sure you're able to bind your iOS device to WSL via USB.
> Note:
>
> If you encounter `Error: AFCClient.Error.muxError`, follow the steps described in [this issue comment](https://github.com/xtool-org/xtool/issues/19#issuecomment-2898986718) from user rena2019.
>
> This relays the device connection from iTunes on Windows, instead of relying on USBIPD.
### Swift
Install the Swift 6.4 toolchain for your Linux distribution from <https://swift.org/install/linux>.
After following the steps there, confirm that Swift is installed correctly:
```bash
swift --version
# should say something like:
# Swift version 6.4 (swift-6.4-RELEASE)
```
### usbmuxd
xtool relies on [usbmuxd](https://github.com/libimobiledevice/usbmuxd) to talk to your iOS device from Linux.
Your Linux distro probably offers this package, and it may be preinstalled. To check if it is, run
```bash
usbmuxd --help
# Usage: usbmuxd [OPTIONS]
# ...
```
If instead you get "command not found", you need to install `usbmuxd` yourself. On Ubuntu/Debian, for example, you can do this with
```bash
sudo apt-get install usbmuxd
```
> Other useful tools:
>
> `usbmuxd` is part of the [libimobiledevice](https://libimobiledevice.org) project. You may want to install other libimobiledevice tools, such as `ideviceinfo`, that offer many ways to interact with your iOS device from the command line. On Ubuntu/Debian, you can run
>
> ```bash
> sudo apt-get install libimobiledevice-utils
> # The following NEW packages will be installed:
> # libimobiledevice-utils
> # 0 upgraded, 1 newly installed
> ideviceinfo
> # DeviceName: Kabir's iPhone
> # SerialNumber: ...
> # UniqueDeviceID: ...
> # ...
> ```
### Xcode.xip
Download **Xcode 26** from <https://developer.apple.com/download/all/?q=Xcode>. Note the path where `Xcode.xip` is saved.
> Note:
>
> The URL above requires authentication, so make sure to visit it in your browser rather than running `curl`. You'll be asked to log in with your Apple ID and accept the license agreement to download Xcode.
## Installation
### 1. Download xtool
Once you have the prerequisites, download the [latest GitHub Release](https://github.com/xtool-org/xtool/releases/latest) of `xtool.AppImage` for your architecture. Rename it to `xtool` and add it to a location in your `PATH`.
```bash
curl -fL \
"https://github.com/xtool-org/xtool/releases/latest/download/xtool-$(uname -m).AppImage" \
-o xtool
chmod +x xtool
sudo mv xtool /usr/local/bin/
```
Confirm that xtool is installed correctly:
```bash
xtool --help
# OVERVIEW: Cross-platform Xcode replacement
# ...
```
### 2. Configure xtool: log in
Perform one-time setup with
```bash
xtool setup
```
You'll be asked to log in:
```
Select login mode
0: API Key (requires paid Apple Developer Program membership)
1: Password (works with any Apple ID but uses private APIs)
Choice (0-1):
```
> Choosing a login mode:
>
> **API Key:** If you have a paid [Apple Developer Program](https://developer.apple.com/programs/enroll/) membership, this is the recommended option. It relies on the public App Store Connect API. You'll want to follow the [instructions](https://developer.apple.com/documentation/appstoreconnectapi/creating-api-keys-for-app-store-connect-api) to generate a **Team Key** with the **App Manager** role.
>
> **Password:** If you aren't enrolled in the paid developer program, you'll want to use password-based authentication. This relies on private Apple APIs to authenticate, so you may want to create a throwaway Apple ID to be extra cautious.
Once you select a login mode, you'll be asked to provide the corresponding credentials (API key or email+password+2FA). Needless to say, *your credentials are only sent to Apple* and nobody else (feel free to build xtool from source and check!)
### 3. Configure xtool: SDK
After you're logged in, you'll be asked to provide the path to the `Xcode.xip` file you downloaded earlier.
```
Choice (0-1): 0
...
Path to Xcode.xip:
```
Enter the path (for example `~/Downloads/Xcode_27.0.xip`) and hit enter. xtool will extract the Xcode XIP to generate and install an iOS Swift SDK for you.
Confirm that it worked:
```bash
swift sdk list
# darwin
```
## Next steps
You're now ready to use xtool! See <doc:First-app>.
@@ -0,0 +1,81 @@
# Installation (macOS)
Set up xtool for declarative, Xcode-free iOS app development on macOS.
## Overview
This article outlines the steps to install `xtool` for declarative, SwiftPM-driven iOS app development on macOS.
## Prerequisites
### Xcode
Though we don't rely on the Xcode build system, you still need to install Xcode for the iOS SDK and toolchain. You'll want to [install Xcode](https://developer.apple.com/xcode/) and launch it once, completing any installation prompts.
Confirm that Xcode is set up with the iOS SDK:
```bash
xcrun -sdk iphoneos -show-sdk-path
# /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.4.sdk
```
As well as Swift:
```bash
swift --version
# swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
# Target: arm64-apple-macosx15.0
```
## Installation
### 1. Download xtool
If you have [Homebrew](https://brew.sh), you can install xtool with
```bash
brew install xtool-org/tap/xtool
```
Otherwise, you can download `xtool.app` from the [latest GitHub release](https://github.com/xtool-org/xtool/releases/latest). After moving it into `/Applications`, launch it and run the suggested script to add the `xtool` command to your `PATH`.
> Note:
>
> If you install xtool manually, you'll also need to check for new GitHub releases and update it yourself. If you're interested in contributing support for auto-updates through Sparkle, pull requests are appreciated. See [issue #34 on GitHub](https://github.com/xtool-org/xtool/issues/34).
Confirm that xtool is installed correctly:
```bash
xtool --help
# OVERVIEW: Cross-platform Xcode replacement
# ...
```
### 2. Configure xtool: log in
Perform one-time setup with
```bash
xtool setup
```
You'll be asked to log in:
```
Select login mode
0: API Key (requires paid Apple Developer Program membership)
1: Password (works with any Apple ID but uses private APIs)
Choice (0-1):
```
> Choosing a login mode:
>
> **API Key:** If you have a paid [Apple Developer Program](https://developer.apple.com/programs/enroll/) membership, this is the recommended option. It relies on the public App Store Connect API. You'll want to follow the [instructions](https://developer.apple.com/documentation/appstoreconnectapi/creating-api-keys-for-app-store-connect-api) to generate a **Team Key** with the **App Manager** role.
>
> **Password:** If you aren't enrolled in the paid developer program, you'll want to use password-based authentication. This relies on private Apple APIs to authenticate, so you may want to create a throwaway Apple ID to be extra cautious.
Once you select a login mode, you'll be asked to provide the corresponding credentials (API key or email+password+2FA). Needless to say, *your credentials are only sent to Apple* and nobody else (feel free to build xtool from source and check!)
## Next steps
You're now ready to use xtool! See <doc:First-app>. (The tutorial is tailored to Linux, but it works the same on macOS.)
Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

+19
View File
@@ -0,0 +1,19 @@
<style>
footer {
display: flex;
justify-content: center;
padding: 0.5rem 0.8rem;
background-color: var(--color-fill-secondary);
text-align: center;
}
a, a:visited {
color: var(--color-text);
}
</style>
<footer>
<span>
&copy; xtool maintainers. This site is powered by <a href="https://www.netlify.com">Netlify</a>.
</span>
</footer>
+34
View File
@@ -0,0 +1,34 @@
# xtool
@Metadata {
@TechnologyRoot
@TitleHeading("Command-line Tool")
@CallToAction(url: "https://github.com/xtool-org/xtool", label: "View on GitHub")
}
Cross-platform Xcode replacement.
## Overview
xtool is a cross-platform (Linux/WSL/macOS) tool that replicates Xcode functionality with open standards.
✅ Build a SwiftPM package into an iOS app
✅ Sign and install iOS apps
✅ Interact with Apple Developer Services programmatically
![A screenshot of xtool being invoked from VSCode](Cover.png)
## Topics
### Getting started
- <doc:Installation-Linux>
- <doc:Installation-macOS>
- <doc:First-app>
### Common tasks
- <doc:Control>
- <doc:Appex>
+11
View File
@@ -0,0 +1,11 @@
@Tutorials(name: "xtool") {
@Intro(title: "Tutorials") {
Install xtool and build your first iOS app on Linux.
}
@Chapter(name: "Getting Started") {
@Image(source: "HelloWorld", alt: "Getting Started")
@TutorialReference(tutorial: "doc:First-app")
}
}
+5 -5
View File
@@ -1,6 +1,6 @@
# Supersign + Linux = <3
# xtool + Linux = <3
Supersign currently uses AppImage to build its Linux CLI. It is possible to build and run the AppImage on a native Linux host, as well as through Docker (natively or through Docker Desktop on macOS).
xtool currently uses AppImage to build its Linux CLI. It is possible to build and run the AppImage on a native Linux host, as well as through Docker (natively or through Docker Desktop on macOS).
## Setup
@@ -10,9 +10,9 @@ Make sure `usbmuxd` is installed on your host machine. On macOS, `usbmuxd` is pr
You can build and run a container with standard Docker Compose commands, for example:
```
docker compose run --rm supersign
docker compose run --rm xtool
```
This will spawn a shell inside the container. The Supersign root directory will be bind-mounted at `/Supersign`.
This will spawn a shell inside the container. The xtool root directory will be bind-mounted at `/xtool`.
To actually access iOS devices from inside Docker, you'll also need to forward the host's `usbmuxd` to a port which the Docker container's libusbmuxd will connect to. Keep this command running on your host machine:
```
@@ -21,4 +21,4 @@ socat -dd TCP-LISTEN:27015,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/ru
## Building
Simply run `./build.sh` in this directory. This will output an AppImage to `packages/Supersign.AppImage`, which can directly be invoked.
Simply run `./build.sh` in this directory. This will output an AppImage to `packages/xtool.AppImage`, which can directly be invoked.
+12 -11
View File
@@ -5,9 +5,6 @@ shopt -s nullglob
cd "$(dirname "$0")"
# installer version
export LINUXDEPLOY_OUTPUT_VERSION="1.0.0"
if ! command -v fusermount &>/dev/null; then
# Docker doesn't support FUSE
export APPIMAGE_EXTRACT_AND_RUN=1
@@ -16,11 +13,12 @@ fi
rm -rf staging/tmp
mkdir -p staging/tmp staging/linuxdeploy
swift build --package-path .. -c release --product SupersignCLI --static-swift-stdlib
swift build --package-path .. -c release --product xtool --static-swift-stdlib
bin="$(swift build --package-path .. -c release --show-bin-path)"
strip "${bin}/SupersignCLI"
strip "${bin}/xtool"
curr_git_info="$(curl -fsSL https://api.github.com/repos/linuxdeploy/linuxdeploy/git/refs/tags/continuous)"
curr_arch="$(uname -m)"
if [[ -f staging/linuxdeploy/git.json ]]; then
if ! cmp -s staging/linuxdeploy/git.json <(echo "$curr_git_info"); then
@@ -33,7 +31,7 @@ else
fi
if [[ ! -f staging/linuxdeploy/linuxdeploy.AppImage ]]; then
curl -fsSL "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(arch).AppImage" \
curl -fsSL "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${curr_arch}.AppImage" \
-o staging/linuxdeploy/linuxdeploy.AppImage
chmod +x staging/linuxdeploy/linuxdeploy.AppImage
echo "$curr_git_info" > staging/linuxdeploy/git.json
@@ -42,14 +40,17 @@ fi
mkdir -p staging/tmp/AppDir/usr/bin
find "${bin}"/ -name '*.resources' -print0 | xargs -0 -I {} cp -a {} "${PWD}/staging/tmp/AppDir/usr/bin/"
LDAI_OUTPUT="staging/tmp/Supersign.AppImage" ./staging/linuxdeploy/linuxdeploy.AppImage \
export LINUXDEPLOY_OUTPUT_VERSION="${XTOOL_VERSION:-unversioned}"
export LDAI_OUTPUT="staging/tmp/xtool-${curr_arch}.AppImage"
export LDAI_UPDATE_INFORMATION="gh-releases-zsync|xtool-org|xtool|latest|xtool-${curr_arch}.AppImage.zsync"
./staging/linuxdeploy/linuxdeploy.AppImage \
--appdir staging/tmp/AppDir \
--output appimage \
-e "${bin}/SupersignCLI" \
-d Supersign.desktop \
-i Supersign.png
-e "${bin}/xtool" \
-d xtool.desktop \
-i xtool.png
mkdir -p packages
mv -f staging/tmp/Supersign.AppImage packages/Supersign.AppImage
mv -f "staging/tmp/xtool-${curr_arch}.AppImage" "./xtool-${curr_arch}.AppImage.zsync" packages/
rm -rf staging/tmp
@@ -1,9 +1,9 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Supersign
Name=xtool
Categories=Development;
Exec=SupersignCLI
Icon=Supersign
Exec=xtool
Icon=xtool
# TODO: remove
Terminal=true

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

+164 -6
View File
@@ -1,18 +1,176 @@
ifeq ($(shell uname -s),Darwin)
IS_MAC = 1
ifneq ($(VERBOSE),1)
ifeq ($(shell type -p xcbeautify &>/dev/null && echo 1),1)
XC_FORMAT = | xcbeautify
endif
endif
endif
ifeq ($(RELEASE),1)
INTERNAL_SWIFTFLAGS = -c release
INTERNAL_XCFLAGS = -configuration Release
else
INTERNAL_SWIFTFLAGS = -c debug
INTERNAL_XCFLAGS = -configuration Debug
endif
ALL_SWIFTFLAGS = $(INTERNAL_SWIFTFLAGS) $(SWIFTFLAGS)
ALL_XCFLAGS = $(INTERNAL_XCFLAGS) $(XCFLAGS)
TEAM_CONFIG = macOS/Support/Private-Team.xcconfig
.PHONY: all
# dev build for the current platform
all:
ifeq ($(IS_MAC),1)
@+$(MAKE) mac
else
@+$(MAKE) linux
endif
.PHONY: clean
# clean build artifacts
clean:
ifeq ($(IS_MAC),1)
@+$(MAKE) mac-clean
else
@+$(MAKE) linux-clean
endif
.PHONY: linux
# dev build for Linux
linux:
swift build --product xtool $(ALL_SWIFTFLAGS)
.PHONY: linux-clean
# clean build artifacts for Linux
linux-clean:
rm -rf .build
.PHONY: linux-dist
# dist build for Linux
linux-dist:
docker compose run --build --rm xtool Linux/build.sh
.PHONY: docker
docker:
docker build . -t ghcr.io/xtool-org/xtool:latest
.PHONY: mac
# dev build for macOS
mac: project
@rm -rf macOS/Build/XcodeInstall
@set -o pipefail && cd macOS && \
xcodebuild install \
-skipMacroValidation -skipPackagePluginValidation \
-scheme XToolMac -destination generic/platform=macOS \
-derivedDataPath Build/DerivedData \
DSTROOT="$$PWD"/Build/XcodeInstall INSTALL_PATH=/ \
$(ALL_XCFLAGS) $(XC_FORMAT)
@ln -fs XcodeInstall/xtool.app/Contents/Resources/bin/xtool macOS/Build/xtool
@echo "Output: ./macOS/Build/xtool"
.PHONY: mac-clean
# clean build artifacts for macOS
mac-clean:
rm -rf macOS/Build
.PHONY: mac-dist
# dist build for macOS
# requires a few secrets in the env (see .github/workflows/release.yml)
mac-dist:
@echo "bundle exec fastlane package"
@cd macOS && bundle exec fastlane package
.PHONY: reload
# update Xcode project and restart Xcode
reload:
killall Xcode || :
@+$(MAKE) project
xed macOS/XToolMac.xcodeproj
.PHONY: project
# update Xcode project
project: $(TEAM_CONFIG)
@echo "xcodegen"
@cd macOS && xcodegen
.PHONY: team
# update development team
team:
@+$(MAKE) -B $(TEAM_CONFIG)
# update development team if needed.
#
# will prompt interactively if there are multiple valid options.
# set DEVELOPMENT_TEAM=... to force a specific value.
$(TEAM_CONFIG):
ifeq ($(DEVELOPMENT_TEAM),)
@mkdir -p macOS/Support
@team=$$(./scripts/select-identity.sh); \
echo "echo \"DEVELOPMENT_TEAM = $$team\" > $@"; \
echo "DEVELOPMENT_TEAM = $$team" > $@
else
@mkdir -p macOS/Support
echo "DEVELOPMENT_TEAM = $(DEVELOPMENT_TEAM)" > $@
.PHONY: $(TEAM_CONFIG)
endif
.PHONY: docs
# build documentation
docs:
./Documentation/build.sh
.PHONY: docs-preview
# preview documentation
docs-preview:
./Documentation/build.sh preview
SWIFTLINT_VERSION = $(shell head -1 .swiftlint.yml | cut -d' ' -f2)
SWIFTLINT_BIN = .tmp/swiftlint/swiftlint-$(SWIFTLINT_VERSION)
SWIFTLINT_URL = https://github.com/realm/SwiftLint/releases/download/$(SWIFTLINT_VERSION)/$(if $(IS_MAC),portable_swiftlint,swiftlint_linux).zip
.PHONY: lint
lint: $(SWIFTLINT_BIN)
$(SWIFTLINT_BIN) $(SWIFTLINT_FLAGS)
$(SWIFTLINT_BIN):
@rm -rf .tmp/swiftlint
@mkdir -p .tmp/swiftlint
curl -fSL $(SWIFTLINT_URL) -o .tmp/swiftlint/swiftlint.zip
unzip -q .tmp/swiftlint/swiftlint.zip swiftlint -d .tmp/swiftlint
@rm -f .tmp/swiftlint/swiftlint.zip
@mv .tmp/swiftlint/swiftlint $@
@ln -s swiftlint-$(SWIFTLINT_VERSION) .tmp/swiftlint/swiftlint
SPEC_URL = https://developer.apple.com/sample-code/app-store-connect/app-store-connect-openapi-specification.zip
.PHONY: api update-api
api: openapi.json
.PHONY: api
# Regenerate the OpenAPI client code
api: openapi/openapi.json
swift run swift-openapi-generator generate \
openapi.json \
openapi/openapi.json \
--config Sources/DeveloperAPI/openapi-generator-config.yaml \
--output-directory Sources/DeveloperAPI/Generated
for file in Sources/DeveloperAPI/Generated/*.swift; do \
sed -i '' -e 's/[[:<:]]Client[[:>:]]/DeveloperAPIClient/g' $$file; \
done
.PHONY: update-api
# Update OpenAPI spec and regenerate the client code
update-api:
@+$(MAKE) -B api
openapi.json:
curl -fsSL "$(SPEC_URL)" | bsdtar -xOf- > openapi.json
openapi/openapi.json: openapi/base.json Sources/DeveloperAPI/patch.js
node Sources/DeveloperAPI/patch.js < openapi/base.json > openapi/openapi.json
openapi/base.json:
@mkdir -p openapi
# piping curl|bsdtar concatenates xattrs into the JSON :thonk:
curl -fsSL "$(SPEC_URL)" -o openapi/spec.zip
bsdtar -xO -f openapi/spec.zip > openapi/base.json
rm -f openapi/spec.zip
+222 -87
View File
@@ -1,13 +1,13 @@
{
"originHash" : "093c707d9a59dbc3862fcc4682cd2a725695bec85446dcc453245f6ec0363481",
"originHash" : "70ed310397f7785149edfd3c75ea1be84b43c694430c1a7d8a48d1da0809d3b5",
"pins" : [
{
"identity" : "aexml",
"kind" : "remoteSourceControl",
"location" : "https://github.com/tadija/AEXML.git",
"state" : {
"revision" : "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3",
"version" : "4.6.1"
"revision" : "db806756c989760b35108146381535aec231092b",
"version" : "4.7.0"
}
},
{
@@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-server/async-http-client.git",
"state" : {
"revision" : "0a9b72369b9d87ab155ef585ef50700a34abf070",
"version" : "1.23.1"
"revision" : "3a5b74a58782c3b4c1f0bc75e9b67b10c2494e8f",
"version" : "1.33.1"
}
},
{
@@ -24,8 +24,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/attaswift/BigInt",
"state" : {
"revision" : "a7ee11486233ba45f5ceee0b8cb3d6629ed450ef",
"version" : "5.5.0"
"revision" : "e07e00fa1fd435143a2dcf8b7eec9a7710b2fdfe",
"version" : "5.7.0"
}
},
{
"identity" : "combine-schedulers",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/combine-schedulers",
"state" : {
"revision" : "dcccb979a2183b8df3334237e3dc1ae2b4116a86",
"version" : "1.2.0"
}
},
{
@@ -42,8 +51,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mattpolzin/OpenAPIKit",
"state" : {
"revision" : "5b5ee49624dda5b3e3b85aff184f44a007862fb7",
"version" : "3.3.0"
"revision" : "57b6318128e3f901c93f4fbf98d1c1464ec168d3",
"version" : "6.2.0"
}
},
{
@@ -60,8 +69,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/onevcat/Rainbow.git",
"state" : {
"revision" : "e0dada9cd44e3fa7ec3b867e49a8ddbf543e3df3",
"version" : "4.0.1"
"revision" : "cdf146ae671b2624917648b61c908d1244b98ca1",
"version" : "4.2.1"
}
},
{
@@ -73,22 +82,13 @@
"version" : "0.10.1"
}
},
{
"identity" : "superchargecore",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SuperchargeApp/SuperchargeCore",
"state" : {
"revision" : "e409f42fd5736fac149c8288eba69c50e7eac5c2",
"version" : "1.2.0"
}
},
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms.git",
"state" : {
"revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42",
"version" : "1.2.0"
"revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023",
"version" : "1.2.1"
}
},
{
@@ -96,8 +96,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "41982a3656a71c768319979febd796c6fd111d5c",
"version" : "1.5.0"
"revision" : "626b5b7b2f45e1b0b1c6f4a309296d1d21d7311b",
"version" : "1.7.1"
}
},
{
@@ -105,8 +105,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-asn1.git",
"state" : {
"revision" : "7faebca1ea4f9aaf0cda1cef7c43aecd2311ddf6",
"version" : "1.3.0"
"revision" : "eb50cbd14606a9161cbc5d452f18797c90ef0bab",
"version" : "1.7.0"
}
},
{
"identity" : "swift-async-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-async-algorithms.git",
"state" : {
"revision" : "9d349bcc328ac3c31ce40e746b5882742a0d1272",
"version" : "1.1.3"
}
},
{
@@ -114,8 +123,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
"revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7",
"version" : "1.3.0"
}
},
{
@@ -123,26 +132,44 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-certificates",
"state" : {
"revision" : "1fbb6ef21f1525ed5faf4c95207b9c11bea27e94",
"version" : "1.6.1"
"revision" : "bde8ca32a096825dfce37467137c903418c1893d",
"version" : "1.19.1"
}
},
{
"identity" : "swift-clocks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"revision" : "cc46202b53476d64e824e0b6612da09d84ffde8e",
"version" : "1.0.6"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",
"version" : "1.1.4"
"revision" : "fea17c02d767f46b23070fdfdacc28a03a39232a",
"version" : "1.5.1"
}
},
{
"identity" : "swift-concurrency-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras.git",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras",
"state" : {
"revision" : "163409ef7dae9d960b87f34b51587b6609a76c1f",
"version" : "1.3.0"
"revision" : "5a3825302b1a0d744183200915a47b508c828e6f",
"version" : "1.3.2"
}
},
{
"identity" : "swift-configuration",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-configuration.git",
"state" : {
"revision" : "be76c4ad929eb6c4bcaf3351799f2adf9e6848a9",
"version" : "1.2.0"
}
},
{
@@ -150,8 +177,53 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-crypto",
"state" : {
"revision" : "06dc63c6d8da54ee11ceb268cde1fa68161afc96",
"version" : "3.9.1"
"revision" : "1b6b2e274e85105bfa155183145a1dcfd63331f1",
"version" : "4.5.0"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "706feb7858a7f6c242879d137b8ee30926aa5b26",
"version" : "1.12.0"
}
},
{
"identity" : "swift-distributed-tracing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-distributed-tracing.git",
"state" : {
"revision" : "dc4030184203ffafbb2ec614352487235d747fe0",
"version" : "1.4.1"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-docc-plugin",
"state" : {
"revision" : "647c708be89f834fa6a6d4945442793a77ddf5b6",
"version" : "1.5.0"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
},
{
"identity" : "swift-http-structured-headers",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-structured-headers.git",
"state" : {
"revision" : "933538faa42c432d385f02e07df0ace7c5ecfc47",
"version" : "1.7.0"
}
},
{
@@ -159,8 +231,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types",
"state" : {
"revision" : "ef18d829e8b92d731ad27bb81583edd2094d1ce3",
"version" : "1.3.1"
"revision" : "45eb0224913ea070ec4fba17291b9e7ecf4749ca",
"version" : "1.5.1"
}
},
{
@@ -168,17 +240,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
"revision" : "5073617dac96330a486245e4c0179cb0a6fd2256",
"version" : "1.12.0"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"location" : "https://github.com/apple/swift-nio",
"state" : {
"revision" : "914081701062b11e3bb9e21accc379822621995e",
"version" : "2.76.1"
"revision" : "f71c8d2a5e74a2c6d11a0fbe324774b5d6084237",
"version" : "2.99.0"
}
},
{
@@ -186,8 +258,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-extras.git",
"state" : {
"revision" : "2e9746cfc57554f70b650b021b6ae4738abef3e6",
"version" : "1.24.1"
"revision" : "5a48717e29f62cb8326d6d42e46b562ca93847a6",
"version" : "1.34.0"
}
},
{
@@ -195,8 +267,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-http2.git",
"state" : {
"revision" : "eaa71bb6ae082eee5a07407b1ad0cbd8f48f9dca",
"version" : "1.34.1"
"revision" : "81cc18264f92cd307ff98430f89372711d4f6fe9",
"version" : "1.43.0"
}
},
{
@@ -204,8 +276,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "c7e95421334b1068490b5d41314a50e70bab23d1",
"version" : "2.29.0"
"revision" : "3f337058ccd7243c4cac7911477d8ad4c598d4da",
"version" : "2.37.0"
}
},
{
@@ -213,8 +285,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "bbd5e63cf949b7db0c9edaf7a21e141c52afe214",
"version" : "1.23.0"
"revision" : "67787bb645a5e67d2edcdfbe48a216cc549222d5",
"version" : "1.28.0"
}
},
{
@@ -222,8 +294,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics.git",
"state" : {
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
"version" : "1.0.2"
"revision" : "0c0290ff6b24942dadb83a929ffaaa1481df04a2",
"version" : "1.1.1"
}
},
{
@@ -231,8 +303,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-server/swift-openapi-async-http-client",
"state" : {
"revision" : "abfe558a66992ef1e896a577010f957915f30591",
"version" : "1.0.0"
"revision" : "3681f659d9417652b8119f0adbdf57c04b6cb292",
"version" : "1.5.0"
}
},
{
@@ -240,8 +312,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-openapi-generator",
"state" : {
"revision" : "e971af5c5374e4ea83c20d0ad0a0df2cc84d39ad",
"version" : "1.5.0"
"revision" : "5dd0da1c7da7bac8f0c458a02a76f69031137a80",
"version" : "1.12.1"
}
},
{
@@ -249,8 +321,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-openapi-runtime",
"state" : {
"revision" : "5e119a3d52dde0229312ed586be99c666c6b6f64",
"version" : "1.7.0"
"revision" : "f039fa6d6338aab5164f3d1be16281524c9a8f89",
"version" : "1.11.0"
}
},
{
@@ -258,17 +330,53 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-openapi-urlsession",
"state" : {
"revision" : "9bf4c712ad7989d6a91dbe68748b8829a50837e4",
"version" : "1.0.2"
"revision" : "576a65b4ffb8c12ddad4950dc21eea2ef071bec2",
"version" : "1.3.0"
}
},
{
"identity" : "swift-service-context",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-service-context.git",
"state" : {
"revision" : "d0997351b0c7779017f88e7a93bc30a1878d7f29",
"version" : "1.3.0"
}
},
{
"identity" : "swift-service-lifecycle",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-server/swift-service-lifecycle",
"state" : {
"revision" : "9829955b385e5bb88128b73f1b8389e9b9c3191a",
"version" : "2.11.0"
}
},
{
"identity" : "swift-subprocess",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-subprocess",
"state" : {
"revision" : "11633673a41f509f8945f23c96c7acd4adafd679",
"version" : "0.5.0"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "9de99a78f099e59caf2b2beec65a4c45d54b2081",
"version" : "603.0.1"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"location" : "https://github.com/apple/swift-system",
"state" : {
"revision" : "c8a44d836fe7913603e246acab7c528c2e780168",
"version" : "1.4.0"
"revision" : "7c6ad0fc39d0763e0b699210e4124afd5041c5df",
"version" : "1.6.4"
}
},
{
@@ -281,21 +389,21 @@
}
},
{
"identity" : "swiftpack",
"identity" : "swiftymobiledevice",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kabiroberai/swiftpack",
"location" : "https://github.com/xtool-org/SwiftyMobileDevice",
"state" : {
"revision" : "3610144c5fd3b1a50c323476ac7f42cebb9780bc",
"version" : "1.0.1"
"revision" : "1f6e4cc614a31953bda5d1092a747cfdea90916f",
"version" : "1.7.0"
}
},
{
"identity" : "swiftymobiledevice",
"identity" : "unxip",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SuperchargeApp/SwiftyMobileDevice",
"location" : "https://github.com/saagarjha/unxip",
"state" : {
"revision" : "954fff0438c181b64c0ab5dac5428486cc0cb6e0",
"version" : "1.3.0"
"revision" : "6c3990517fcc4c1db6952fccf4c562fb14097601",
"version" : "3.3.0"
}
},
{
@@ -303,8 +411,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mxcl/Version",
"state" : {
"revision" : "303a0f916772545e1e8667d3104f83be708a723c",
"version" : "2.1.0"
"revision" : "3043fcd2a50375db76d89ff206a612471833d1c2",
"version" : "2.2.1"
}
},
{
@@ -312,8 +420,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/websocket-kit.git",
"state" : {
"revision" : "4232d34efa49f633ba61afde365d3896fc7f8740",
"version" : "2.15.0"
"revision" : "90bbbdab3ede12c803cfbe91646f291c092517a3",
"version" : "2.16.2"
}
},
{
"identity" : "xadi",
"kind" : "remoteSourceControl",
"location" : "https://github.com/xtool-org/xadi",
"state" : {
"revision" : "2aad968e4806b8571f6f2bed22ecec00b0322f95",
"version" : "0.4.1"
}
},
{
@@ -321,8 +438,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/yonaskolb/XcodeGen",
"state" : {
"revision" : "82c6ab9bbd5b6075fc0887d897733fc0c4ffc9ab",
"version" : "2.42.0"
"revision" : "8d3d3476a69ae3e5d68e1adccc701c410c05eb36",
"version" : "2.45.4"
}
},
{
@@ -330,8 +447,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tuist/XcodeProj.git",
"state" : {
"revision" : "447c159b0c5fb047a024fd8d942d4a76cf47dde0",
"version" : "8.16.0"
"revision" : "01bb77000bc8c23a09ea2058f4954612f03cb705",
"version" : "9.10.1"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "dfd70507def84cb5fb821278448a262c6ff2bbad",
"version" : "1.9.0"
}
},
{
"identity" : "xtool-core",
"kind" : "remoteSourceControl",
"location" : "https://github.com/xtool-org/xtool-core",
"state" : {
"revision" : "f867f9c2aea16ac78ca14d0d2f948b47db0732b4",
"version" : "1.5.0"
}
},
{
@@ -339,17 +474,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/jpsim/Yams",
"state" : {
"revision" : "3036ba9d69cf1fd04d433527bc339dc0dc75433d",
"version" : "5.1.3"
"revision" : "3d6871d5b4a5cd519adf233fbb576e0a2af71c17",
"version" : "5.4.0"
}
},
{
"identity" : "zsign",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kabiroberai/zsign",
"location" : "https://github.com/xtool-org/zsign",
"state" : {
"revision" : "c3fea016227f595cd51f037450650a2ff362f7db",
"version" : "1.3.0"
"revision" : "19aab76b3f1388966a3ed4fc11b357f95aafc70b",
"version" : "1.8.0"
}
}
],
+113 -47
View File
@@ -1,84 +1,139 @@
// swift-tools-version:6.0
// swift-tools-version:6.2
import PackageDescription
let xtoolVersion: String? = {
if let explicitVersion = Context.environment["XTOOL_VERSION"] {
return explicitVersion
} else if let info = Context.gitInformation {
let gitCommit = info.currentCommit
let gitTag = info.currentTag
let gitRef = gitTag ?? "commit \(gitCommit)"
return "\(gitRef)\(info.hasUncommittedChanges ? " (dirty)" : "")"
} else {
return nil
}
}()
let cSettings: [CSetting] = [
.define("_GNU_SOURCE", .when(platforms: [.linux])),
]
let swiftSettings: [SwiftSetting] = {
var settings: [SwiftSetting] = []
if Context.environment["XTL_CI"] == "1" {
settings.append(.treatAllWarnings(as: .error))
}
return settings
}()
let package = Package(
name: "Supersign",
name: "xtool",
platforms: [
.iOS(.v15),
.macOS(.v12),
.iOS(.v16),
.macOS(.v13),
],
products: [
.library(
name: "Supersign",
targets: ["Supersign"]
name: "XKit",
targets: ["XKit"]
),
.library(
name: "SupersignCLISupport",
targets: ["SupersignCLISupport"]
name: "XToolSupport",
targets: ["XToolSupport"]
),
.executable(
name: "SupersignCLI",
targets: ["SupersignCLI"]
name: "xtool",
targets: ["xtool"]
),
],
dependencies: [
.package(url: "https://github.com/SuperchargeApp/SuperchargeCore", .upToNextMinor(from: "1.2.0")),
.package(url: "https://github.com/SuperchargeApp/SwiftyMobileDevice", .upToNextMinor(from: "1.3.0")),
.package(url: "https://github.com/kabiroberai/swiftpack", .upToNextMinor(from: "1.0.1")),
.package(url: "https://github.com/kabiroberai/zsign", .upToNextMinor(from: "1.3.0")),
.package(url: "https://github.com/xtool-org/xtool-core", .upToNextMinor(from: "1.5.0")),
.package(url: "https://github.com/xtool-org/SwiftyMobileDevice", .upToNextMinor(from: "1.7.0")),
.package(url: "https://github.com/xtool-org/zsign", .upToNextMinor(from: "1.8.0")),
.package(url: "https://github.com/xtool-org/xadi", .upToNextMinor(from: "0.4.1")),
.package(url: "https://github.com/apple/swift-system", from: "1.4.0"),
.package(url: "https://github.com/apple/swift-http-types", from: "1.3.1"),
.package(url: "https://github.com/apple/swift-certificates", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-crypto", from: "3.9.1"),
.package(url: "https://github.com/apple/swift-crypto", from: "4.5.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
.package(url: "https://github.com/apple/swift-openapi-generator", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-openapi-generator", from: "1.6.0"),
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-nio", from: "2.77.0"),
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/swiftlang/swift-subprocess", .upToNextMinor(from: "0.5.0")),
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.23.0"),
.package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.0.0"),
.package(url: "https://github.com/vapor/websocket-kit.git", from: "2.15.0"),
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.3.0"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.6.2"),
.package(url: "https://github.com/attaswift/BigInt", from: "5.5.0"),
.package(url: "https://github.com/mxcl/Version", from: "2.1.0"),
.package(url: "https://github.com/jpsim/Yams", from: "5.1.3"),
.package(url: "https://github.com/saagarjha/unxip", from: "3.2.0"),
// TODO: just depend on tuist/XcodeProj instead
.package(url: "https://github.com/yonaskolb/XcodeGen", from: "2.45.4"),
],
targets: [
.systemLibrary(name: "CSupersette"),
.target(
name: "CSupersign",
name: "CXKit",
dependencies: [
.product(name: "OpenSSL", package: "SuperchargeCore")
.product(name: "OpenSSL", package: "xtool-core")
],
cSettings: cSettings
cSettings: cSettings + (
xtoolVersion
.map { [.define("XTOOL_VERSION", to: "\"\($0)\"")] }
?? []
)
),
.target(
name: "DeveloperAPI",
dependencies: [
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
],
exclude: ["openapi-generator-config.yaml"]
exclude: ["openapi-generator-config.yaml", "patch.js"],
swiftSettings: swiftSettings,
),
// common utilities shared across xtool targets
.target(
name: "XUtils",
dependencies: [
.product(name: "SystemPackage", package: "swift-system"),
.product(
name: "Subprocess",
package: "swift-subprocess",
condition: .when(platforms: [.linux, .macOS])
),
],
swiftSettings: swiftSettings,
),
.target(
name: "Supersign",
name: "XKit",
dependencies: [
"DeveloperAPI",
"CSupersign",
.byName(name: "CSupersette", condition: .when(platforms: [.linux])),
"CXKit",
"XUtils",
.product(name: "XADI", package: "xadi", condition: .when(platforms: [.linux, .macOS])),
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
.product(name: "Dependencies", package: "swift-dependencies"),
.product(name: "SwiftyMobileDevice", package: "SwiftyMobileDevice"),
.product(name: "Zupersign", package: "zsign"),
.product(name: "SignerSupport", package: "SuperchargeCore"),
.product(name: "ProtoCodable", package: "SuperchargeCore"),
.product(name: "Superutils", package: "SuperchargeCore"),
.product(name: "SignerSupport", package: "xtool-core"),
.product(name: "ProtoCodable", package: "xtool-core"),
.product(name: "Superutils", package: "xtool-core"),
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "_CryptoExtras", package: "swift-crypto"),
.product(name: "X509", package: "swift-certificates"),
.product(name: "BigInt", package: "BigInt"),
.product(name: "HTTPTypes", package: "swift-http-types"),
.product(name: "HTTPTypesFoundation", package: "swift-http-types"),
.product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
.product(
name: "OpenAPIAsyncHTTPClient",
@@ -96,40 +151,51 @@ let package = Package(
condition: .when(platforms: [.linux])
),
],
cSettings: cSettings
cSettings: cSettings,
swiftSettings: swiftSettings,
),
.testTarget(
name: "SupersignTests",
name: "XToolTests",
dependencies: [
"Supersign",
.product(name: "SuperutilsTestSupport", package: "SuperchargeCore")
"XKit",
"XToolSupport",
],
exclude: [
"config/config-template.json",
],
resources: [
.copy("config/config.json"),
.copy("config/test.app"),
]
swiftSettings: swiftSettings,
),
.target(
name: "SupersignCLISupport",
name: "XToolSupport",
dependencies: [
"SwiftyMobileDevice",
"Supersign",
.product(name: "PackLib", package: "swiftpack"),
.product(name: "ArgumentParser", package: "swift-argument-parser")
"XKit",
"PackLib",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SystemPackage", package: "swift-system"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "Version", package: "Version"),
.product(name: "libunxip", package: "unxip"),
],
cSettings: cSettings
cSettings: cSettings,
swiftSettings: swiftSettings,
),
.target(
name: "PackLib",
dependencies: [
"XUtils",
.product(name: "Superutils", package: "xtool-core"),
.product(name: "Yams", package: "Yams"),
.product(name: "XcodeGenKit", package: "XcodeGen", condition: .when(platforms: [.macOS])),
],
swiftSettings: swiftSettings,
),
.executableTarget(
name: "SupersignCLI",
name: "xtool",
dependencies: [
"SwiftyMobileDevice",
"Supersign",
"SupersignCLISupport",
"XKit",
"XToolSupport",
],
cSettings: cSettings
cSettings: cSettings,
swiftSettings: swiftSettings,
),
]
)
+43 -19
View File
@@ -1,43 +1,67 @@
# Supersign
# xtool
An all-in-one tool/library for sideloading iOS apps and talking to Apple Developer Services. Supports macOS and Linux.
Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, and macOS.
## Prerequisites
## Overview
- Supersign works out of the box on macOS.
- On Linux, you'll need the development packages of [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice) + its dependencies.
- Alternatively, we provide a Dockerfile that does this for you. See [Linux/README.md](/Linux/README.md).
xtool is a cross-platform (Linux/WSL/macOS) tool that replicates Xcode functionality with open standards.
## Installation (CLI)
✅ Build a SwiftPM package into an iOS app
✅ Sign and install iOS apps
✅ Interact with Apple Developer Services programmatically
## Getting Started
1. Follow the guide to install `xtool`
- [Installation (Linux/Windows)](https://xtool.sh/documentation/xtooldocs/installation-linux)
- [Installation (macOS)](https://xtool.sh/documentation/xtooldocs/installation-macos)
2. Create and run your first xtool-powered app by following the [tutorial](https://xtool.sh/tutorials/xtooldocs/first-app)!
## Examples
### Screenshot
![A screenshot of xtool being invoked from VSCode](Documentation/xtool.docc/Resources/Cover.png)
### Command line interface
```bash
$ git clone https://github.com/SuperchargeApp/Supersign
$ cd Supersign
$ swift run SupersignCLI --help
OVERVIEW: The Supersign command line tool
$ xtool --help
OVERVIEW: Cross-platform Xcode replacement
USAGE: supersign <subcommand>
USAGE: xtool <subcommand>
OPTIONS:
-h, --help Show help information.
SUBCOMMANDS:
CONFIGURATION SUBCOMMANDS:
setup Set up xtool for iOS development
auth Manage Apple Developer Services authentication
sdk Manage the Darwin Swift SDK
DEVELOPMENT SUBCOMMANDS:
new Create a new xtool SwiftPM project
dev Build and run an xtool SwiftPM project
ds Interact with Apple Developer Services
DEVICE SUBCOMMANDS:
devices List devices
install Install an ipa file to your device
uninstall Uninstall an installed app
run Run an installed app
launch Launch an installed app
See 'supersign help <subcommand>' for detailed help.
See 'xtool help <subcommand>' for detailed help.
```
## Installation (Library)
### Library
Just add it as a SwiftPM dependency!
xtool includes a library that you can use to interact with Apple Developer Services, iOS devices, and more from your own app. You can use this by adding `XKit` as a SwiftPM dependency.
```swift
// package dependency:
.package(url: "https://github.com/SuperchargeApp/Supersign", .upToNextMinor(from: "1.2.0"))
.package(url: "https://github.com/xtool-org/xtool", .upToNextMinor(from: "1.2.0"))
// target dependency:
.product(name: "Supersign", package: "Supersign")
.product(name: "XKit", package: "xtool")
```
+5
View File
@@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
To report a vulnerability, please use GitHub's ["Report a Vulnerability"](https://github.com/xtool-org/xtool/security/advisories/new) tab. We'll be in touch regarding next steps.
-4
View File
@@ -1,4 +0,0 @@
module CSupersette [extern_c] {
header "supersette.h"
link "supersette"
}
-13
View File
@@ -1,13 +0,0 @@
#include <stdint.h>
void supersette_Load(const char *path);
int32_t supersette_SetAndroidID(const char *identifier, uint32_t length);
int32_t supersette_SetProvisioningPath(const char *path);
int32_t supersette_ProvisioningErase(uint64_t dsId);
int32_t supersette_Synchronize(uint64_t dsId, const void *serverIntermediateMetadata, uint32_t serverIntermediateMetadataLength, void **machineIdentifier, uint32_t *machineIdentifierLength, void **synchronizationResumeMetadata, uint32_t *synchronizationResumeMetadataLength);
int32_t supersette_ProvisioningDestroy(uint32_t session);
int32_t supersette_ProvisioningEnd(uint32_t session, const void *persistentTokenMetadata, uint32_t persistentTokenMetadataLength, const void *trustKey, uint32_t trustKeyLength);
int32_t supersette_ProvisioningStart(uint64_t dsId, const void *serverProvisioningIntermediateMetadata, uint32_t serverProvisioningIntermediateMetadataLength, void **clientProvisioningIntermediateMetadata, uint32_t *clientProvisioningIntermediateMetadataLength, uint32_t *session);
int32_t supersette_GetLoginCode(uint64_t dsId);
int32_t supersette_Dispose(void *ptr);
int32_t supersette_OTPRequest(uint64_t dsId, void **machineIdentifier, uint32_t *machineIdentifierLength, void **oneTimePassword, uint32_t *oneTimePasswordLength);
@@ -1,6 +1,6 @@
//
// mobileprovision_utils.h
// supersign
// XKit
//
// Created by Kabir Oberai on 05/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
+1
View File
@@ -0,0 +1 @@
const char * _Nonnull xtl_version(void);
@@ -1,6 +1,6 @@
//
// mobileprovision_utils.c
// supersign
// XKit
//
// Created by Kabir Oberai on 05/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
@@ -18,6 +18,8 @@ struct mobileprovision {
static mobileprovision_t mobileprovision_create(PKCS7 *raw) {
mobileprovision_t profile = malloc(sizeof(struct mobileprovision));
if (!profile) return NULL;
profile->raw = raw;
return profile;
}
@@ -41,6 +43,12 @@ void *mobileprovision_copy_data(mobileprovision_t profile, size_t *len) {
if (data_len < 0) return NULL;
*len = data_len;
void *ret = malloc(data_len);
if (!ret) {
OPENSSL_free(data);
return NULL;
}
memcpy(ret, data, data_len);
OPENSSL_free(data);
return ret;
+9
View File
@@ -0,0 +1,9 @@
#include "version.h"
const char *xtl_version(void) {
#ifdef XTOOL_VERSION
return XTOOL_VERSION;
#else
return "unversioned";
#endif
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,8 @@
generate:
- types
- client
accessModifier: package
accessModifier: public
namingStrategy: idiomatic
filter:
tags:
- BundleIds
+109
View File
@@ -0,0 +1,109 @@
#!/usr/bin/env node
import fs from 'fs';
function update(schema, value) {
for (const key in value) {
const val = value[key];
if (val === null) {
delete schema[key];
} else if (Array.isArray(val)) {
schema[key] = (schema[key] ?? []).concat(val);
} else if (typeof val === 'object') {
if (schema[key] === undefined) {
schema[key] = {};
}
update(schema[key], val);
} else {
schema[key] = val;
}
}
}
// in-place update
function replace(schema, value) {
Object.keys(schema).forEach(k => delete schema[k]);
Object.assign(schema, value);
}
function clone(schema) {
return JSON.parse(JSON.stringify(schema));
}
function makeOpen(enumSchema) {
replace(enumSchema, {
anyOf: [
clone(enumSchema),
{ type: 'string' },
]
});
}
function openAll(schema, path = []) {
if (Array.isArray(schema)) {
schema.forEach((s, i) => openAll(s, [...path, i]))
} else if (typeof schema === 'object' && schema !== null) {
const keys = new Set(Object.keys(schema))
if (keys.size === 2
&& keys.has('type')
&& keys.has('enum')
&& schema.type === 'string'
&& Array.isArray(schema.enum)) {
// several polymorphic schemas have a field literally named 'type', that always has a single case.
// skip that instance, but make all other enums open.
if (!(path[path.length - 1] === 'type' && schema.enum.length === 1)) {
makeOpen(schema);
}
} else {
for (const key in schema) {
openAll(schema[key], [...path, key]);
}
}
}
}
function patch(schema) {
const schemas = schema.components.schemas;
// this field is required iff using the private Xcode API
update(schemas.BundleIdCapabilityCreateRequest.properties.data.properties.relationships, {
properties: {
capability: {
type: 'object',
properties: {
data: {
type: 'object',
properties: {
type: {
type: 'string',
enum: ['capabilities'],
},
id: { $ref: '#/components/schemas/CapabilityType' },
},
required: ['id', 'type'],
},
},
required: ['data'],
}
},
})
// we don't use this but it triggers a deprecation warning. see:
// https://github.com/apple/swift-openapi-generator/issues/715
schemas.App.properties.relationships.properties.inAppPurchases.deprecated = false;
// openapi-generator expects response enums to be exhaustive. Apple's ASC OpenAPI spec
// misses some cases that they do, actually, return. So we make all bona fide enums in
// schema.components.schemas open. We don't do this on the schema.paths side because
// most (all?) of the enums in there are on the request side rather than the response.
// https://swiftpackageindex.com/apple/swift-openapi-generator/1.7.2/documentation/swift-openapi-generator/useful-openapi-patterns#Open-enums-and-oneOfs
openAll(schemas);
return schema;
}
const text = fs.readFileSync(process.stdin.fd, 'utf8');
const json = JSON.parse(text);
const patched = patch(json);
const patchedText = JSON.stringify(patched);
console.log(patchedText);
+196
View File
@@ -0,0 +1,196 @@
import Foundation
import Subprocess
import XUtils
import Superutils
public struct BuildSettings: Sendable {
private static let customBinDir =
// this is the same option used by SwiftPM itself for dev builds
ProcessInfo.processInfo.environment["SWIFTPM_CUSTOM_BIN_DIR"].map { FilePath($0) }
public var packagePath: String
public let configuration: BuildConfiguration
public let triple: String
public let buildSystem: BuildSystem
public let customOptions: [String]
public var sdkOptions: [String]
public var sdkEnvironment: [Environment.Key: String?]
private var configOptions: [String] {
return [
"--configuration", configuration.rawValue,
"--build-system", buildSystem.pmName,
"--package-path", packagePath,
]
}
private var resolvedBaseOptions: [String] {
configOptions + sdkOptions + customOptions
}
public init(
configuration: BuildConfiguration,
triple: String,
buildSystem: BuildSystem? = nil,
packagePath: String = ".",
options: [String] = []
) async throws {
self.packagePath = packagePath
self.configuration = configuration
self.customOptions = options
self.triple = triple
self.buildSystem = if let buildSystem { buildSystem } else { try await .default() }
self.sdkEnvironment = [
// xcrun passes an SDKROOT that messes with our sdk configuration
"SDKROOT": nil,
]
switch self.buildSystem {
case .swiftPM:
// on macOS we don't explicitly install a Swift SDK but
// SwiftPM vends "implicit" Darwin SDKs as of Swift 6.1,
// i.e. we can pass `--swift-sdk arm64-apple-ios` and it
// just works. See:
// https://github.com/swiftlang/swift-package-manager/pull/6828
self.sdkOptions = ["--swift-sdk", triple]
case .swiftBuild:
self.sdkOptions = ["--triple", triple]
#if !os(macOS)
let darwinSDK = try DarwinSDK.current()
.orThrow(StringError("No Darwin SDK configured. Please run `xtool setup`."))
self.sdkOptions += [
"--toolset", "\(darwinSDK.bundle.path)/toolset-swb.json",
]
self.sdkEnvironment.merge([
"XCODE_EXTRA_PLATFORM_FOLDERS": "\(darwinSDK.bundle.path)/Developer/Platforms",
]) { $1 }
#endif
}
}
#if os(macOS)
private static func xcrun(_ arguments: [String]) async throws -> String {
let result = try await Subprocess.run(
.path("/usr/bin/xcrun"),
arguments: .init(arguments),
output: .string(limit: .max)
).checkSuccess()
return result.standardOutput?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
}
private static let _swiftURL = Task {
try await FilePath(xcrun(["-f", "swift"]))
}
public static func swiftURL() async throws -> FilePath {
try await _swiftURL.value
}
private static let _swiftcURL = Task {
try await FilePath(xcrun(["-f", "swiftc"]))
}
public static func swiftcURL() async throws -> FilePath {
try await _swiftcURL.value
}
#else
public static func swiftURL() async throws -> FilePath {
try await FilePath(ToolRegistry.locate("swift")).orThrow(StringError("Got bad path for swift executable"))
}
public static func swiftcURL() async throws -> FilePath {
try await FilePath(ToolRegistry.locate("swiftc")).orThrow(StringError("Got bad path for swiftc executable"))
}
#endif
public func withPackagePath(_ path: String) -> Self {
var copy = self
copy.packagePath = path
return copy
}
public func swiftPMInvocation(
forTool tool: String,
arguments: [String],
) async throws -> Subprocess.Configuration {
let executable: Executable
let baseArguments: [String]
if let customBinDir = Self.customBinDir {
executable = .path(customBinDir.appending("swift-\(tool)"))
baseArguments = []
} else {
#if os(macOS)
// xcrun/libxcrun (via the /usr/bin/swift trampoline) is very trigger-happy
// to add SDKROOT=.../MacOSX.sdk to our invocations. We avoid this by
// 1) invoking the real swift executable (located with `xcrun -f`) and
// 2) explicitly removing SDKROOT from the env, as it may be inherited
// through a parent process (e.g. `swift run xtool`).
executable = .path(try await Self.swiftURL())
#else
executable = .name("swift")
#endif
baseArguments = [tool]
}
return Configuration(
executable,
arguments: .init(baseArguments + resolvedBaseOptions + arguments),
environment: .inherit.updating(sdkEnvironment),
platformOptions: .withGracefulShutDown,
)
}
// loosely based on
// https://github.com/swiftlang/sourcekit-lsp/blob/c55899a/Sources/BuildServerIntegration/ExternalBuildServerAdapter.swift#L92
private var baseBuildServerArguments: [String] {
return [
"experimental-build-server",
"--disable-automatic-resolution",
"--scratch-path", ".build/index-build",
// this requires Swift 6.4 but we need 6.4 on Linux anyway, for the platform toolset fixes
"--experimental-skip-acquiring-lock",
]
}
public var buildServerArguments: [String] {
["package"] + baseBuildServerArguments + resolvedBaseOptions
}
public func buildServerInvocation() async throws -> Subprocess.Configuration {
try await swiftPMInvocation(forTool: "package", arguments: baseBuildServerArguments)
}
}
public enum BuildConfiguration: String, CaseIterable, Sendable {
case debug
case release
var swiftBuildValue: String {
switch self {
case .debug: "Debug"
case .release: "Release"
}
}
}
public enum BuildSystem: Sendable {
case swiftPM
case swiftBuild
public static func `default`() async throws -> Self {
if try await SwiftVersion.current.supportsSwiftBuild {
return .swiftBuild
} else {
return .swiftPM
}
}
var pmName: String {
switch self {
case .swiftPM: "native"
case .swiftBuild: "swiftbuild"
}
}
}
+123
View File
@@ -0,0 +1,123 @@
import Foundation
import XUtils
import Subprocess
import Superutils
public struct DarwinSDK {
package struct TemporaryBundle: ~Copyable {
package let url: URL
fileprivate init(url: URL) {
self.url = url
}
package consuming func install() async throws {
guard DarwinSDK(bundle: url) != nil else {
throw StringError("Invalid Darwin SDK at '\(url.path)'")
}
try await DarwinSDK.addHostClangResourceDir(to: url)
let destination = url.deletingLastPathComponent()
.appendingPathComponent("darwin.artifactbundle", isDirectory: true)
try FileManager.default.moveItem(at: url, to: destination)
}
deinit {
try? FileManager.default.removeItem(at: url)
}
}
public enum Flavor {
// can't be updated in place
case slim
// can be updated in place, includes a whole copy of Xcode.app
case normal
// from before the slim/normal split existed (version "develop")
case legacy
}
public let bundle: URL
public let version: String
public let flavor: Flavor
static func swiftPMDirectory(
environment: [String: String] = ProcessInfo.processInfo.environment,
homeDirectory: URL = FileManager.default.homeDirectoryForCurrentUser
) throws -> URL {
if let configurationDirectory = environment["XDG_CONFIG_HOME"] {
guard (configurationDirectory as NSString).isAbsolutePath else {
throw StringError("XDG_CONFIG_HOME must be an absolute path: '\(configurationDirectory)'")
}
return URL(fileURLWithPath: configurationDirectory, isDirectory: true)
.appendingPathComponent("swiftpm", isDirectory: true)
} else {
return homeDirectory.appendingPathComponent(".swiftpm", isDirectory: true)
}
}
private static func swiftSDKsDirectory(
environment: [String: String] = ProcessInfo.processInfo.environment,
homeDirectory: URL = FileManager.default.homeDirectoryForCurrentUser
) throws -> URL {
try swiftPMDirectory(environment: environment, homeDirectory: homeDirectory)
.appendingPathComponent("swift-sdks", isDirectory: true)
}
public init?(bundle: URL) {
self.bundle = bundle
if let version = try? Data(contentsOf: bundle.appendingPathComponent("darwin-sdk-version.txt")) {
self.version = String(decoding: version, as: UTF8.self)
.trimmingCharacters(in: .whitespacesAndNewlines)
} else if ["darwin.xtoolsdk", "darwin.artifactbundle", "darwin.artifactbundle.tmp"].contains(bundle.lastPathComponent) {
self.version = "develop"
} else {
return nil
}
if version == "develop" {
self.flavor = .legacy
} else if bundle.appendingPathComponent("Xcode.app").dirExists {
self.flavor = .normal
} else {
self.flavor = .slim
}
}
package static func prepareTemporaryBundle(
environment: [String: String] = ProcessInfo.processInfo.environment,
homeDirectory: URL = FileManager.default.homeDirectoryForCurrentUser
) throws -> TemporaryBundle {
let sdksDirectory = try swiftSDKsDirectory(environment: environment, homeDirectory: homeDirectory)
try FileManager.default.createDirectory(at: sdksDirectory, withIntermediateDirectories: true)
let bundle = sdksDirectory.appendingPathComponent("darwin.artifactbundle.tmp", isDirectory: true)
if FileManager.default.fileExists(atPath: bundle.path) {
try FileManager.default.removeItem(at: bundle)
}
return TemporaryBundle(url: bundle)
}
private static func addHostClangResourceDir(to sdk: URL) async throws {
let clangURL = try await ToolRegistry.locate("clang")
let process = try await Subprocess.run(
.path(FilePath(clangURL.path)),
arguments: ["-print-resource-dir"],
output: .string(limit: .max)
).checkSuccess()
let output = process.standardOutput ?? ""
let hostClangResources = URL(filePath: output.trimmingCharacters(in: .whitespacesAndNewlines))
let hostInclude = hostClangResources.appending(path: "include")
let sdkInclude = sdk.appending(path: "Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include")
try await FileManager.default.copyItem(at: hostInclude, to: sdkInclude, preserveOwner: false)
}
public static func current() throws -> DarwinSDK? {
let bundle = try swiftSDKsDirectory().appendingPathComponent("darwin.artifactbundle", isDirectory: true)
guard bundle.dirExists else { return nil }
return DarwinSDK(bundle: bundle)
}
public func remove() throws {
try FileManager.default.removeItem(at: bundle)
}
}
+95
View File
@@ -0,0 +1,95 @@
import Foundation
import Yams
import XUtils
public struct PackSchemaBase: Codable, Sendable {
public enum Version: Int, Codable, Sendable {
case v1 = 1
}
public var version: Version
public var orgID: String?
public var bundleID: String?
public var product: String?
public var infoPath: String?
public var entitlementsPath: String?
public var iconPath: String?
public var resources: [String]?
public var extensions: [Extension]?
/// Skip auto-creating the LSP support file if it's missing.
public var skipLSP: Bool?
public struct Extension: Codable, Sendable {
public var product: String
public var bundleID: String?
public var infoPath: String
public var resources: [String]?
public var entitlementsPath: String?
}
}
@dynamicMemberLookup
public struct PackSchema: Sendable {
public typealias Extension = PackSchemaBase.Extension
public enum IDSpecifier: Sendable {
case orgID(String)
case bundleID(String)
func formBundleID(product: String) -> String {
switch self {
case .orgID(let orgID): "\(orgID).\(product)"
case .bundleID(let bundleID): bundleID
}
}
}
public let base: PackSchemaBase
public let idSpecifier: IDSpecifier
public init(validating base: PackSchemaBase) throws {
self.base = base
if base.version != .v1 {
throw StringError("xtool.yml: Unsupported schema version: \(base.version.rawValue)")
}
switch (base.bundleID, base.orgID) {
case (let bundleID?, _):
idSpecifier = .bundleID(bundleID)
case (nil, let orgID?):
idSpecifier = .orgID(orgID)
case (nil, nil):
throw StringError("xtool.yml: Must specify either orgID or bundleID")
}
if let iconPath = base.iconPath {
let ext = URL(fileURLWithPath: iconPath).pathExtension
guard ext == "png" else {
throw StringError("xtool.yml: iconPath should have a 'png' path extension. Got '\(ext)'.")
}
}
}
// swiftlint:disable:next force_try
public static let `default` = try! PackSchema(validating: .init(
version: .v1,
orgID: "com.example"
))
public init(url: URL) async throws {
let data = try await Data(reading: url)
let base = try YAMLDecoder().decode(PackSchemaBase.self, from: data)
try self.init(validating: base)
}
public subscript<Subject>(dynamicMember keyPath: KeyPath<PackSchemaBase, Subject>) -> Subject {
self.base[keyPath: keyPath]
}
}
+241
View File
@@ -0,0 +1,241 @@
import Foundation
import XUtils
import Subprocess
public struct Packer: Sendable {
public let buildSettings: BuildSettings
public let plan: Plan
public init(buildSettings: BuildSettings, plan: Plan) {
self.plan = plan
self.buildSettings = buildSettings
}
private func build() async throws {
let xtoolDir = URL(fileURLWithPath: "xtool")
let packageDir = xtoolDir.appendingPathComponent(".xtool-tmp")
try? FileManager.default.removeItem(at: packageDir)
try FileManager.default.createDirectory(at: packageDir, withIntermediateDirectories: true)
let packageSwift = packageDir.appendingPathComponent("Package.swift")
let contents = """
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "\(plan.app.product)-Builder",
platforms: [
.iOS("\(plan.app.deploymentTarget)"),
],
dependencies: [
.package(name: "RootPackage", path: "../.."),
],
targets: [
\(
plan.allProducts.map {
"""
.executableTarget(
name: "\($0.targetName)",
dependencies: [
.product(name: "\($0.product)", package: "RootPackage"),
],
linkerSettings: \($0.linkerSettings)
)
"""
}
.joined(separator: ",\n")
)
]
)\n
"""
try Data(contents.utf8).write(to: packageSwift)
for product in plan.allProducts {
let sources: URL = packageDir.appendingPathComponent("Sources/\(product.targetName)", isDirectory: true)
try FileManager.default.createDirectory(at: sources, withIntermediateDirectories: true)
try Data().write(to: sources.appendingPathComponent("stub.c", isDirectory: false))
}
let buildConfig = try await buildSettings
.withPackagePath(packageDir.path)
.swiftPMInvocation(
forTool: "build",
arguments: [
"--scratch-path", ".build",
// resolving can cause SwiftPM to overwrite the root package deps
// with just the deps needed for the builder package (which is to
// say, any "dev dependencies" of the root package may be removed.)
// fortunately we've already resolved the root package by this point
// in order to dump the plan, so we can skip resolution here to skirt
// the issue.
"--disable-automatic-resolution",
],
)
try await Subprocess.run(
buildConfig,
output: .currentStandardOutput,
error: .currentStandardError,
)
.checkSuccess()
}
public func pack() async throws -> URL {
try await build()
let output = try TemporaryDirectory(name: "\(plan.app.product).app")
let outputURL = output.url
let binPath: String
switch buildSettings.buildSystem {
case .swiftPM:
binPath = "\(buildSettings.triple)/\(buildSettings.configuration.rawValue)"
case .swiftBuild:
let platformName = buildSettings.triple.contains("simulator") ? "iphonesimulator" : "iphoneos"
binPath = "out/Products/\(buildSettings.configuration.swiftBuildValue)-\(platformName)"
}
let binDir = URL(
fileURLWithPath: ".build/\(binPath)",
isDirectory: true
)
try await withThrowingTaskGroup(of: Void.self) { group in
for product in plan.allProducts {
try pack(
product: product,
binDir: binDir,
outputURL: product.directory(inApp: outputURL),
&group
)
}
while !group.isEmpty {
do {
try await group.next()
} catch is CancellationError {
// continue
} catch {
group.cancelAll()
throw error
}
}
}
let dest = URL(fileURLWithPath: "xtool").appendingPathComponent(outputURL.lastPathComponent)
try? FileManager.default.removeItem(at: dest)
try output.persist(at: dest)
return dest
}
@Sendable private func pack(
product: Plan.Product,
binDir: URL,
outputURL: URL,
_ group: inout ThrowingTaskGroup<Void, Error>
) throws {
@Sendable func packFileToRoot(srcName: String) async throws {
let srcURL = URL(fileURLWithPath: srcName)
let destURL = outputURL.appendingPathComponent(srcURL.lastPathComponent)
try FileManager.default.copyItem(at: srcURL, to: destURL)
try Task.checkCancellation()
}
@Sendable func packFile(srcName: String, dstName: String? = nil, sign: Bool = false) async throws {
let srcURL = URL(fileURLWithPath: srcName, relativeTo: binDir)
let dstURL = URL(fileURLWithPath: dstName ?? srcURL.lastPathComponent, relativeTo: outputURL)
try? FileManager.default.createDirectory(at: dstURL.deletingLastPathComponent(), withIntermediateDirectories: true)
try FileManager.default.copyItem(at: srcURL, to: dstURL)
try Task.checkCancellation()
}
// Ensure output directory is available
try? FileManager.default.createDirectory(at: outputURL, withIntermediateDirectories: true)
for command in product.resources {
group.addTask {
switch command {
case .bundle(let package, let target):
try await packFile(srcName: "\(package)_\(target).bundle")
case .binaryTarget(let name):
let src = URL(fileURLWithPath: "\(name).framework/\(name)", relativeTo: binDir)
let magic = Data("!<arch>\n".utf8)
let thinMagic = Data("!<thin>\n".utf8)
guard let bytes = try? FileHandle(forReadingFrom: src).read(upToCount: magic.count) else {
// if we can't find the binary, it might be a static framework that SwiftPM
// did not copy into the .build directory. we don't need to pack it anyway.
break
}
// if the magic matches one of these it's a static archive; don't embed it.
// https://github.com/apple/llvm-project/blob/e716ff14c46490d2da6b240806c04e2beef01f40/llvm/include/llvm/Object/Archive.h#L33
// swiftlint:disable:previous line_length
if bytes != magic && bytes != thinMagic {
try await packFile(srcName: "\(name).framework", dstName: "Frameworks/\(name).framework", sign: true)
}
case .library(let name):
try await packFile(srcName: "lib\(name).dylib", dstName: "Frameworks/lib\(name).dylib", sign: true)
case .root(let source):
try await packFileToRoot(srcName: source)
}
}
}
if let iconPath = product.iconPath {
group.addTask {
try await packFileToRoot(srcName: iconPath)
}
}
group.addTask {
try await packFile(srcName: product.targetName, dstName: product.product)
}
group.addTask {
var info = product.infoPlist
if product.type == .application {
info["UIRequiredDeviceCapabilities"] = ["arm64"]
info["LSRequiresIPhoneOS"] = true
info["CFBundleSupportedPlatforms"] = ["iPhoneOS"]
}
if let iconPath = product.iconPath {
let iconName = URL(fileURLWithPath: iconPath).deletingPathExtension().lastPathComponent
info["CFBundleIconFile"] = iconName
}
let infoPath = outputURL.appendingPathComponent("Info.plist")
let encodedPlist = try PropertyListSerialization.data(
fromPropertyList: info,
format: .xml,
options: 0
)
try encodedPlist.write(to: infoPath)
}
}
}
extension Plan.Product {
fileprivate var linkerSettings: String {
switch self.type {
case .application: """
[
.unsafeFlags([
"-Xlinker", "-rpath", "-Xlinker", "@executable_path/Frameworks",
]),
]
"""
case .appExtension: """
[
// Link to Foundation framework which implements the _NSExtensionMain entrypoint
.linkedFramework("Foundation"),
.unsafeFlags([
// Set the entry point to Foundation`_NSExtensionMain
"-Xlinker", "-e", "-Xlinker", "_NSExtensionMain",
// Include frameworks that the host app may use
"-Xlinker", "-rpath", "-Xlinker", "@executable_path/../../Frameworks",
// ...as well as our own
"-Xlinker", "-rpath", "-Xlinker", "@executable_path/Frameworks",
]),
]
"""
}
}
}
+448
View File
@@ -0,0 +1,448 @@
import Foundation
import XUtils
import Subprocess
public struct Planner: Sendable {
public var buildSettings: BuildSettings
public var schema: PackSchema
public init(
buildSettings: BuildSettings,
schema: PackSchema
) {
self.buildSettings = buildSettings
self.schema = schema
}
private static let decoder: JSONDecoder = {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
return decoder
}()
// anything older than this requires bundling the stdlib which
// is doable but probably not worth the effort
private static let minSupportedIOSVersion = "13.0"
private func buildGraph() async throws -> PackageGraph {
let dependencyRoot = try await dumpDependencies()
let packages = try await withThrowingTaskGroup(
of: (PackageDependency, PackageDump).self,
returning: [String: PackageDump].self
) { group in
var visited: Set<String> = []
var dependencies: [PackageDependency] = [dependencyRoot]
while let dependencyNode = dependencies.popLast() {
guard visited.insert(dependencyNode.identity).inserted else { continue }
dependencies.append(contentsOf: dependencyNode.dependencies)
group.addTask { (dependencyNode, try await dumpPackage(at: dependencyNode.path)) }
}
var packages: [String: PackageDump] = [:]
while let result = await group.nextResult() {
switch result {
case .success((let dependency, let dump)):
packages[dependency.identity] = dump
case .failure(_ as CancellationError):
// continue loop
break
case .failure(let error):
group.cancelAll()
throw error
}
}
return packages
}
var packagesByProductName: [String: String] = [:]
for (packageID, package) in packages {
for product in package.products ?? [] {
packagesByProductName[product.name] = packageID
}
}
let rootPackage = packages[dependencyRoot.identity]!
return PackageGraph(
root: rootPackage,
packages: packages,
packagesByProductName: packagesByProductName
)
}
public func createPlan() async throws -> Plan {
// TODO: cache plan using (Package.swift+Package.resolved) as the key?
let graph = try await buildGraph()
let app = try await product(
from: graph,
matching: schema.product,
type: .application,
plist: schema.infoPath,
idSpecifier: schema.idSpecifier,
iconPath: schema.iconPath,
rootResources: schema.resources,
entitlementsPath: schema.entitlementsPath
)
let extensionProducts: [Plan.Product]
if let extensions = schema.extensions, !extensions.isEmpty {
extensionProducts = try await withThrowingTaskGroup(of: Plan.Product.self) { group in
for ext in extensions {
group.addTask {
try await product(
from: graph,
matching: ext.product,
type: .appExtension,
plist: ext.infoPath,
idSpecifier: ext.bundleID.flatMap(PackSchema.IDSpecifier.bundleID) ?? .orgID(app.bundleID),
iconPath: nil,
rootResources: ext.resources,
entitlementsPath: ext.entitlementsPath
)
}
}
return try await group.reduce(into: []) { $0.append($1) }
}
} else {
extensionProducts = []
}
return Plan(app: app, extensions: extensionProducts)
}
// swiftlint:disable cyclomatic_complexity function_parameter_count
private func product(
from graph: PackageGraph,
matching name: String?,
type: Plan.ProductType,
plist: String?,
idSpecifier: PackSchema.IDSpecifier,
iconPath: String?,
rootResources: [String]?,
entitlementsPath: String?
) async throws -> Plan.Product {
let library = try selectLibrary(
from: graph.root.products?.filter { $0.type == .autoLibrary } ?? [],
matching: name
)
var resources: [Plan.Resource] = []
var visited: Set<String> = []
var targets = library.targets.map { (graph.root, $0) }
while let (targetPackage, targetName) = targets.popLast() {
guard let target = targetPackage.targets?.first(where: { $0.name == targetName }) else {
throw StringError("Could not find target '\(targetName)' in package '\(targetPackage.name)'")
}
guard visited.insert(targetName).inserted else { continue }
if target.moduleType == "BinaryTarget" {
resources.append(.binaryTarget(name: targetName))
}
if target.resources?.isEmpty == false {
resources.append(.bundle(package: targetPackage.name, target: targetName))
}
for targetName in (target.targetDependencies ?? []) {
targets.append((targetPackage, targetName))
}
for productName in (target.productDependencies ?? []) {
let (package, product) = try graph.product(name: productName)
if product.type == .dynamicLibrary {
resources.append(.library(name: productName))
}
targets.append(contentsOf: product.targets.map { (package, $0) })
}
}
if let rootResources {
resources += rootResources.map { .root(source: $0) }
}
let bundleID = idSpecifier.formBundleID(product: library.name)
let deploymentTarget = graph.root.platforms?.first { $0.name == "ios" }?.version
?? Self.minSupportedIOSVersion
var infoPlist: [String: Sendable] = [
"CFBundleInfoDictionaryVersion": "6.0",
"CFBundleDevelopmentRegion": "en",
"CFBundleVersion": "1",
"CFBundleShortVersionString": "1.0.0",
"MinimumOSVersion": deploymentTarget,
"CFBundleIdentifier": bundleID,
"CFBundleName": library.name,
"CFBundleExecutable": library.name,
"CFBundleDisplayName": library.name,
"CFBundlePackageType": type.fourCharCode,
]
switch type {
case .application:
infoPlist["UIDeviceFamily"] = [1, 2]
infoPlist["UISupportedInterfaceOrientations"] = ["UIInterfaceOrientationPortrait"]
infoPlist["UISupportedInterfaceOrientations~ipad"] = [
"UIInterfaceOrientationPortrait",
"UIInterfaceOrientationPortraitUpsideDown",
"UIInterfaceOrientationLandscapeLeft",
"UIInterfaceOrientationLandscapeRight",
]
infoPlist["UILaunchScreen"] = [:] as [String: Sendable]
case .appExtension:
// Should set default parameters?
infoPlist["NSExtension"] = [:] as [String: Sendable]
}
if let plist {
let data = try await Data(reading: URL(fileURLWithPath: plist))
let info = try PropertyListSerialization.propertyList(from: data, format: nil)
if let info = info as? [String: Sendable] {
infoPlist.merge(info, uniquingKeysWith: { $1 })
} else {
throw StringError("Info.plist has invalid format: expected a dictionary.")
}
}
return Plan.Product(
type: type,
product: library.name,
deploymentTarget: deploymentTarget,
bundleID: bundleID,
infoPlist: infoPlist,
resources: resources,
iconPath: iconPath,
entitlementsPath: entitlementsPath
)
}
private func dumpDependencies() async throws -> PackageDependency {
let tempDir = try TemporaryDirectory(name: "xtool-dump")
let tempFileURL = tempDir.url.appendingPathComponent("dump.json")
// SwiftPM sometimes prints extraneous data to stdout, so ask
// it to write the JSON to a temp file instead. See:
// https://github.com/xtool-org/xtool/pull/97#discussion_r2203618825
_ = try await _dumpAction(
arguments: ["-q", "show-dependencies", "--format", "json", "-o", tempFileURL.path],
path: buildSettings.packagePath
)
return try Self.decoder.decode(
PackageDependency.self,
from: Data(contentsOf: tempFileURL)
)
}
private func dumpPackage(at path: String) async throws -> PackageDump {
let data = try await _dumpAction(arguments: ["-q", "describe", "--type", "json"], path: path)
try Task.checkCancellation()
// As in dumpDependencies, we may end up with extraneous data, but `describe`
// doesn't have a `-o` flag for a clean workaround. Resort to a heuristic,
// looking for the opening brace.
let fromBrace = data.drop(while: { $0 != Character("{").asciiValue })
return try Self.decoder.decode(PackageDump.self, from: fromBrace)
}
private func _dumpAction(arguments: [String], path: String) async throws -> Data {
let dumpConfig = try await buildSettings.withPackagePath(path).swiftPMInvocation(
forTool: "package",
arguments: arguments,
)
return try await Subprocess.run(
dumpConfig,
output: .data(limit: .max),
error: .currentStandardError,
)
.checkSuccess()
.standardOutput
}
private func selectLibrary(
from products: [PackageDump.Product],
matching name: String?
) throws -> PackageDump.Product {
switch products.count {
case 0:
throw StringError("No library products were found in the package")
case 1:
let product = products[0]
if let name, product.name != name {
throw StringError("""
Product name ('\(product.name)') does not match the 'product' value in the schema ('\(name)')
""")
}
return product
default:
guard let name else {
throw StringError("""
Multiple library products were found (\(products.map(\.name))). Please either:
1) Expose exactly one library product, or
2) Specify the product you want via the 'product' key in xtool.yml.
""")
}
guard let product = products.first(where: { $0.name == name }) else {
throw StringError("""
Schema declares a 'product' name of '\(name)' but no matching product was found.
Found: \(products.map(\.name)).
""")
}
return product
}
}
}
public struct Plan: Sendable {
public var app: Product
public var extensions: [Product]
public var allProducts: [Product] {
[app] + extensions
}
public enum Resource: Codable, Sendable, Hashable {
case bundle(package: String, target: String)
case binaryTarget(name: String)
case library(name: String)
case root(source: String)
}
public struct Product: Sendable {
public var type: ProductType
public var product: String
public var deploymentTarget: String
public var bundleID: String
public var infoPlist: [String: any Sendable]
public var resources: [Resource]
public var iconPath: String?
public var entitlementsPath: String?
public var targetName: String {
"\(self.product)-\(self.type.targetSuffix)"
}
public func directory(inApp baseDir: URL) -> URL {
switch type {
case .application:
baseDir
.appendingPathComponent(".", isDirectory: true)
case .appExtension:
baseDir
.appendingPathComponent("PlugIns", isDirectory: true)
.appendingPathComponent(product, isDirectory: true)
.appendingPathExtension("appex")
}
}
}
public enum ProductType: Sendable {
case application
case appExtension
fileprivate var targetSuffix: String {
switch self {
case .application: "App"
case .appExtension: "Extension"
}
}
fileprivate var fourCharCode: String {
switch self {
case .application: "APPL"
case .appExtension: "XPC!"
}
}
}
}
private struct PackageDependency: Decodable {
let identity: String
let name: String
let path: String // on disk
let dependencies: [PackageDependency]
}
private struct PackageDump: Decodable {
enum ProductType: Decodable {
case executable
case dynamicLibrary
case staticLibrary
case autoLibrary
case other
private enum CodingKeys: String, CodingKey {
case executable
case library
}
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
if container.contains(.executable) {
self = .executable
} else if let library = try container.decodeIfPresent([String].self, forKey: .library) {
if library.count == 1 {
switch library[0] {
case "dynamic":
self = .dynamicLibrary
case "static":
self = .staticLibrary
case "automatic":
self = .autoLibrary
default:
self = .other
}
} else {
self = .other
}
} else {
self = .other
}
}
}
struct Product: Decodable {
let name: String
let targets: [String]
let type: ProductType
}
struct Target: Decodable {
let name: String
let moduleType: String
let productDependencies: [String]?
let targetDependencies: [String]?
let resources: [Resource]?
}
struct Resource: Decodable {
let path: String
}
struct Platform: Decodable {
let name: String
let version: String
}
let name: String
let products: [Product]?
let targets: [Target]?
let platforms: [Platform]?
}
private struct PackageGraph {
let root: PackageDump
let packages: [String: PackageDump]
let packagesByProductName: [String: String]
func product(name productName: String) throws -> (PackageDump, PackageDump.Product) {
guard let packageID = packagesByProductName[productName] else {
throw StringError("Could not find package containing product '\(productName)'")
}
guard let package = packages[packageID] else {
throw StringError("Could not find package by id '\(packageID)'")
}
guard let product = package.products?.first(where: { $0.name == productName }) else {
throw StringError("Could not find product '\(productName)' in package '\(packageID)'")
}
return (package, product)
}
}
+6
View File
@@ -0,0 +1,6 @@
package struct StringError: Error, CustomStringConvertible {
package var description: String
package init(_ description: String) {
self.description = description
}
}
+50
View File
@@ -0,0 +1,50 @@
import Subprocess
import Version
import XUtils
public struct SwiftVersion: Sendable {
public var version: Version
public var supportsSwiftBuild: Bool {
version >= Version(6, 4, 0)
}
}
extension SwiftVersion {
private static let cached = Task<Self, Error> {
let outputString: String?
do {
outputString = try await Subprocess.run(
.path(try await BuildSettings.swiftURL()),
arguments: ["--version"],
output: .string(limit: .max)
)
.checkSuccess()
.standardOutput
} catch {
throw StringError("Failed to obtain Swift version")
}
var output = outputString?[...] ?? ""
if output.hasPrefix("Apple ") {
output = output.dropFirst("Apple ".count)
}
guard output.hasPrefix("Swift version ") else {
throw StringError("Could not parse Swift version: '\(output)'")
}
output = output.dropFirst("Swift version ".count)
guard let space = output.firstIndex(of: " ") else {
throw StringError("Could not parse Swift version: '\(output)'")
}
output = output[..<space]
guard let version = Version(tolerant: output) else {
throw StringError("Could not parse Swift version: '\(output)'")
}
return SwiftVersion(version: version)
}
public static var current: Self {
get async throws {
try await cached.value
}
}
}
+47
View File
@@ -0,0 +1,47 @@
import Foundation
import Subprocess
package enum ToolRegistry {
package enum Errors: Error, CustomStringConvertible {
case toolNotFound(String)
package var description: String {
switch self {
case .toolNotFound(let tool):
"Could not find executable '\(tool)' in PATH"
}
}
}
private static let cache = Cache()
/// Obtain the full path to a tool in the user's `PATH`.
///
/// - Throws: `Errors.toolNotFound` if the tool could not be located.
package static func locate(_ tool: String) async throws -> URL {
try await cache.locate(tool: tool)
}
private actor Cache {
private var cache: [String: Task<URL, Error>] = [:]
private func _locate(tool: String) async throws -> URL {
guard let path = try? await Executable.name(tool).resolveExecutablePath(in: .inherit),
let url = URL(filePath: path)
else { throw Errors.toolNotFound(tool) }
return url
}
func locate(tool: String) async throws -> URL {
let task: Task<URL, Error>
if let cached = cache[tool] {
task = cached
} else {
task = Task { try await _locate(tool: tool) }
cache[tool] = task
}
return try await task.value
}
}
}
+164
View File
@@ -0,0 +1,164 @@
#if os(macOS)
import Foundation
import PathKit
import Version
import ProjectSpec
import XcodeGenKit
import XcodeProj
public struct XcodePacker {
public var plan: Plan
public init(plan: Plan) {
self.plan = plan
}
// swiftlint:disable:next function_body_length
public func createProject() async throws -> URL {
let xtoolDir: Path = "xtool"
let projectDir: Path = xtoolDir + ".xtool-tmp"
try? xtoolDir.delete()
try projectDir.mkpath()
let fromProjectToRoot = try Path(".").relativePath(from: projectDir)
guard let deploymentTarget = Version(tolerant: plan.app.deploymentTarget) else {
throw StringError("Could not parse deployment target '\(plan.app.deploymentTarget)'")
}
let emptyText = Data("""
// leave this file empty
""".utf8)
let targets = try plan.allProducts.map { product in
let productDir = projectDir + product.product
try productDir.mkpath()
let emptyFile = productDir + "empty.c"
try emptyFile.write(emptyText)
let infoPath = productDir + "Info.plist"
var plist = product.infoPlist
let families = (plist.removeValue(forKey: "UIDeviceFamily") as? [Int]) ?? [1, 2]
plist["CFBundleExecutable"] = product.targetName
plist["CFBundleName"] = product.targetName
plist["CFBundleDisplayName"] = product.product
let encodedPlist = try PropertyListSerialization.data(fromPropertyList: plist, format: .xml, options: 0)
try infoPath.write(encodedPlist)
var buildSettings: [String: BuildSetting] = [
"PRODUCT_BUNDLE_IDENTIFIER": .string(product.bundleID),
"TARGETED_DEVICE_FAMILY": .string(families.map { "\($0)" }.joined(separator: ",")),
]
if product.type == .appExtension {
buildSettings["APPLICATION_EXTENSION_API_ONLY"] = true
}
if let entitlementsPath = product.entitlementsPath {
buildSettings["CODE_SIGN_ENTITLEMENTS"] = .string((fromProjectToRoot + Path(entitlementsPath)).string)
}
let additionalDependencies: [Dependency] = if product.type == .application {
plan.extensions.map {
Dependency(
type: .target,
reference: $0.targetName
)
}
} else {
[]
}
return Target(
name: product.targetName,
type: product.type == .application ? .application : .appExtension,
platform: .iOS,
deploymentTarget: deploymentTarget,
settings: Settings(buildSettings: buildSettings),
sources: [
TargetSource(
path: try emptyFile.relativePath(from: projectDir).string,
buildPhase: .sources
),
],
dependencies: [
Dependency(
type: .package(products: [product.product]),
reference: "RootPackage"
),
] + additionalDependencies,
info: Plist(
path: try infoPath.relativePath(from: projectDir).string,
attributes: [:]
)
)
}
let project = Project(
name: plan.app.targetName,
targets: targets,
packages: [
"RootPackage": .local(
path: fromProjectToRoot.string,
group: nil,
excludeFromProject: false
),
],
options: SpecOptions(
localPackagesGroup: ""
)
)
// TODO: Handle plan.resources of type .root
// TODO: Handle plan.iconPath
let generator = ProjectGenerator(project: project)
let xcodeproj = projectDir + "\(plan.app.product).xcodeproj"
let xcworkspace = xtoolDir + "\(plan.app.product).xcworkspace"
do {
let current = Path.current
Path.current = xcodeproj.parent()
defer { Path.current = current }
let xcodeProject = try generator.generateXcodeProject(userName: NSUserName())
if let packageRef = xcodeProject.pbxproj.fileReferences.first(where: { $0.name == ".." }) {
for group in xcodeProject.pbxproj.groups {
group.children.removeAll(where: { $0.uuid == packageRef.uuid })
}
xcodeProject.pbxproj.delete(object: packageRef)
}
try xcodeProject.write(path: Path(xcodeproj.lastComponent))
}
do {
let current = Path.current
Path.current = xcworkspace.parent()
defer { Path.current = current }
let xcworkspaceDirectory = xcworkspace.parent()
let fromWorkspaceToSelf = try Path(".").relativePath(from: xcworkspaceDirectory).withName()
let fromWorkspaceToProject = try xcodeproj.relativePath(from: xcworkspaceDirectory).withName()
let workspace = XCWorkspace(data: .init(children: [
.file(.init(location: .container(fromWorkspaceToSelf.string))),
.file(.init(location: .group(fromWorkspaceToProject.string))),
]))
try workspace.write(path: Path(xcworkspace.lastComponent))
}
return xcworkspace.url
}
}
extension Path {
fileprivate func withName() -> Path {
// eg if curr dir is Foo, this converts "." to "../Foo"
// which includes the name in the path, and therefore
// in the Xcode navigator
self.parent() + self.absolute().lastComponent
}
}
#endif
@@ -1,66 +0,0 @@
//
// DeveloperServicesAddAppIDRequest.swift
// Supercharge
//
// Created by Kabir Oberai on 24/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
public struct DeveloperServicesAddAppIDRequest: DeveloperServicesPlatformRequest {
public struct Response: Decodable, Sendable {
let appId: DeveloperServicesAppID
}
public typealias Value = DeveloperServicesAppID
public let platform: DeveloperServicesPlatform
public let teamID: DeveloperServicesTeam.ID
public let bundleID: String
public let appName: String
public let entitlements: Entitlements
public let additionalFeatures: [DeveloperServicesFeature]
public let isFree: Bool
var subAction: String { return "addAppId" }
var subParameters: [String: Any] {
var parameters: [String: Any] = [
"teamId": teamID.rawValue,
"identifier": bundleID,
"name": appName
]
DeveloperServicesAppIDRequestApplier.apply(
entitlements: entitlements,
additionalFeatures: additionalFeatures,
to: &parameters,
isFree: isFree
)
return parameters
}
public func parse(_ response: Response) -> DeveloperServicesAppID {
response.appId
}
public init(
platform: DeveloperServicesPlatform,
teamID: DeveloperServicesTeam.ID,
bundleID: String,
appName: String,
entitlements: Entitlements,
additionalFeatures: [DeveloperServicesFeature],
isFree: Bool
) {
self.platform = platform
self.teamID = teamID
self.bundleID = bundleID
self.appName = appName
self.entitlements = entitlements
self.additionalFeatures = additionalFeatures
self.isFree = isFree
}
}
@@ -1,192 +0,0 @@
//
// DeveloperServicesAddAppOperation.swift
// Supersign
//
// Created by Kabir Oberai on 14/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
public struct DeveloperServicesAddAppOperation: DeveloperServicesOperation {
public enum Error: LocalizedError {
case invalidApp(URL)
case teamNotFound(DeveloperServicesTeam.ID)
public var errorDescription: String? {
switch self {
case .invalidApp(let url):
return url.path.withCString {
String.localizedStringWithFormat(
NSLocalizedString(
"add_app_operation.error.invalid_app", value: "Invalid app: %s", comment: ""
), $0
)
}
case .teamNotFound(let id):
return id.rawValue.withCString {
String.localizedStringWithFormat(
NSLocalizedString(
"add_app_operation.error.team_not_found",
value: "A team with the ID '%s' could not be found. Please select another team.",
comment: ""
), $0
)
}
}
}
}
public let context: SigningContext
public let root: URL
public init(context: SigningContext, root: URL) {
self.context = context
self.root = root
}
/// Registers the app with the given entitlements
private func upsertApp(
bundleID: String,
entitlements: Entitlements,
team: DeveloperServicesTeam,
appIDs: [String: DeveloperServicesAppID]
) async throws -> DeveloperServicesAppID {
if let appID = appIDs[bundleID] {
let request = DeveloperServicesUpdateAppIDRequest(
platform: self.context.platform,
teamID: self.context.teamID,
appIDID: appID.id,
entitlements: entitlements,
additionalFeatures: [],
isFree: team.isFree
)
return try await context.client.send(request)
} else {
let newBundleID = ProvisioningIdentifiers.identifier(fromSanitized: bundleID, context: self.context)
let name = ProvisioningIdentifiers.appName(fromSanitized: bundleID)
let request = DeveloperServicesAddAppIDRequest(
platform: self.context.platform,
teamID: self.context.teamID,
bundleID: newBundleID,
appName: name,
entitlements: entitlements,
additionalFeatures: [],
isFree: team.isFree
)
return try await context.client.send(request)
}
}
/// Registers the app and creates a profile. Returns the resultant entitlements as well as
/// the profile (note that the profile does not necessarily include all of the entitlements
/// that the app has).
private func addApp(
_ app: URL,
team: DeveloperServicesTeam,
appIDs: [String: DeveloperServicesAppID]
) async throws -> ProvisioningInfo {
let infoURL = app.appendingPathComponent("Info.plist")
guard let data = try? Data(contentsOf: infoURL),
let dict = try? PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any],
let bundleID = dict["CFBundleIdentifier"] as? String,
let executable = dict["CFBundleExecutable"] as? String else {
throw Error.invalidApp(app)
}
let executableURL = app.appendingPathComponent(executable)
var entitlements: Entitlements
// if the executable doesn't already have entitlements, that's
// okay. We don't have to throw an error.
if let entitlementsData = try? await context.signerImpl.analyze(executable: executableURL),
let decodedEntitlements = try? PropertyListDecoder().decode(Entitlements.self, from: entitlementsData) {
entitlements = decodedEntitlements
if team.isFree {
// re-assign rather than using updateEntitlements since the latter will
// retain unrecognized entitlements
let filtered = try entitlements.entitlements().filter { type(of: $0).isFree }
entitlements = try Entitlements(entitlements: filtered)
}
} else {
entitlements = try Entitlements(entitlements: [])
}
let appID = try await upsertApp(bundleID: bundleID, entitlements: entitlements, team: team, appIDs: appIDs)
try entitlements.update(teamID: self.context.teamID, bundleID: appID.bundleID)
// set get-task-allow to YES, required for dev certs
try entitlements.updateEntitlements { ents in
if let getTaskAllow = ents.firstIndex(where: { $0 is GetTaskAllowEntitlement }) {
ents[getTaskAllow] = GetTaskAllowEntitlement(rawValue: true)
} else {
ents.append(GetTaskAllowEntitlement(rawValue: true))
}
}
if var entitlementsArray = try? entitlements.entitlements(),
let groupsIdx = entitlementsArray.firstIndex(where: { $0 is AppGroupEntitlement }),
let groupsEntitlement = entitlementsArray[groupsIdx] as? AppGroupEntitlement {
let groups = groupsEntitlement.rawValue
let newGroups = try await DeveloperServicesAssignAppGroupsOperation(
context: self.context,
groupIDs: groups,
appID: appID
).perform()
entitlementsArray[groupsIdx] = AppGroupEntitlement(rawValue: newGroups)
try entitlements.setEntitlements(entitlementsArray)
}
let profile = try await DeveloperServicesFetchProfileOperation(context: self.context, appID: appID).perform()
guard let mobileprovision = profile.mobileprovision
else { throw Mobileprovision.Error.invalidProfile }
return ProvisioningInfo(
newBundleID: appID.bundleID, entitlements: entitlements, mobileprovision: mobileprovision
)
}
private func getTeam() async throws -> DeveloperServicesTeam {
let request = DeveloperServicesListTeamsRequest()
let teams = try await context.client.send(request)
guard let team = teams.first(where: { $0.id == self.context.teamID })
else { throw Error.teamNotFound(self.context.teamID) }
return team
}
// keyed by sanitized bundle ID
private func getCurrentAppIDs() async throws -> [String: DeveloperServicesAppID] {
let request = DeveloperServicesListAppIDsRequest(platform: context.platform, teamID: context.teamID)
let appIDs = try await context.client.send(request)
let keyedIDs = appIDs.map { (ProvisioningIdentifiers.sanitize(identifier: $0.bundleID), $0) }
return Dictionary(keyedIDs, uniquingKeysWith: { $1 })
}
/// Registers the app + its extensions, returning the profile and entitlements of each
public func perform() async throws -> [URL: ProvisioningInfo] {
var apps: [URL] = [root]
let plugins = root.appendingPathComponent("PlugIns")
if plugins.dirExists {
apps += plugins.implicitContents.filter { $0.pathExtension.lowercased() == "appex" }
}
async let teamTask = getTeam()
async let appIDsTask = getCurrentAppIDs()
let (team, appIDs) = try await (teamTask, appIDsTask)
return try await withThrowingTaskGroup(
of: (URL, ProvisioningInfo).self,
returning: [URL: ProvisioningInfo].self
) { group in
for app in apps {
group.addTask {
let info = try await addApp(app, team: team, appIDs: appIDs)
return (app, info)
}
}
return try await group.reduce(into: [:]) { $0[$1.0] = $1.1 }
}
}
}
@@ -1,47 +0,0 @@
//
// DeveloperServiceAppID.swift
// Supercharge
//
// Created by Kabir Oberai on 29/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
import ProtoCodable
public struct DeveloperServicesAppID: Decodable, Sendable {
public struct ID: RawRepresentable, Decodable, Sendable {
public let rawValue: String
public init(rawValue: String) { self.rawValue = rawValue }
}
public let id: ID
public let name: String
public let platform: DeveloperServicesPlatform
public let bundleID: String
public let isWildCard: Bool
private let _features: DeveloperServicesFeatures
public var features: [DeveloperServicesFeature] { return _features.values }
private let _enabledFeatures: [String]?
public var enabledFeatures: [DeveloperServicesFeature.Type] {
guard let enabledFeatures = _enabledFeatures else { return [] }
return enabledFeatures.compactMap { identifier in
let type = ProtoCodableIdentifierMapper.shared.type(
for: identifier, in: DeveloperServicesFeatureContainer.self
)
return type as? DeveloperServicesFeature.Type
}
}
private enum CodingKeys: String, CodingKey {
case id = "appIdId"
case name
case platform = "appIdPlatform"
case bundleID = "identifier"
case isWildCard
case _features = "features"
case _enabledFeatures = "enabledFeatures"
}
}
@@ -1,33 +0,0 @@
//
// DeveloperServicesAppIDRequestApplier.swift
// Supersign
//
// Created by Kabir Oberai on 11/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
enum DeveloperServicesAppIDRequestApplier {
static func apply(
entitlements: Entitlements, additionalFeatures: [DeveloperServicesFeature],
to dict: inout [String: Any], isFree: Bool
) {
var entitlements = entitlements
try? entitlements.updateEntitlements {
$0.removeAll {
let type = Swift.type(of: $0)
return !type.canList || (isFree && !type.isFree)
}
}
dict["entitlements"] = try? entitlements.plistValue()
let entFeatures = (try? entitlements.entitlements().compactMap { $0.feature() }) ?? []
let allFeatures = entFeatures + additionalFeatures
guard let features = try? DeveloperServicesFeatures(values: allFeatures).plistValue() as? [String: Any]
else { return }
dict.merge(features) { a, _ in a }
}
}
@@ -1,35 +0,0 @@
//
// DeveloperServicesDeleteAppIDRequest.swift
// Supercharge
//
// Created by Kabir Oberai on 24/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
public struct DeveloperServicesDeleteAppIDRequest: DeveloperServicesPlatformRequest {
public struct Response: Decodable, Sendable {}
public typealias Value = Response
public let platform: DeveloperServicesPlatform
public let teamID: DeveloperServicesTeam.ID
public let appIDID: DeveloperServicesAppID.ID
var subAction: String { return "deleteAppId" }
var subParameters: [String: Any] {
return ["teamId": teamID.rawValue, "appIdId": appIDID.rawValue]
}
public init(
platform: DeveloperServicesPlatform,
teamID: DeveloperServicesTeam.ID,
appIDID: DeveloperServicesAppID.ID
) {
self.platform = platform
self.teamID = teamID
self.appIDID = appIDID
}
}
@@ -1,35 +0,0 @@
//
// DeveloperServicesListAppIDsRequest.swift
// Supercharge
//
// Created by Kabir Oberai on 24/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
public struct DeveloperServicesListAppIDsRequest: DeveloperServicesPlatformRequest {
public struct Response: Decodable, Sendable {
public let appIds: [DeveloperServicesAppID]
}
public typealias Value = [DeveloperServicesAppID]
public let platform: DeveloperServicesPlatform
public let teamID: DeveloperServicesTeam.ID
var subAction: String { return "listAppIds" }
var subParameters: [String: Any] {
return ["teamId": teamID.rawValue]
}
public func parse(_ response: Response) -> [DeveloperServicesAppID] {
response.appIds
}
public init(platform: DeveloperServicesPlatform, teamID: DeveloperServicesTeam.ID) {
self.platform = platform
self.teamID = teamID
}
}
@@ -1,62 +0,0 @@
//
// DeveloperServicesUpdateAppIDRequest.swift
// Supercharge
//
// Created by Kabir Oberai on 24/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
public struct DeveloperServicesUpdateAppIDRequest: DeveloperServicesPlatformRequest {
public struct Response: Decodable, Sendable {
let appId: DeveloperServicesAppID
}
public typealias Value = DeveloperServicesAppID
public let platform: DeveloperServicesPlatform
public let teamID: DeveloperServicesTeam.ID
public let appIDID: DeveloperServicesAppID.ID
public let entitlements: Entitlements
public let additionalFeatures: [DeveloperServicesFeature]
public let isFree: Bool
var subAction: String { return "updateAppId" }
var subParameters: [String: Any] {
var parameters: [String: Any] = [
"teamId": teamID.rawValue,
"appIdId": appIDID.rawValue
]
DeveloperServicesAppIDRequestApplier.apply(
entitlements: entitlements,
additionalFeatures: additionalFeatures,
to: &parameters,
isFree: isFree
)
return parameters
}
public func parse(_ response: Response) -> DeveloperServicesAppID {
response.appId
}
public init(
platform: DeveloperServicesPlatform,
teamID: DeveloperServicesTeam.ID,
appIDID: DeveloperServicesAppID.ID,
entitlements: Entitlements,
additionalFeatures: [DeveloperServicesFeature],
isFree: Bool
) {
self.platform = platform
self.teamID = teamID
self.appIDID = appIDID
self.entitlements = entitlements
self.additionalFeatures = additionalFeatures
self.isFree = isFree
}
}
@@ -1,38 +0,0 @@
//
// Entitlement+DeveloperServicesFeature.swift
// Supersign
//
// Created by Kabir Oberai on 09/10/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
protocol BaseEntitlementWithFeature: Entitlement {
func baseFeature() -> DeveloperServicesFeature
}
protocol EntitlementWithFeature: BaseEntitlementWithFeature {
associatedtype Feature: DeveloperServicesFeature
func typedFeature() -> Feature
}
extension EntitlementWithFeature {
func baseFeature() -> DeveloperServicesFeature {
return typedFeature()
}
}
extension EntitlementWithFeature
where Self: RawRepresentable,
Feature: RawRepresentable,
RawValue == Feature.RawValue {
func typedFeature() -> Feature {
return Feature(rawValue: rawValue)!
}
}
public extension Entitlement {
func feature() -> DeveloperServicesFeature? {
return (self as? BaseEntitlementWithFeature)?.baseFeature()
}
}
@@ -1,273 +0,0 @@
//
// DeveloperServicesFeatureTypes.swift
// Supercharge
//
// Created by Kabir Oberai on 29/07/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
import ProtoCodable
// swiftlint:disable type_name
extension DeveloperServicesFeatureContainer {
static let supportedTypes: [ProtoCodable.Type] = [
DeveloperServicesCloudKitFeature.self,
DeveloperServicesDataProtectionFeature.self,
DeveloperServicesAccessWifiFeature.self,
DeveloperServicesAppGroupFeature.self,
DeveloperServicesApplePayFeature.self,
DeveloperServicesAssociatedDomainsFeature.self,
DeveloperServicesClassKitFeature.self,
DeveloperServicesAutoFillCredentialFeature.self,
DeveloperServicesGameCenterFeature.self,
DeveloperServicesHealthKitFeature.self,
DeveloperServicesHomeKitFeature.self,
DeveloperServicesHotspotFeature.self,
DeveloperServicesCloudFeature.self,
DeveloperServicesInAppPurchaseFeature.self,
DeveloperServicesInterAppAudioFeature.self,
DeveloperServicesMultipathFeature.self,
DeveloperServicesNetworkExtensionFeature.self,
DeveloperServicesNFCTagReadingFeature.self,
DeveloperServicesPersonalVPNFeature.self,
DeveloperServicesPassbookFeature.self,
DeveloperServicesPushNotificationFeature.self,
DeveloperServicesSiriKitFeature.self,
DeveloperServicesVPNConfigurationFeature.self,
DeveloperServicesWalletFeature.self,
DeveloperServicesWirelessAccessoryFeature.self,
]
}
// MARK: - Special Features
public enum DeveloperServicesCloudKitFeature: Int, DeveloperServicesFeature {
public static let identifier = "cloudKitVersion"
case xcode5Compatible = 1
case cloudKit = 2
}
public enum DeveloperServicesDataProtectionFeature: String, DeveloperServicesFeature {
public static let identifier = "dataProtection"
case off = ""
case complete
case unlessOpen = "unlessopen"
case untilFirstAuth = "untilfirstauth"
}
extension DataProtectionEntitlement: EntitlementWithFeature {
func typedFeature() -> DeveloperServicesDataProtectionFeature {
switch self {
case .complete: return .complete
case .unlessOpen: return .unlessOpen
case .untilFirstAuth: return .untilFirstAuth
}
}
}
// MARK: - Boolean Features
// https://github.com/fastlane/fastlane/blob/master/spaceship/lib/spaceship/portal/app_service.rb
public struct DeveloperServicesAccessWifiFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "AWEQ28MY3E"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesAppGroupFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "APG3427HIY"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension AppGroupEntitlement: EntitlementWithFeature {
func typedFeature() -> DeveloperServicesAppGroupFeature {
.init(rawValue: !rawValue.isEmpty)
}
}
public struct DeveloperServicesApplePayFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "OM633U5T5G"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesAssociatedDomainsFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "SKC3T5S89Y"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension AssociatedDomainsEntitlement: EntitlementWithFeature {
func typedFeature() -> DeveloperServicesAssociatedDomainsFeature {
.init(rawValue: true)
}
}
public struct DeveloperServicesClassKitFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "PKTJAN2017"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesAutoFillCredentialFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "CPEQ28MX4E"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesGameCenterFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "gameCenter"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesHealthKitFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "HK421J6T7P"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension HealthKitEntitlement: EntitlementWithFeature {
typealias Feature = DeveloperServicesHealthKitFeature
}
public struct DeveloperServicesHomeKitFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "homeKit"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension HomeKitEntitlement: EntitlementWithFeature {
typealias Feature = DeveloperServicesHomeKitFeature
}
public struct DeveloperServicesHotspotFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "HSC639VEI8"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesCloudFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "iCloud"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesInAppPurchaseFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "inAppPurchase"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesInterAppAudioFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "IAD53UNK2F"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension InterAppAudioEntitlement: EntitlementWithFeature {
typealias Feature = DeveloperServicesInterAppAudioFeature
}
public struct DeveloperServicesMultipathFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "MP49FN762P"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension MultipathEntitlement: EntitlementWithFeature {
typealias Feature = DeveloperServicesMultipathFeature
}
public struct DeveloperServicesNetworkExtensionFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "NWEXT04537"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension NetworkExtensionEntitlement: EntitlementWithFeature {
typealias Feature = DeveloperServicesNetworkExtensionFeature
}
public struct DeveloperServicesNFCTagReadingFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "NFCTRMAY17"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesPersonalVPNFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "V66P55NK2I"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesPassbookFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "passbook"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesPushNotificationFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "push"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension APSEnvironmentEntitlement: EntitlementWithFeature {
func typedFeature() -> DeveloperServicesPushNotificationFeature {
.init(rawValue: true)
}
}
public struct DeveloperServicesSiriKitFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "SI015DKUHP"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension SiriKitEntitlement: EntitlementWithFeature {
typealias Feature = DeveloperServicesSiriKitFeature
}
public struct DeveloperServicesVPNConfigurationFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "V66P55NK2I"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension VPNConfigurationEntitlement: EntitlementWithFeature {
typealias Feature = DeveloperServicesVPNConfigurationFeature
}
public struct DeveloperServicesWalletFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "pass"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
public struct DeveloperServicesWirelessAccessoryFeature: DeveloperServicesFeature, RawRepresentable {
public static let identifier = "WC421J6T7P"
public let rawValue: Bool
public init(rawValue: Bool) { self.rawValue = rawValue }
}
extension WirelessAccessoryEntitlement: EntitlementWithFeature {
typealias Feature = DeveloperServicesWirelessAccessoryFeature
}
@@ -1,16 +0,0 @@
//
// DeveloperServicesFeatures.swift
// Supercharge
//
// Created by Kabir Oberai on 19/09/19.
// Copyright © 2019 Kabir Oberai. All rights reserved.
//
import Foundation
import ProtoCodable
struct DeveloperServicesFeatureContainer: ProtoCodableContainer {
var value: DeveloperServicesFeature
}
typealias DeveloperServicesFeatures = ProtoCodableKeyValueContainer<DeveloperServicesFeatureContainer>

Some files were not shown because too many files have changed in this diff Show More