Reduce input dependencies in GN.
Converts input dependencies for binary targets to be order-only, rather than implicit. See added comments in the patch for reasoning behind this.
Long ago this was order-only, which is not correct for actions (which might directly depend on the output of previous actions). So I changed them to be implicit, which then caused unnecessary rebuilds. This change makes actions and binary targets behave differently. Actions remain implicit, binary targets are order-only.
Add unit test for input deps on binary targets.
[email protected]
Review URL: https://codereview.chromium.org/505353002
Cr-Commit-Position: refs/heads/master@{#292003}
diff --git a/tools/gn/ninja_target_writer.h b/tools/gn/ninja_target_writer.h
index e2dbd25..f67eba5 100644
--- a/tools/gn/ninja_target_writer.h
+++ b/tools/gn/ninja_target_writer.h
@@ -12,6 +12,7 @@
#include "tools/gn/substitution_type.h"
class FileTemplate;
+class OutputFile;
class Settings;
class Target;
@@ -33,12 +34,11 @@
void WriteSharedVars(const SubstitutionBits& bits);
// Writes to the output stream a stamp rule for input dependencies, and
- // returns the string to be appended to source rules that encodes the
- // order-only dependencies for the current target. This will include the "|"
- // character so can just be appended to the source rules. If there are no
- // implicit dependencies and no extra target dependencies passed in, returns
- // the empty string.
- std::string WriteInputDepsStampAndGetDep(
+ // returns the file to be appended to source rules that encodes the
+ // order-only dependencies for the current target. The returned OutputFile
+ // will be empty if there are no implicit dependencies and no extra target
+ // dependencies passed in.
+ OutputFile WriteInputDepsStampAndGetDep(
const std::vector<const Target*>& extra_hard_deps) const;
// Writes to the output file a final stamp rule for the target that stamps