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

Codegen v2 #22

Merged
merged 15 commits into from
Mar 4, 2020
Merged

Codegen v2 #22

merged 15 commits into from
Mar 4, 2020

Conversation

LPGhatguy
Copy link
Contributor

@LPGhatguy LPGhatguy commented Feb 19, 2020

Closes #7.

This PR rewrites Tarmac's codegen pipeline from scratch to make it more composable and to get the project to baseline feature completion.

The new codegen module is more complicated. Instead of being templates that implement fmt::Display, they now all implement a method named to_lua that generates a minimal Lua AST. Using this AST, we can compose together different things that turn into Lua and format them in a sensible way. Early on in this PR I tried to keep the fmt approach, but it became unworkable pretty quickly.

There are a couple small foundational refactors tied up in this PR, as the branch has probably lived for too long. I'd love to get a basic checklist of things done on this code and then merge it as soon as we can.

TODO

  • Generate input paths from their path instead of their AssetName
  • Allow choosing a base path for input names
  • Strip file extensions from generated code
  • Merge inputs with same name but different DPI scale

@LPGhatguy
Copy link
Contributor Author

I ported the codegen loop to operate on paths instead of names. It's a lot more gross because:

  • OsStr -> str conversion happens in this function instead of inside AssetName
  • Matching fragments of paths feels like it could have a lot of edge cases
  • This required another loop over the path segments in order to handle .. correctly.

@LPGhatguy LPGhatguy merged commit 6b855ca into master Mar 4, 2020
@LPGhatguy LPGhatguy deleted the codegen-v2 branch March 4, 2020 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support codegen into larger units
1 participant