Hi, this might just be my naivity about SPM usage. I have my own custom built compiler with patches that I need. The swift source and dependencies are checked out in the usual way, using utils/update-checkout.sh with the release/5.8 branch. So I've got the directories next to each other cmark, llvm-project, swift, llbuild, swift-driver, swift-syntax, swift-system, swiftpm, yams... etc. I successfully did a build, which made build and applied my patches into the swift source folder and rebuilt binaries, which are now in build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin as you'd expect. swift-frontend and the usual symlinks. The compiler works, all is good.
I then built swiftpm in its own directory just using swift build and have a working swiftpm in swiftpm/.build/debug as normal. I added both the swift and swiftpm directories to the front of my PATH and did some basic tests to make sure that from the command line swift and swift package are now calling the versions that I built (not the ones bundled in Xcode on my mac).
I used swift package init to create a basic project, added some code and tried to compile it with swift build -v. The problem is that for some reason, it then falls back to using swiftc from Xcode, presumably picking it up from a global mac setting...
/Applications/Xcode-14.2.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -module-name blink -incremental -emit-dependencies -emit-module ...
It's a simple enough question! ... How do I get swiftpm to use my custom swift compiler to do its build? It should at least be respecting the PATH variable? (I've confirmed that in the shell, PATH works fine and my custom swiftc is always run, not one from Xcode.)
Thanks for any help or pointers you can give!
Regards,
Carl
The bonus/follow on question... I realised that part of how SPM works is it compiles my Package.swift first to make a blink-manifest MachO executable... and that compilation step might need swiftc from a system location such as Xcode (I'm not sure)... but to be honest, if it tries to run my custom compiler for both that's fine. It will just mean I might need to fix bits on my customer compiler, which is no bad thing!