Skip to content

feat: delete build caches after removing dependencies#5399

Merged
lpil merged 4 commits into
gleam-lang:mainfrom
ankddev:invalidate-build-cache-remove-command
Jun 24, 2026
Merged

feat: delete build caches after removing dependencies#5399
lpil merged 4 commits into
gleam-lang:mainfrom
ankddev:invalidate-build-cache-remove-command

Conversation

@ankddev

@ankddev ankddev commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

  • The changes in this PR have been discussed beforehand in an issue
  • The issue for this PR has been linked
  • Tests have been added for new behaviour
  • The changelog has been updated for any user-facing changes

@yoshi-monster

Copy link
Copy Markdown
Contributor

Isn't running gleam clean afterwards way to broad since it also recompiles all dependencies? Wouldn't we just want to invalidate the top-level package?

@ankddev
ankddev marked this pull request as draft February 28, 2026 04:46
@ankddev

ankddev commented Feb 28, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, I was thinking about that, drafted PR for now. Initially I wanted to implemebt it like in the LS, where we clean build directory for LSP mode, current target and current package. It's the information that we don't have in cleanup code. I will try to implement it anyway.

@ankddev
ankddev force-pushed the invalidate-build-cache-remove-command branch from 596f744 to a28cc66 Compare March 28, 2026 08:34
@ankddev
ankddev marked this pull request as ready for review March 28, 2026 08:56
@ankddev

ankddev commented Mar 28, 2026

Copy link
Copy Markdown
Contributor Author

@yoshi-monster Now it removes build directory only for the toplevel package, current target, and both dev and prod modes. What do you think?

@ankddev
ankddev force-pushed the invalidate-build-cache-remove-command branch from 1209a34 to 48d3166 Compare March 29, 2026 17:42
@yoshi-monster

Copy link
Copy Markdown
Contributor

Hello!!

Sorry, it looks like my github is still broken and won't send me emails.

Yeah, looks good to me! I don't know enough of the compiler if we could delete the cached type information but keep the generated code, but I don't think it matters that much. Thank you! 💜

@lpil lpil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hello! Shouldn't we be removing the metadata for the removed package, not the root package?

@ankddev

ankddev commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Makes sense to me, will do it tomorrow!

@ankddev
ankddev force-pushed the invalidate-build-cache-remove-command branch from 48d3166 to a11c5a3 Compare May 4, 2026 16:54
@ankddev
ankddev force-pushed the invalidate-build-cache-remove-command branch from a11c5a3 to 121386a Compare May 19, 2026 12:05
@ankddev

ankddev commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

@lpil I tested and found that removing cache for root package is needed here.

For instance, it already removes cache for dependencies here:

https://github.com/ankddev/gleam/blob/b325e95380ffb535e27029d54ce17408bc796d17/compiler-cli/src/dependencies.rs#L526-L563

From my tests issue is resolved only with cleaning cache of root package.

@ankddev
ankddev requested a review from lpil June 4, 2026 04:09
@ankddev
ankddev force-pushed the invalidate-build-cache-remove-command branch from b325e95 to 1243c8f Compare June 4, 2026 04:10

@lpil lpil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lovely! Thank you for the investigation and the explanation. I understand why it wasn't working before now.

I've left a few tiny notes inline

Comment thread CHANGELOG.md
Comment thread compiler-cli/src/dependencies.rs Outdated
@ankddev
ankddev force-pushed the invalidate-build-cache-remove-command branch 5 times, most recently from 5764e25 to 7a94b8e Compare June 17, 2026 05:19
@ankddev
ankddev requested a review from lpil June 17, 2026 05:26

@lpil lpil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!!

@lpil
lpil force-pushed the invalidate-build-cache-remove-command branch from 7a94b8e to 50b4ce7 Compare June 22, 2026 14:10
@lpil
lpil force-pushed the invalidate-build-cache-remove-command branch from 50b4ce7 to 072ea0e Compare June 24, 2026 10:22
@lpil
lpil merged commit de9bc74 into gleam-lang:main Jun 24, 2026
18 checks passed
@ankddev
ankddev deleted the invalidate-build-cache-remove-command branch June 24, 2026 12:31
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.

gleam remove could invalidate the build cache

3 participants