OmniSharp / omnisharp-emacs

Troll coworkers - use Emacs at work for csharp!
GNU General Public License v3.0
514 stars 90 forks source link

Automatic installation of server binaries #275

Open razzmatazz opened 7 years ago

razzmatazz commented 7 years ago

At least VS Code and Atom do this.

The code isn't pretty but its here https://github.com/OmniSharp/omnisharp-node-client/blob/0fa4cfbff6782420057ef731fbf4311fc376061e/lib/helpers/runtime.ts

TODO list:

mikavilpas commented 7 years ago

Definitely :+1: Installation has always been a pain in the ass.

mikavilpas commented 7 years ago

Just a thought: we basically do some kind of installation already, I mean for our travis build. I wonder if we could port that logic to elisp, and then the travis build could work basically the same way. But then we'd have the benefit of having an automatic installation as well.

And it would continuously get tested too, which is a huge thing!

razzmatazz commented 7 years ago

Partially implemented, works on macOS (for me). Should be OK for Linux too. Needs little work on Windows.

Didn't apear to be THAT hard to implement as I feared, actually.

razzmatazz commented 7 years ago

And yes, we should do the same thing on travis build. Definitely next on the list (with Windows implementation) @sp3ctum

razzmatazz commented 7 years ago

Actually extracting a zip on emacs/windows installation appears to be problematic, unless you expect the user to download and extract unzip.exe to a known location... I'd wish to implement something that would work automatically, w/o any involvement of a user, even on Windows....

razzmatazz commented 7 years ago

really don't want to write a pkzip parser in elisp, unless thats the last resort..

mikavilpas commented 7 years ago

Would it work if the installation first downloaded unzip and then the server package?

On Jul 15, 2017 14:32, "Saulius Menkevičius" notifications@github.com wrote:

really don't want to write pkzip parser in elisp, unless thats the last resort..

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OmniSharp/omnisharp-emacs/issues/275#issuecomment-315528300, or mute the thread https://github.com/notifications/unsubscribe-auth/AASW95Yl0kOoh8uDNmIIfOJ4oc3gPxCtks5sOKNHgaJpZM4MDbJo .

razzmatazz commented 7 years ago

@sp3ctum yes, I think it would, but I was a little bit worried that:

In other words, I am slight worried because of security implications..

razzmatazz commented 7 years ago

I think we could:

k-ode commented 7 years ago

Windows has a decent shell in Powershell (which is included by default). If it would be acceptable to only support Powershell version 5 and up, you could simply run powershell -command "Expand-Archive c:\a.zip -DestinationPath c:\a".

The powershell version can be checked by running:

(substring 
    (shell-command-to-string "powershell -command \"(Get-Host).Version.Major\"")
   0 -1)

If the the user has a version below the threshold, simply display a message that they need to extract the zip file themselves.

There are other ways to extract zip files in powershell using .NET, but checking the installed .NET version could be more trouble than it's worth.

razzmatazz commented 7 years ago

@kimgronqvist thanks! I think using powershell will be something that will work here; also, I found a way not to require powershell v5, by using powershell script that references system.io.compression.fs directly:

will try to implement this now

k-ode commented 7 years ago

Nice! I think it would also be worthwhile to run (executable-find "unzip") first, since this will be installed on some Windows systems that use Emacs.

Some users will have unzip in their path when installing Git for Windows (which includes msys2), and some will have installed msys2 manually since many Emacs commands depends on tools like find, grep, and diff.

razzmatazz commented 7 years ago

@kimgronqvist another good idea!

mikavilpas commented 7 years ago

Great stuff, guys! I'm really glad you brought Powershell up Kim.

On Jul 17, 2017 16:18, "Saulius Menkevičius" notifications@github.com wrote:

@kimgronqvist https://github.com/kimgronqvist another good idea!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OmniSharp/omnisharp-emacs/issues/275#issuecomment-315752540, or mute the thread https://github.com/notifications/unsubscribe-auth/AASW99xqLkVTVWA3Mvb3LRPHtYTvROosks5sO17WgaJpZM4MDbJo .