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

Refactor and clean the code #109

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

Conversation

TheRustifyer
Copy link
Member

@TheRustifyer TheRustifyer commented May 31, 2024

This PR aims to refactor and clean the code written so far in Zork++ before introduce new features.

Some of the core ideas is:

  • Re-design the cache to have the latest generated commands and the latest iterations, by demoting the last entry and the consecutive entries (deleting the container) and relate the iterations via the execution status designed for the purpose
  • Refactor de parts of the project_model that uses owned data to use the clone-on-write idiom
  • Add unit and doc test (specially this latest ones) in the methods that aren't exactly easy to read, so when we come back to the project after a long period of inactivity is easier to understand
  • Related to the latest one, we should refactor those procedures that has a lot of cognitive complexity without need it
  • Make a named entry for the commands generated for build the modular implementations of the standard libraries (std and std.compat)
  • Make a better architecture over the structs that holds data on the Cache
  • Introduce different clean cache levels (-c only forces to execute already cached commands, -cc wipes the cache entry)
  • Use the toml crate on the latest version, the one that brokes the non-owned types compatibilities, and solve the performance downgrade by completely cache the configuration files, as well as the project model if there's no changes over the translation units or the configuration options

NOTE: Some code comments are on Spanish in this initial commit, used to just set up this upstream branch. Sorry about that, English readers.

@TheRustifyer TheRustifyer self-assigned this May 31, 2024
feat: removed the cache last generated commands, so they're one only one entity
feat: reworked the conversion from our cache to the compile_commands.json format
feat: unified the serialization and serialization entities. The intermediate ones used to clone data from the non-owned version of the cache has been deleted, and the SourceCommandLine now only works with owned data, so there's no need anymore to use those intermediate data mappers (that already was cloning from borrowed data)
…t and common Argument(s) that only need to be created once
…instead of owned data. Code compiles but is far from finished yet
… if they are already built if there's no header declared by the user. This closes #116
…tionUnit

fix: we can't use join for file_stem(s) that contains dots in their names, since it skips anything after the first point
…nership is transferred to the build_model procedure
…nership is transferred to the build_model procedure

fix: changed back the types on the config file data structures to their original reference types
…d anymore. Everything works again with plain references or moved values
…hts data structures for generating the C++ module interfaces command lines
…entors of TranslationUnit when they're behind a impl TranslationUnit
…ation Unit, so now we only need a single block of code to process them all
… 112

feat: Added the clone-on-write idiom in any place that makes sense for now. Still we have to change Argument, SourceCommandLine and fields on the project model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment