Repository navigation
[WIP] v2.0.0 - #449
[WIP] v2.0.0#449kabiroberai wants to merge 29 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
## What does this PR do? Since pre/2.x is now open as a PR (#449) we get CI checks for it that way instead. ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [ ] **0** - No AI was used to write code - [x] **1** - I was assisted by AI in writing code. 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. -->
## What does this PR do? Works around #351 (comment) ## How was it tested? Tested against the Examples/ projects on macOS and Linux (Docker) ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [ ] **0** - No AI was used to write code - [x] **1** - I was assisted by AI in writing code. 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. -->
|
Thanks! Using this branch I was able to build and sign comaps from linux (see here for write-up https://thefriendlyghost.nl/building-comaps-on-linux) |
## What does this PR do? On Linux, apps linked through clang, like the app target of an Xcode project, fail when they need the Swift compatibility libraries (for example `libswiftCompatibility56` when a dependency targets iOS 15), because Swift Build looks for them next to the host toolchain. This sets `SWIFT_LIBRARY_PATH` to the SDK's Swift libraries for the destination platform. <!-- Focus on *what* the PR does in essence. The *how* should come second, if it's relevant. --> ## How was it tested? Built a Capacitor app's Xcode project whose plugins target iOS 15 <!-- e.g. Ran locally on macOS and added unit tests --> ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [x] **0** - No AI was used to write code - [ ] **1** - I was assisted by AI in writing code. 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. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Non-macOS builds now use the platform-specific Swift library location within the Swift resources. This improves library resolution during builds on those platforms. The change is limited to build behavior; no user-facing interface changes are included. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Anish Pallati <i@anish.land>
## What does this PR do? <!-- Focus on *what* the PR does in essence. The *how* should come second, if it's relevant. --> xtool only recognizes Swift toolchains whose resource directory ends in `usr/lib/swift` or `usr/local/lib/swift`, so it rejects toolchains installed directly into a prefix (like the one in Nixpkgs, where it's `<prefix>/lib/swift`). This accepts `lib/swift` as well and uses the prefix as the toolchain root. ## How was it tested? <!-- e.g. Ran locally on macOS and added unit tests --> I tested this by packaging `pre/2.x` with Nix, where the test suite passes and `xtool dev build` runs with Nixpkgs' Swift. ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [x] **0** - No AI was used to write code - [ ] **1** - I was assisted by AI in writing code. 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. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved Swift toolchain detection for runtime resource paths ending in `/lib/swift`, allowing the app to identify the corresponding toolchain root. * Improved compiler path selection so the app uses the Swift compiler associated with the configured toolchain when preparing for hot reload. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Anish Pallati <i@anish.land>
## What does this PR do? Fixes Metal compilation. Adds a `MetalTool` that forwards to `xcrun metal`. Supersedes #462. ## How was it tested? - [x] Linux: build fails - [x] macOS: Metal not installed: build fails - [x] macOS: Metal installed: builds and DemoMetal passes ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [ ] **0** - No AI was used to write code - [x] **1** - I was assisted by AI in writing code. 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. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added a DemoMetal example that checks the output of a Metal compute kernel. * Metal compilation can use the system’s Metal compiler on macOS. * **Known Limitations** * DemoMetal verification currently runs only on macOS. Metal compilation is unsupported on Linux. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What does this PR do? Just some code shuffling. Factors out `makeBuildRequest()` from `init`. swiftlint was also complaining that init was too long before, and the nesting wasn't great. ## How was it tested? - [x] CI ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [x] **0** - No AI was used to write code - [ ] **1** - I was assisted by AI in writing code. 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. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Refactor** * Build setup now gathers project, target, and runtime details from the build description while retaining existing build configuration and platform-specific behavior. * Hot-reload configuration is carried with the build description and applied during build setup. * **Documentation** * Clarified that hot reload requires a build configured as hot-reloadable. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
@cvanelteren thanks for sharing! I took inspiration from your post to add official Metal support on Linux in #471. Setup is just: |
Cool! There are still some other libs that had to be added too but the metal work around was a bit jank that I added lol. thanks |
👀 do you mean actool/ibtool or other metal libs? Curious whether there's anything else needed on the Metal side, other than the patch in #471. From my testing, I didn't need to translate paths or shim |
## What does this PR do? Adds Metal support on Linux by running Metal Developer Tools for Windows under Wine. Got the idea from #449 (comment). ## How was it tested? Tested in Docker on Apple Silicon. Used [Hangover](https://github.com/AndreRH/hangover), which adds x64-on-arm64 emulation to Wine via FEX. - [x] Can install/remove/query Metal toolchain on Linux - [x] Can build DemoMetal, and it passes successfully - [x] macOS host builds continue to work ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [x] **0** - No AI was used to write code - [ ] **1** - I was assisted by AI in writing code. 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. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added commands to install, uninstall, and check the status of the Metal toolchain. * Metal tool invocations can use the managed toolchain on supported non-macOS platforms. If it isn’t installed, the command reports an error. * On macOS, the commands display the corresponding Xcode build alternatives, while Metal tools continue to run through the system toolchain. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
yes! |
## What does this PR do? Updates to fix handling of codeless & static frameworks. Supersedes #464. ## How was it tested? - [x] Built an app that depends on Sentry's static xcframework on Linux ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [x] **0** - No AI was used to write code - [ ] **1** - I was assisted by AI in writing code. 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. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Updates** * Updated the bundled Darwin tools to version 1.2.0. * The codesign command now accepts the `--generate-pre-encrypt-hashes` option, but it does not generate hashes. * **Compatibility** * Tool installation no longer renames the downloaded `libtool` executable. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What does this PR do? Fixes PIF generation for intentdefinition, achieving parity with `xcodebuild -dumpPIF`. Fixes #476. ## How was it tested? - [x] Unit tests - [x] Built [Soup Chef](https://developer.apple.com/documentation/SiriKit/soup-chef-accelerating-app-interactions-with-shortcuts) on macOS ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [ ] **0** - No AI was used to write code - [x] **1** - I was assisted by AI in writing code. 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. -->
## What does this PR do? Purely a code refactor ## How was it tested? - [x] Unit tests - [x] Build sample projects ## AI tool usage How much of the code in this PR was AI-assisted? (check one) - [ ] **0** - No AI was used to write code - [x] **1** - I was assisted by AI in writing code. 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. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Improvements** * File and folder types are now handled more consistently, including improved matching for known types and their relationships. * Project conversion better recognizes source languages, routes files to appropriate build phases, and applies default visibility to generated code. * Text encoding is handled according to file type, with clearer errors when a text file’s encoding cannot be represented. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This PR tracks v2.0.0, it's intended for visibility more than for review. PRs will be stacked on top of this and merged into this branch as they're reviewed. Once 2.x is stable, I'll merge this branch into main with a merge commit (not squash) to preserve history.
Installing
To try v2.0.0 beta:
brew install xtool-org/tap/xtool@betaChangelog
Xcode project support
xtool can now build Xcode projects (
xcodeproj,xcworkspace). This aims to be 1:1 with Xcode on macOS (ideally, except niche edge cases). On Linux/WSL we don't yet support some tools (asset catalogs, app intents, storyboards) but many of these will come in future releases.Hot reloading
On macOS, you can run
xtool dev -wto launch your app in the simulator in hot-reload mode. When you save changes, it'll automatically update the running app using the same underlying approach as Injection.Unlike Injection, if you're using SwiftUI, this requires no changes to your code. Views will automatically refresh as you edit them!
Massive performance gains
xtool can build Xcode projects 2-3x faster than
xcodebuildin many cases. Further improvements are in the works (pending stabilization), which will make warm builds up to 15x faster thanxcodebuild.Overhauled build system
The secret sauce behind all of this: xtool now directly speaks to SwiftBuild, rather than going through SwiftPM (caveat: we still rely on SwiftPM for package resolution but hopefully not for long). The packaging logic now shares its roots with Xcode, so there should be far fewer discrepancies, resolving many open issues.
Build Mac apps and more
You can now build macOS apps with
xtool dev build --triple arm64-apple-macosx!This is thanks to the aforementioned build system overhaul. No support for signing Mac apps yet, or for building watchOS/tvOS/other platforms. But those are far easier to add now.
Other stuff
Related issues
xtool devfails on macOS with packages using platform-conditional target dependencies (e.g. swift-crypto) #433AI tool usage
How much of the code in this PR was AI-assisted? (check one)