You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
another thing that rust does that I started to like.
Instead of every library/program needing to setup their own tooling, rust checks for the existence of a build.rs file and if it exists it executes it, allowing it to generate code. As a result, pretty much every project uses the same commands to build/run. It also reduces the amount of tools that people need to know, as the build files are just rust. (Or in this case, will be teal)
I think that teal can do 1 better though by having the script return a table with the following entries and types
"run_on": {string}. A list of paths (paths can contain wildcards) that tell teal when to rerun the script. Otherwise, the previous output can be used.
"before_compile": function(out_dir:string) .A function to run before compiling. out_dir is the path where it should store the generated files.
"after_compile": function(build_dir:string). A function to run after the code has been generated. This one only runs when using tl build or tl run and is not affected by the paths given in "run_on". This allows you to run tools on the code.
If this is implemented then the compiler might be able to replace the current make script for a build.tl file, allowing people to work on it like a normal project . It also makes integrating tools easier, #67 can then be done through these build files, instead of either project needing to write code to support each other. (Just have an after_compile function that executes luapak)
or, in my own project where I already had to generate code for lua, and with the switch to teal I also need to automatically generate some of its types. So having teal run the correct commands for me would be appreciated :)
I don't mind opening a PR for this, I'm actually already playing with the teals codebase.
The text was updated successfully, but these errors were encountered:
pdesaulniers
changed the title
a buid.tl file, to help generate code/run tools after code gen
a build.tl file, to help generate code/run tools after code gen
Oct 20, 2020
Reviewing old open issues — this has been initially implemented by tl build and later superseded by script support in cyan build, right? I guess we can close this one, then?
another thing that rust does that I started to like.
Instead of every library/program needing to setup their own tooling, rust checks for the existence of a
build.rs
file and if it exists it executes it, allowing it to generate code. As a result, pretty much every project uses the same commands to build/run. It also reduces the amount of tools that people need to know, as the build files are just rust. (Or in this case, will be teal)I think that teal can do 1 better though by having the script return a table with the following entries and types
"run_on": {string}. A list of paths (paths can contain wildcards) that tell teal when to rerun the script. Otherwise, the previous output can be used.
"before_compile": function(out_dir:string) .A function to run before compiling. out_dir is the path where it should store the generated files.
"after_compile": function(build_dir:string). A function to run after the code has been generated. This one only runs when using
tl build
ortl run
and is not affected by the paths given in "run_on". This allows you to run tools on the code.If this is implemented then the compiler might be able to replace the current
make
script for a build.tl file, allowing people to work on it like a normal project . It also makes integrating tools easier, #67 can then be done through these build files, instead of either project needing to write code to support each other. (Just have an after_compile function that executesluapak
)Other examples can be a library like https://github.com/adelsz/pgtyped but without the need to manual run the command
or, in my own project where I already had to generate code for lua, and with the switch to teal I also need to automatically generate some of its types. So having teal run the correct commands for me would be appreciated :)
I don't mind opening a PR for this, I'm actually already playing with the teals codebase.
The text was updated successfully, but these errors were encountered: