JohnSundell / Marathon

[DEPRECATED] Marathon makes it easy to write, run and manage your Swift scripts 🏃
MIT License
1.86k stars 78 forks source link

Mismatch between Swift version and tools version #137

Closed seanlabastille closed 7 years ago

seanlabastille commented 7 years ago
In Xcode 9.1 (9B55) it appears there is a mismatch between the Swift version (4.0.2) and the Swift package manager version (4.0.0) ``` 17-11-01 14:01:48 ➜0 ~ xcodebuild -version Xcode 9.1 Build version 9B55 17-11-01 14:01:56 ➜ ~ xcrun swift --version Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38) Target: x86_64-apple-macosx10.9 17-11-01 14:02:05 ➜ ~ xcrun swift build --version Apple Swift Package Manager - Swift 4.0.0-dev (swiftpm-13502) 17-11-01 14:02:11 ➜ ~ xcrun swift package --version Apple Swift Package Manager - Swift 4.0.0-dev (swiftpm-13502) ```

This causes issues when using Marathon as the header for the generated Package.swift file is incorrect.

https://github.com/JohnSundell/Marathon/blob/1276bedbd4c1aa86e61427fe1f0f68d5427011c4/Sources/MarathonCore/PackageManager.swift#L415

marathon run Script.swift --verbose                                                 
🏃  $ cd "/Users/sean/.marathon/Scripts/Cache/-Users-sean-Documents-Script/" && readlink OriginalFile
   /Users/sean/Documents/Script.swift
   $ cd "/Users/sean/Documents/" && /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/sean/.marathon/Scripts/Cache/-Users-sean-Documents-Script/" && /usr/bin/env xcrun --sdk macosx swift build -C /Users/sean/.marathon/Scripts/Cache/-Users-sean-Documents-Script/ --enable-prefetching 
   warning: '--chdir/-C' option is deprecated; use '--package-path' instead
   error: package at '/Users/sean/.marathon/Scripts/Cache/-Users-sean-Documents-Script/' requires a minimum Swift tools version of 4.0.2 (currently 4.0.0)
💥  Failed to compile script

It seems to me that the version checks for the Swift compiler and SPM might need to be separated.

rmirabelli commented 7 years ago

I've submitted a pull request (#138) against this issue. It's got some junk mixed in which I'm sorry for, but I had to get a version working quickly. You're welcome to do with this as you please.

Thanks, though, for pointing out where the problem was. It accelerated the "fix" quite a bit.

(I'd personally like to maybe see a regex against the version string, because right now it feels very brittle)

JohnSundell commented 7 years ago

Fixed! Will submit a new version to Homebrew ASAP, in the meantime you can install the latest master go get around this problem 👍 Thanks for reporting it @flufff42 🙏

machinefixer commented 7 years ago

Still happened on macOS High Sierra 10.13.1 with master branch, same output as @flufff42 's, my Xcode version is 9.1, swift version is Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38), swift package manager version is Apple Swift Package Manager - Swift 4.0.0-dev (swiftpm-13502)

sandeee1928 commented 6 years ago

I'm also facing the same issue on macOS High Sierra with marathon-swift version 1.0.1.

viktor-malieichyk commented 6 years ago

Still have the same issue on macos 10.13.3 Installed marathon with swift package manager

Ashton-W commented 6 years ago

1.0.1 is the latest version of Marathon on homebrew, which has this issue. It's also the first listed installation option.

ghost commented 6 years ago

Still have same issue.

psaitu commented 6 years ago

I had the same issue, fixed it by uninstalling the brew package and installing the latest '2.0.2' directly from the repo.

ffittschen commented 6 years ago

Had the same issue, even after reinstalling Marathon 2.0.2 with mint. Deleting the ~/.marathon folder resolved the issue for me

breferrari commented 6 years ago

I'm having the same issue here... Deleting ~/.marathon didn't solve the problem.