Move WriteSourceSetStamp to NinjaCBinaryTargetWriter After d2e84de8617407c it's only used there. While here, remove declaration of non-existent WriteStampAndGetDep(). No behavior change. Change-Id: I2f64c14a3546fca0c60dbf1d4cceae6cef4c26c5 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/15820 Commit-Queue: Nico Weber <thakis@google.com> Reviewed-by: Nico Weber <thakis@google.com> Reviewed-by: Takuto Ikuta <tikuta@google.com>
diff --git a/src/gn/ninja_binary_target_writer.cc b/src/gn/ninja_binary_target_writer.cc index 5fb8929..755d963 100644 --- a/src/gn/ninja_binary_target_writer.cc +++ b/src/gn/ninja_binary_target_writer.cc
@@ -105,26 +105,6 @@ return {stamp_file}; } -void NinjaBinaryTargetWriter::WriteSourceSetStamp( - const std::vector<OutputFile>& object_files) { - // The stamp rule for source sets is generally not used, since targets that - // depend on this will reference the object files directly. However, writing - // this rule allows the user to type the name of the target and get a build - // which can be convenient for development. - ClassifiedDeps classified_deps = GetClassifiedDeps(); - - // The classifier should never put extra object files in a source sets: any - // source sets that we depend on should appear in our non-linkable deps - // instead. - DCHECK(classified_deps.extra_object_files.empty()); - - std::vector<OutputFile> order_only_deps; - for (auto* dep : classified_deps.non_linkable_deps) - order_only_deps.push_back(dep->dependency_output_file()); - - WriteStampForTarget(object_files, order_only_deps); -} - NinjaBinaryTargetWriter::ClassifiedDeps NinjaBinaryTargetWriter::GetClassifiedDeps() const { ClassifiedDeps classified_deps;
diff --git a/src/gn/ninja_binary_target_writer.h b/src/gn/ninja_binary_target_writer.h index c7b6eea..92ac5ee 100644 --- a/src/gn/ninja_binary_target_writer.h +++ b/src/gn/ninja_binary_target_writer.h
@@ -42,9 +42,6 @@ std::vector<OutputFile> WriteInputsStampAndGetDep( size_t num_stamp_uses) const; - // Writes the stamp line for a source set. These are not linked. - void WriteSourceSetStamp(const std::vector<OutputFile>& object_files); - // Gets all target dependencies and classifies them, as well as accumulates // object files from source sets we need to link. ClassifiedDeps GetClassifiedDeps() const; @@ -56,9 +53,6 @@ void ClassifyDependency(const Target* dep, ClassifiedDeps* classified_deps) const; - OutputFile WriteStampAndGetDep(const UniqueVector<const SourceFile*>& files, - const std::string& stamp_ext) const; - void WriteCompilerBuildLine(const std::vector<SourceFile>& sources, const std::vector<OutputFile>& extra_deps, const std::vector<OutputFile>& order_only_deps,
diff --git a/src/gn/ninja_c_binary_target_writer.cc b/src/gn/ninja_c_binary_target_writer.cc index da27df6..ec2e0bb 100644 --- a/src/gn/ninja_c_binary_target_writer.cc +++ b/src/gn/ninja_c_binary_target_writer.cc
@@ -584,6 +584,26 @@ out_ << std::endl; } +void NinjaCBinaryTargetWriter::WriteSourceSetStamp( + const std::vector<OutputFile>& object_files) { + // The stamp rule for source sets is generally not used, since targets that + // depend on this will reference the object files directly. However, writing + // this rule allows the user to type the name of the target and get a build + // which can be convenient for development. + ClassifiedDeps classified_deps = GetClassifiedDeps(); + + // The classifier should never put extra object files in a source sets: any + // source sets that we depend on should appear in our non-linkable deps + // instead. + DCHECK(classified_deps.extra_object_files.empty()); + + std::vector<OutputFile> order_only_deps; + for (auto* dep : classified_deps.non_linkable_deps) + order_only_deps.push_back(dep->dependency_output_file()); + + WriteStampForTarget(object_files, order_only_deps); +} + void NinjaCBinaryTargetWriter::WriteLinkerStuff( const std::vector<OutputFile>& object_files, const std::vector<SourceFile>& other_files,
diff --git a/src/gn/ninja_c_binary_target_writer.h b/src/gn/ninja_c_binary_target_writer.h index ab42985..17615cc 100644 --- a/src/gn/ninja_c_binary_target_writer.h +++ b/src/gn/ninja_c_binary_target_writer.h
@@ -84,6 +84,9 @@ const std::vector<OutputFile>& order_only_deps, std::vector<OutputFile>* object_files); + // Writes the stamp line for a source set. These are not linked. + void WriteSourceSetStamp(const std::vector<OutputFile>& object_files); + void WriteLinkerStuff(const std::vector<OutputFile>& object_files, const std::vector<SourceFile>& other_files, const std::vector<OutputFile>& input_deps);