feature(clean): accept source directories (#2288)#15305
Open
rgrinberg wants to merge 1 commit into
Open
Conversation
999201e to
87ff91d
Compare
`dune clean PATH` now accepts source directories (and the project root), not just paths inside the build directory. A source path is resolved against every build context, mirroring how `dune build PATH` accepts a source directory, and the corresponding build artifacts are removed. Paths already inside `_build` keep their previous behaviour. Reading the build contexts requires the engine, so when a source path is given the command now starts a server-less scheduler to query `Context.DB.all`. fixes #2288 Signed-off-by: Rudi Grinberg <me@rgrinberg.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
87ff91d to
2733122
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2288.
dune clean PATHpreviously only accepted paths inside the build directory(e.g.
_build/default/foo); passing a source directory failed with<path> is not inside the build directory. This makesdune cleanaccept sourcedirectories (and the project root) too, mirroring how
dune build PATHacceptsa source directory.
A source path is resolved against every build context and the corresponding
artifacts are removed (
_build/<context>/<path>). For example:Paths already inside
_buildkeep their previous behaviour, anddune cleanwith no arguments still removes the whole build directory.
Implementation notes:
_buildare removed directly (noengine startup, as before); source paths are mapped across
Context.DB.all.command now starts a server-less scheduler (
go_without_rpc_server).The
clean.ttest added in #15300 (which demonstrated the rejection) isupdated to assert the new behaviour.
🤖 Generated with Claude Code