Refactor for cases when `.rs` needs to influence `.toml`
- Dominant language
- Rust
- Stars
- 7
- Forks
- 11
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 5
Description
In #745, we moved writing `.toml` to disk after generating the `.rs` files. Which works, but it is not the clearest design possible.
We have discussed a few ideas offline, how can refactor it to be better:
Joel: "maybe instead of method(s) taking a crate parameter, we return any dependencies to be added in the Module definition. This formalizes the contract instead of passing crate which might get mutated and you need to know to emit Cargo.toml last"
Anton: "do you think it is a good idea to maybe expand Use to also take care of this? I.e. something like use.addDepencency()?"
Joel: "interesting idea. there is a relationship of sorts there."
If it looks good, we add use.AddDepencency(), use it in LRO, and also update all other places in the similar manner to add their dependencies as needed, i.e. search the code for `crate.addDependency` and move the logic from the places where we pre-emptively add a dependency ("if crate has clients") to places that need them (i.e. when we generate code for client, call use.addDependency()).
Contributor guide
Assessment
This issue has not been assessed yet.