New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 852926 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

think about adding an "inverted clean" command to GN or ninja

Project Member Reported by dpranke@google.com, Jun 14 2018

Issue description

ninja -t clean will delete all of the files listed in the .ninja files.

gn clean will delete everything except for args.gn and build.ninja.

clobber deletes a full checkout.

We don't currently have a good way to delete "stuff we don't need anymore", particularly in build directories. This showed up most recently on the p/chromium builders (I think) where every new linux installer gets a different filename (see bug 851146), but is a general problem.

Maybe we should add a command to either ninja or GN to delete everything *except* for the files that the build actually references?
 

Comment 1 by tikuta@chromium.org, Jun 14 2018

Nico, do you want to merge this PR?
https://github.com/ninja-build/ninja/pull/1432

Comment 2 by thakis@chromium.org, Jun 14 2018

I don't think every needed output in the chrome build is listed as an output, so in practice this would delete stuff we need, no?

Comment 3 by tikuta@chromium.org, Jun 14 2018

#2
I think that is true now.
We need to do some fix to current repository, and I want to have all outputs explicitly.

Comment 4 by thakis@chromium.org, Jun 14 2018

I'd think cleaning that up is a fairly large task, and in some cases it might be infeasible -- the .TOC hack we use to not relink downstream binaries relies on ninja not checking the timestamp of the .so file that gets written. (Someone added implicit outputs to ninja in the last release. I think those might still get stat()'d though and just don't show up in $out (?))

Comment 5 by thakis@chromium.org, Jun 14 2018

(What we've done so far is one-off stuff in build steps to let them clean up after themselves when needed, which in practice is rarely. I'm not arguing that that's great, but it might be good enough often enough.)
> I don't think every needed output in the chrome build is listed as an output

Good point. We'd have to fix that first for this to be feasible. If fixing that wasn't feasible (i.e., it was too much work) then we could use a cleanup script instead. I was hoping we wouldn't need that.

I thought we did record the .so's as outputs, but I may be misremembering.

Comment 7 by thakis@chromium.org, Jun 14 2018

Also, i think gn copies allows copying directories, so unless require listing every copied out file we won't know all out files either.

What do you mean with "cleanup script"? For the installer thing, the installer generator could delete all outputs using a glob before writing the next one. (That's what I mean with "one-off stuff" -- usually pretty localized).
> Also, i think gn copies allows copying directories, so unless require 
> listing every copied out file we won't know all out files either.

Another good point, at least for things like bundles and frameworks.

> What do you mean with "cleanup script"? For the installer thing,
> the installer generator could delete all outputs using a glob
> before writing the next one. (That's what I mean with "one-off stuff"
> -- usually pretty localized).

I meant creating a new build step that could collect things. Your idea sounds like it might be better.

Sign in to add a comment