igor-petruk / scriptisto

A language-agnostic "shebang interpreter" that enables you to write scripts in compiled languages.
Apache License 2.0
943 stars 24 forks source link

Add `SCRIPTISTO_CACHE_DIR` environment variable + showcase in new Dart template, support hashing additional paths such as multiple source files or directories #30

Closed AndiDog closed 1 year ago

AndiDog commented 3 years ago

Sorry, didn't open an issue before. Please add one if this feature isn't clear. To me, hashing more than just the script file itself is essential since many programs consist of multiple source files. This change allows listing files and directories which will trigger a rebuild if their modification time changed (same as scriptisto already does on the source script file). A new Dart template was added and used as show case for an – also new – SCRIPTISTO_CACHE_DIR environment variable, which helps the script access any further built artifacts.

igor-petruk commented 1 year ago

Hi, due to personal circumstances I did not look into this project for a while, but now I am back and happy to take a look. Sorry that I ignored this for so long, please let me know if you no longer have time for this.

igor-petruk commented 1 year ago

I've merged the offered dart template, so it may conflict now

AndiDog commented 1 year ago

Yes indeed, the existing Dart template that you added in December works. But often times, a program doesn't just have a single file (with a main function, for example), but more dependencies. And scriptisto should rebuild in that case. What about we add such a more complex template, separate from the simple template? I can adjust the PR accordingly if you agree.

igor-petruk commented 1 year ago

Ok, I think I now understand what this feature does. I was assuming before that it hashes files in the target directory, not in the script directory. In that case it was not clear how is it different from just using files.

I am happy to accept the change with a few changes:

Thank you for your pull request!

AndiDog commented 1 year ago

Applied all your suggestions and rebased onto latest master 😀

igor-petruk commented 1 year ago

Released 2.1.0. Thank you for your contribution!