lix-pm / lix.client

A dependable package manager for your Haxe projects
The Unlicense
119 stars 24 forks source link

`lix run` doesn't support the default `Run` class? #155

Closed cedx closed 3 years ago

cedx commented 3 years ago

See https://lib.haxe.org/documentation/creating-a-haxelib-package/:

main (optional): A class to run on haxelib run libraryname command. Relative to library root. E.g. to run tools/Main.hx the value should be tools.Main. Default value since Haxe 4: Run.

I have a project (which, see https://lib.haxe.org/p/which/2.0.2/files/ or https://github.com/cedx/which.hx) that provides a Run root class in order to be able to do:

haxelib --global install which
haxelib run which --version
# 2.0.2

I don't have a main field in the haxelib.json file. It works fine with haxelib but not with lix (using version 15.10.1 with Haxe 4.1.5 on Windows 10). Instead, I get the following error:

lix install --global haxelib:which
lix run which --version
# no @run directive found for library which

If I edit the which.hxml file and add:

# @run: haxelib run-dir which ${HAXE_LIBCACHE}/which/2.0.2/haxelib

I get the following error:

Uncaught exception - load.c(181) : Module not found : [...]/haxe/haxe_libraries/which/2.0.2/haxelib/run.n

If I edit the haxelib.json file and add:

"main": "Run"

I get the following error:

Failed to call haxe because Error: spawnSync haxe ENOENT

EDIT: probably related to these issues... https://github.com/lix-pm/haxeshim/issues/68 https://github.com/lix-pm/haxeshim/issues/48

benmerckx commented 3 years ago

I'm running into Failed to call haxe because Error: spawnSync haxe ENOENT too which seems to be a Windows issue.

Haxe is executed directly here: https://github.com/lix-pm/haxeshim/blob/8ffc3518cb2b8a65a2b115ba4aa122a8193c2214/src/haxeshim/HaxelibCli.hx#L91

Whereas in other places there's an extension (and path) added: https://github.com/lix-pm/haxeshim/blob/8ffc3518cb2b8a65a2b115ba4aa122a8193c2214/src/haxeshim/HaxeInstallation.hx#L16