Skip to content

Commit

Permalink
Rename extra_hard_deps to additional_hard_deps
Browse files Browse the repository at this point in the history
Every time I read this code I wondered what makes a dependency extra
hard. Turns out it was supposed to be (extra (hard deps)),
not ((extra hard) deps). Maybe s/extra/additional/ makes this more
clear.

No behavior change.

Change-Id: I2ed17795c8ba29fab5ae0e5bbfcbf73ea897a358
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/11220
Reviewed-by: Brett Wilson <[email protected]>
Commit-Queue: Nico Weber <[email protected]>
  • Loading branch information
nico authored and Commit Bot committed Mar 12, 2021
1 parent e0358b4 commit 64b3b94
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/gn/ninja_action_target_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ NinjaActionTargetWriter::~NinjaActionTargetWriter() = default;
void NinjaActionTargetWriter::Run() {
std::string custom_rule_name = WriteRuleDefinition();

// Collect our deps to pass as "extra hard dependencies" for input deps. This
// will force all of the action's dependencies to be completed before the
// action is run. Usually, if an action has a dependency, it will be
// Collect our deps to pass as additional "hard dependencies" for input deps.
// This will force all of the action's dependencies to be completed before
// the action is run. Usually, if an action has a dependency, it will be
// operating on the result of that previous step, so we need to be sure to
// serialize these.
std::vector<const Target*> extra_hard_deps;
std::vector<const Target*> additional_hard_deps;
std::vector<OutputFile> data_outs;
for (const auto& pair : target_->GetDeps(Target::DEPS_LINKED)) {
if (pair.ptr->IsDataOnly()) {
data_outs.push_back(pair.ptr->dependency_output_file());
} else {
extra_hard_deps.push_back(pair.ptr);
additional_hard_deps.push_back(pair.ptr);
}
}

Expand All @@ -50,7 +50,7 @@ void NinjaActionTargetWriter::Run() {
size_t num_stamp_uses =
target_->output_type() == Target::ACTION ? 1u : target_->sources().size();
std::vector<OutputFile> input_deps =
WriteInputDepsStampAndGetDep(extra_hard_deps, num_stamp_uses);
WriteInputDepsStampAndGetDep(additional_hard_deps, num_stamp_uses);
out_ << std::endl;

// Collects all output files for writing below.
Expand Down
8 changes: 4 additions & 4 deletions src/gn/ninja_target_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void NinjaTargetWriter::WriteSharedVars(const SubstitutionBits& bits) {
}

std::vector<OutputFile> NinjaTargetWriter::WriteInputDepsStampAndGetDep(
const std::vector<const Target*>& extra_hard_deps,
const std::vector<const Target*>& additional_hard_deps,
size_t num_stamp_uses) const {
CHECK(target_->toolchain()) << "Toolchain not set on target "
<< target_->label().GetUserVisibleName(true);
Expand Down Expand Up @@ -241,9 +241,9 @@ std::vector<OutputFile> NinjaTargetWriter::WriteInputDepsStampAndGetDep(
input_deps_targets.push_back(target);
}

// Extra hard dependencies passed in. These are usually empty or small, and
// we don't want to duplicate the explicit hard deps of the target.
for (const Target* target : extra_hard_deps) {
// Additional hard dependencies passed in. These are usually empty or small,
// and we don't want to duplicate the explicit hard deps of the target.
for (const Target* target : additional_hard_deps) {
if (!hard_deps.count(target))
input_deps_targets.push_back(target);
}
Expand Down
4 changes: 2 additions & 2 deletions src/gn/ninja_target_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class NinjaTargetWriter {
// order-only dependencies for the current target.
// If num_stamp_uses is small, this might return all input dependencies
// directly, without writing a stamp file.
// If there are no implicit dependencies and no extra target dependencies
// If there are no implicit dependencies and no additional target dependencies
// are passed in, this returns an empty vector.
std::vector<OutputFile> WriteInputDepsStampAndGetDep(
const std::vector<const Target*>& extra_hard_deps,
const std::vector<const Target*>& additional_hard_deps,
size_t num_stamp_uses) const;

// Writes to the output file a final stamp rule for the target that stamps
Expand Down
4 changes: 2 additions & 2 deletions src/gn/ninja_target_writer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class TestingNinjaTargetWriter : public NinjaTargetWriter {

// Make this public so the test can call it.
std::vector<OutputFile> WriteInputDepsStampAndGetDep(
const std::vector<const Target*>& extra_hard_deps,
const std::vector<const Target*>& additional_hard_deps,
size_t num_stamp_uses) {
return NinjaTargetWriter::WriteInputDepsStampAndGetDep(extra_hard_deps,
return NinjaTargetWriter::WriteInputDepsStampAndGetDep(additional_hard_deps,
num_stamp_uses);
}
};
Expand Down

0 comments on commit 64b3b94

Please sign in to comment.