Mysterious compile error with Marathon(works fine inside of Xcode8, not in Xcode 9)
codeOfRobin opened this issue · 11 comments
Hey John!
Ran into a problem running my marathon script inside of Xcode 9. As far as I can tell, it compiles and runs fine in the Xcode 9, but when I run
➔ marathon run createSession
💥 Failed to compile script
Here's the script for your reference: https://gist.github.com/codeOfRobin/247f8e0f19ffaa97ec4990a7f00f7871
Hi @codeOfRobin! 👋 The reason your script fails to compile (which we should totally add a much better error message for) is because one of your dependencies - Commander - doesn't support the Swift 4 version of the Swift Package Manage, which Xcode 9 ships with. Swift 4 uses a new format for Package.swift
, which all your dependencies need to use in order for you to be able to run the script using Swift 4.
Hope this helps, and we should catch those SPM errors and display them in a nicer way.
Hi @JohnSundell since today I have the same issue, but with Files
and ShellOut
:
marathon run ciao.swift --verbose
🏃 $ cd "/Users/alessioroberto/.marathon/Scripts/Cache/-Users-alessioroberto-ciao/" && readlink OriginalFile
/Users/alessioroberto/ciao.swift
$ cd "/Users/alessioroberto/" && /usr/bin/env xcrun --sdk macosx swift --version
Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Target: x86_64-apple-macosx10.9
$ cd "/Users/alessioroberto/.marathon/Scripts/Cache/-Users-alessioroberto-ciao/" && /usr/bin/env xcrun --sdk macosx swift build -C /Users/alessioroberto/.marathon/Scripts/Cache/-Users-alessioroberto-ciao/ --enable-prefetching
swift-build: error: unsatisfiable
💥 Failed to compile script
But I'm using swift 3.1 and I tried to remove and add again both Packages.
What I missed?
Thanks!
@darthpelo the problem might be that Files & ShellOut now use Swift 4 🤔 We really need a way to pin package versions I think, especially since SPM changes so much between Swift releases. If you go into the /Users/alessioroberto/.marathon/Scripts/Cache/-Users-alessioroberto-ciao/
folder, what does the content of Package.resolved
look like?
@JohnSundell there's not the file, probably because the error?
cat Package.pins
{
"autoPin": true,
"pins": [
{
"package": "Files",
"reason": null,
"repositoryURL": "https://github.com/JohnSundell/Files.git",
"version": "2.0.0"
}
],
"version": 1
}%
cat Package.swift
// swift-tools-version:3.1
import PackageDescription
let package = Package(
name: "ciao",
dependencies: [
.Package(url: "https://github.com/JohnSundell/Files.git", majorVersion: 2),
.Package(url: "https://github.com/JohnSundell/ShellOut.git", majorVersion: 2)
],
swiftLanguageVersions: [3]
)%
For sure switching between Xcode 8.3.3 and Xcode 9.1 doesn't help. I also tried to remove all the Packages and Scripts.
It's definitely because of Swift 4. I wouldn't use Marathon using Swift 3.x anymore if possible. I won't be able to support both Swift versions and will focus on Swift 4 going forward. If you use Xcode 9.1 you should get Swift 4 though, which is interesting. What happens if you remove your .marathon
folder after switching Xcode versions, do you get the same problem?
I tried and...
marathon run ciao.swift --verbose
🏃 Updating packages...
$ cd "/Users/alessioroberto/" && /usr/bin/env xcrun --sdk macosx swift --version
Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38)
Target: x86_64-apple-macosx10.9
$ cd "/Users/alessioroberto/.marathon/Packages/Generated/" && /usr/bin/env xcrun --sdk macosx swift package --enable-prefetching update
error: package at '/Users/alessioroberto/.marathon/Packages/Generated' requires a minimum Swift tools version of 4.0.2 (currently 4.0.0)
💥 Failed to update packages
👉 Make sure you have write permissions to the folder '/Users/alessioroberto/.marathon/Packages/'
swift --version
Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38)
Target: x86_64-apple-macosx10.9
I double checked and right now there are only the command line tools for Xcode 9.2 and 9.0.1, not for 9.1 🤔
Ah, update to the latest master - I just fixed that bug 😅
I removed the version installed with brew and follow the SPM procedure to install, but nothing change unfortunately.
🏃 $ cd "/Users/alessioroberto/.marathon/Scripts/Cache/-Users-alessioroberto-ciao/" && readlink OriginalFile
/Users/alessioroberto/ciao.swift
$ cd "/Users/alessioroberto/" && /usr/bin/env xcrun --sdk macosx swift --version
Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38)
Target: x86_64-apple-macosx10.9
$ cd "/Users/alessioroberto/.marathon/Scripts/Cache/-Users-alessioroberto-ciao/" && /usr/bin/env xcrun --sdk macosx swift build -C /Users/alessioroberto/.marathon/Scripts/Cache/-Users-alessioroberto-ciao/ --enable-prefetching
warning: '--chdir/-C' option is deprecated; use '--package-path' instead
error: package at '/Users/alessioroberto/.marathon/Scripts/Cache/-Users-alessioroberto-ciao' requires a minimum Swift tools version of 4.0.2 (currently 4.0.0)
💥 Failed to compile script
But I think it's not an issue on marathon side. In Downloads for Apple Developers page the Command Line Tools for Xcode 9.1 is missed, but Xcode 9.1 introduced Swift 4.0.2 🤦♂️
@JohnSundell my bad! I did not delete the Users-alessioroberto-ciao before made the test! Now it works!
Hi @JohnSundell, why i can't install your XcodeTheme via Marathon ? I get next error
What could be the problem ? Thanks!
We now support only Swift 4.1 and Xcode 9.3+, and everything seems to be working 🎉