curiosity-ai / h5

🚀 The next generation C# to JavaScript compiler
https://github.com/curiosity-ai/h5
Apache License 2.0
211 stars 30 forks source link

Support for local tools. #45

Closed IceReaper closed 2 years ago

IceReaper commented 3 years ago

https://docs.microsoft.com/en-us/dotnet/core/tools/local-tools-how-to-use

When installing h5-compiler with this approach, compiling fails with

       _CheckForH5:
         h5 check-if-online
         'h5' is not recognized as an internal or external command,
         operable program or batch file.

Running "h5" from cmd obviously does not work. "dotnet h5" however works when installing localy. Would it be an option to change the manual system calls which the build process does to "dotnet h5" instead of "h5"? This way we could avoid the need to install h5 globally and allow people to build without doing anything before.

theolivenbaum commented 3 years ago

Hi @IceReaper - I could add a flag to enable that, but would require some testing... what's the issue with installing it globally that you hit?

IceReaper commented 3 years ago

Its not really an issue, but it happened multiple times now, where other employees reinstalled some dotnet stuff, or simply updated the sdk, and were suddenly unable to build due to the missing h5 compiler installation. If it would work with the local tools approach too, we would completely get rid of that problem as it would always work. This also applies to build servers where some admin has updated the installed sdk. Otherwise people need to remember this step and/or keep investing time to find the solution in this projects readme. So not really an issue or bug, but its definitely more user-friendly then :)

theolivenbaum commented 2 years ago

@IceReaper I've added this option now. If you don't have the h5 global tool it will try to detect it as a local, or you can fully bypass this by defining on your project file:

<PropertyGroup>
    <UseLocalH5>true</UseLocalH5>
</PropertyGroup>

For future reference, to install h5 as a local tool in a given project, you can run this from the command line in the folder of the project:

dotnet new tool-manifest
dotnet tool install --local h5-compiler