Skip to content

Conversation

@lwbuchanan
Copy link
Collaborator

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.

@lwbuchanan lwbuchanan linked an issue Nov 11, 2025 that may be closed by this pull request
@lwbuchanan
Copy link
Collaborator Author

@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.

@lwbuchanan
Copy link
Collaborator Author

@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")?
Copy link
Collaborator

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

Copy link
Collaborator

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
Copy link
Collaborator

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")),
};
Copy link
Collaborator

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)? {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. no need to PathBuf::from
  2. self.path mtime can be put outside of the loop

@Pistonight
Copy link
Collaborator

@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.

please make sure the checks pass other than those that are intended to fail (such as todos or unused)

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.

Incrementally build C/C++/Asm objects

4 participants