crystal-lang / shards

Dependency manager for the Crystal language
Other
758 stars 99 forks source link

Installing executables on Windows only works for `.exe` #592

Closed straight-shoota closed 11 months ago

straight-shoota commented 11 months ago

When shards installs executables, it unconditionally appends .exe to the name specified in shard.yml. This is a nice feature to ensure the same executable name works on all platforms. But the implementation is very wrong. It does not allow to install any other kinds of executables, such as shell scripts.

Reproduction (ref: crystal-ameba/ameba#391).

$ cat shard.yml
name: foo
version: 0.1.0

development_dependencies:
  ameba:
    github: straight-shoota/ameba
    commit: 15ce5437d13f47e023778e3be2a78e55759c263b
$ shards install
Resolving dependencies
Fetching https://github.com/straight-shoota/ameba.git
Installing ameba (1.4.3 at 15ce543)
Postinstall of ameba: shards build -Dpreview_mt
Unhandled exception: Error opening file with mode 'r': 'C:\\crystal\\shards\\foo\\lib\\ameba\\bin\\ameba.cr.exe': No such file or directory (File::NotFoundError)
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +43309 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +72883 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +331539 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +742269 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +741894 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +529299 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +322587 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +36666 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +133225 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +134533 in '??'
  from C:\Users\johannes\scoop\apps\crystal\current\shards.exe +1290932 in '??'
  from C:\WINDOWS\System32\KERNEL32.DLL +75437 in 'BaseThreadInitThunk'
  from C:\WINDOWS\SYSTEM32\ntdll.dll +371304 in 'RtlUserThreadStart'

There are actually two issues with this: