JohnSundell / Marathon

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

Can't create scripts with SourceKitten as a dependency #143

Closed dabrut closed 7 years ago

dabrut commented 7 years ago

It seems like I can add SourceKitten as a dependency using

marathon add https://github.com/jpsim/SourceKitten.git

but when I try to create a script using

marathon create helloWorld --verbose

I get this error

🏃  $ cd "/Users/bruno/.marathon/Scripts/Cache/-Users-bruno-Documents-Scripts-helloWorld/" && readlink OriginalFile
   /Users/bruno/Documents/Scripts/helloWorld.swift
   $ cd "/Users/bruno/Documents/Scripts/" && /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/bruno/.marathon/Scripts/Cache/-Users-bruno-Documents-Scripts-helloWorld/" && /usr/bin/env xcrun --sdk macosx swift package generate-xcodeproj
   error: product dependency 'SourceKitten' not found
💥  Failed to open script 'helloWorld' for editing
👉  Make sure that it exists and that its file is readable

This is the content of ~/.marathon/Packages and SourceKitten is in there.

screen shot 2017-11-05 at 4 37 55 pm

Not really sure what's happening here 🤔

JohnSundell commented 7 years ago

Thanks for opening an issue, so much easier than on Twitter 😅 Did you install Marathon through Homebrew or are you using the latest master?

dabrut commented 7 years ago

Haha totally. I just wanted to make sure that it should work before opening an issue 😄 .

I built it myself by pulling master and using the Swift Package Manager. I followed the steps that are on the README.

JohnSundell commented 7 years ago

Alright, I can reproduce it locally here. Will look into it a bit and let you know what I find 😄

dabrut commented 7 years ago

Oh great. Thanks John

JohnSundell commented 7 years ago

This is intriguing, but it seems to be a problem with SourceKitten rather than Marathon. I just created a brand new Swift Package and added SourceKitten to its Package.swift, and I get the exact same error:

error: product dependency 'SourceKitten' not found

Looking at the SourceKitten repo, it looks like they are using an interesting way of supporting both Swift 3.x and Swift 4 that I haven't seen before (using a @swift-4 suffix on the Package.swift file).

So I'd open an issue with SourceKitten for this, since it seems that their SPM support is broken in general. Once that issue it fixed there should be no problems adding it to Marathon 👍

dabrut commented 7 years ago

Interesting. Thanks a lot for looking into this 👍 I'll close this issue since it's not related to Marathon.

JohnSundell commented 7 years ago

No problems 🙂