-
Notifications
You must be signed in to change notification settings - Fork 0
DRAFT Feat/incremental build c objs #44
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
base: main
Are you sure you want to change the base?
Conversation
|
@Pistonight LMK if this looks good to merge for now. If not, ill just close this pr and the attached issue for now since we need to focus on some more high level design at the moment. This seems like it should be a good prototype for the incremental build. I have some ideas for improving the up-to-date checking stuff but that will get more fleshed out when I have some design stuff to show you. |
|
@Rothschilds12 Give this a look if you get a chance. Idk if you or Andrew will be free to review over break, but if you have time, try and at least see if you cxxbridge stuff can go ahead and integrate with what we have here. Not really looking for code quality as much as overall design stuff rn. |
| argv.push( | ||
| src_file | ||
| .as_utf8() | ||
| .context("failed to parse utf-8")? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to add context here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same below
| // Compile and update record | ||
| comp_command.execute()?; | ||
|
|
||
| // Ensure source and artifacts have the same timestamp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should read the timestamp of the source before compiling and set it on the artifacts afterwards.
What if the source changes while it's being compiled? the current implementation would not recompile
|
|
||
| // Make sure our errors are all cu compatible | ||
| Err(_) => return Err(cu::Error::msg("Failed to parse depfile")), | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depfile::parse(...).context("...")?;
or
cu::check!(depfile::parse(...), ...format args)?;
| }; | ||
|
|
||
| for dep in depfile.recurse_deps(o_path.as_utf8()?) { | ||
| if cu::fs::get_mtime(PathBuf::from(dep))? != cu::fs::get_mtime(&self.path)? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- no need to PathBuf::from
- self.path mtime can be put outside of the loop
please make sure the checks pass other than those that are intended to fail (such as todos or unused) |
This is most of the skeleton code filled out for incremental build.
A few things have todos since I wanted the main things figured out before fixing a few small details.
Lmk if this overall structure looks good. I especially want to be sure that this will be feasible to transition to async and that the caching of the compiledb to the clangd json file will be easy features to extend from this.