Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run haxelib main relative to classpath #613

Open
n0-0b0dy opened this issue Nov 4, 2023 · 0 comments
Open

Run haxelib main relative to classpath #613

n0-0b0dy opened this issue Nov 4, 2023 · 0 comments

Comments

@n0-0b0dy
Copy link

n0-0b0dy commented Nov 4, 2023

When trying to create a runnable library, i noticed that haxelib ignores the classPath at haxelib.json for running the library.

So, if my code is under a src directory, looks like i cannot specify my main class at main property or import this class from a Run.hx or similar.

Consider for example this structure for a project:

  • root:
    • haxelib.json
    • src
      • myproject
        • Main.hx

I would like to use a haxelib.json similar to the following one in order to run the myproject.Main class:

{
    "name": "myproject",
    "version": "1.2.3",
    "classPath": "src/",
    "main": "myproject.Main",
    "dependencies": {}
}

Inspecting the haxelib code, i draft a possible way to solve the issue (if there isn't already another way that i didn't find out):

haxelib.api.ScriptRunner is responsible for running the projects (at the run method).
The run method receives a LibraryRunData. However this data does not contains the classPath info.

So i think that the LibraryRunData could be changed to carry the project classPath (could be set from GlobalScope.runScript method).
Then, the classPath would need to be carried out to the generateScript function,
problably through Script, which would need to be changed to include that data.

What do you think about the idea to adding this feature?


Note: i know that i can compile run.n (using neko) to solve my problem. But i think would be better and easier if we could directly specify the main class at the haxelib.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant