Skip to content

Commit

Permalink
Do not cleanup args.gn imports located in the output directory.
Browse files Browse the repository at this point in the history
gn cleanup should keep files that are imported by args.gn and located
in the output directory.

Change-Id: I98116dd3f57765a5c160d7b82bd8104a747dd469
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/17360
Commit-Queue: Takuto Ikuta <[email protected]>
Reviewed-by: Dirk Pranke <[email protected]>
Reviewed-by: Takuto Ikuta <[email protected]>
  • Loading branch information
goodov authored and GN LUCI committed Jun 11, 2024
1 parent b3a0bff commit b2afae1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Vewd Software AS <*@vewd.com>
Vivaldi Technologies AS <*@vivaldi.com>
Yandex LLC <*@yandex-team.ru>

Aleksei Khoroshilov <[email protected]>
Alexis Menard <[email protected]>
Alfredo Mazzinghi <[email protected]>
Andrew Boyarshin <[email protected]>
Expand Down
13 changes: 10 additions & 3 deletions src/gn/command_clean.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ bool CleanOneDir(const std::string& dir) {
return false;
}

// Erase everything but (user-created) args.gn and the build.ninja files we
// just wrote.
const base::FilePath::CharType* remaining[]{
// Erase everything but (user-created) args.gn, its imports and the
// build.ninja files we just wrote.
std::vector<base::FilePath::StringType> remaining{
FILE_PATH_LITERAL("args.gn"),
FILE_PATH_LITERAL("build.ninja"),
FILE_PATH_LITERAL("build.ninja.d"),
};
for (const auto& f :
setup->build_settings().build_args().build_args_dependency_files()) {
if (IsStringInOutputDir(setup->build_settings().build_dir(), f.value())) {
remaining.push_back(UTF8ToFilePath(f.GetName()).value());
}
}

base::FileEnumerator traversal(
build_dir, false,
base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES);
Expand Down

0 comments on commit b2afae1

Please sign in to comment.