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

a build.tl file, to help generate code/run tools after code gen #244

Closed
lenscas opened this issue Oct 18, 2020 · 2 comments
Closed

a build.tl file, to help generate code/run tools after code gen #244

lenscas opened this issue Oct 18, 2020 · 2 comments
Labels
feature request New feature or request

Comments

@lenscas
Copy link
Contributor

lenscas commented Oct 18, 2020

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)

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.

@pdesaulniers pdesaulniers added the feature request New feature or request label Oct 19, 2020
@pdesaulniers 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
@hishamhm
Copy link
Member

hishamhm commented Jan 6, 2023

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?

@lenscas
Copy link
Contributor Author

lenscas commented Jan 6, 2023

Yep

@lenscas lenscas closed this as completed Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants