JohnSundell / Marathon

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

Integrate ImportSpecification to support swift-sh style of imports #199

Closed alexito4 closed 5 years ago

alexito4 commented 5 years ago

Hi! I've been working on improving the compatibility of different Swift scripting tools. I wanted to be able to use swift-sh and Marathon with the same script without having to change anything, including the import statements.

The style of the comment that Marathon uses is different than the one that swift-sh uses:

import Files // marathon:https://github.com/JohnSundell/Files.git

vs.

import Files // JohnSundell/Files ~> 2.2

I've factored out the parsing logic from swift-sh and created a separate package for it alexito4/ImportSpecification so different tools can use the same syntax.

This PR integrates this package with Marathon while keeping the current syntax available, so it's not a breaking change. The changes are quite minimal, and ImportSpecification itself is quite small, taken directly from swift-sh code.

Let me know what you think, I have a PR against swift-sh also. I've given it a try ant is really nice to be able to work with swift-sh, but then use all the power of Marathon to edit with Xcode or create binaries.

Thanks for considering it.

orta commented 5 years ago

Cool, yeah, this seems good to me.

The linter stuff we can live without.

alexito4 commented 5 years ago

Thanks @orta ^^ I guess is better to wait and see how mxcl/swift-sh/pull/44 is resolved.

JohnSundell commented 5 years ago

Hey @alexito4, thanks a lot for this contribution! However, I'm not too keen on adding any third party dependencies to Marathon, since maintaining this repository is already difficult enough as it is - and I'm afraid having to maintain the connection point to an external dependency would be more costly than beneficial in this instance. I'm all for making Marathon and swift-sh more compatible, but since Marathon has a more limited scope of supporting dependencies than swift-sh, how about simply inlining the code required for the compatibility here in the Marathon codebase - instead of adding a dependency? I'd like that a lot more πŸ™‚

JohnSundell commented 5 years ago

I see that @mxcl had similar concerns as me in the swift-sh PR. Again, I'm all for compatibility, so if you want to take some of the changes you implemented in your own repo and put them here in Marathon as a separate PR, then go for it πŸ˜„ Note that those change should be implemented without version pinning, as Marathon currently doesn't support this -- and that's a bigger and separate discussion/changes that I'm not ready for ATM πŸ™‚

alexito4 commented 5 years ago

Hi @JohnSundell , Yes don't worry about it ^^ I had a similar conversation with Max and I completely understand. I hope in a not so far future SPM can take some of this responsibilities to have a more unified ecosystem. I will take a look at integrating the changes directly in Marathon, I'm just now sure how appealing is that if swift-sh changes the syntax, but I guess is not something that will change a lot so it may still be worth. Thanks for considering it πŸ‘