Skip to content

DRAFT: Basic implementation of build cache. #8754

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mitchdenny
Copy link
Member

@mitchdenny mitchdenny commented Apr 13, 2025

This PR introduces a build cache for the Aspire CLI. It works by first executing msbuild to get a collection of properties and items and computing a hash of that content. If the inputs to the build have not changed, then they should remain the same. If a build has successfully completed successfully previously with the same hash then we don't bother triggering a build again.

This implementation has a few problems (not quite ready yet):

  • If the build completed successfully (so fingerprint created) and a dotnet clean is performed then the fingerprint will match but the outputs won't be available. We need to figure out the best way of validating that build outputs are available to run.
  • We need to add a --no-cache option to both aspire run and aspire publish.
  • Need to update unit tests and add more test coverage for run/publish commands.
aspire-run-with-cache.mp4

@mitchdenny mitchdenny added this to the 9.3 milestone Apr 13, 2025
Comment on lines 27 to +30
ArgumentNullException.ThrowIfNull(runner);
ArgumentNullException.ThrowIfNull(interactionService);
ArgumentNullException.ThrowIfNull(projectLocator);
ArgumentNullException.ThrowIfNull(appHostBuilder);
Copy link
Member

Choose a reason for hiding this comment

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

Ya know, this argument null checking isn't really necessary 😄. We not shipping a public API.


private string GetAppHostStateBasePath(FileInfo projectFile)
{
var fullPath = projectFile.FullName;
Copy link
Member

Choose a reason for hiding this comment

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

lowercase this?


_ = logger;

var msBuildResult = await runner.GetProjectItemsAndPropertiesAsync(
Copy link
Member

Choose a reason for hiding this comment

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

How do we feel about transitivity here? You might need the same finger print for the closure of project refs (that aren't aspire projects).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants