Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: tools/gn/ninja_target_writer.h

Issue 2152413002: GN: don't write separate files for non-binary targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/ninja_build_writer_unittest.cc ('k') | tools/gn/ninja_target_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef TOOLS_GN_NINJA_TARGET_WRITER_H_ 5 #ifndef TOOLS_GN_NINJA_TARGET_WRITER_H_
6 #define TOOLS_GN_NINJA_TARGET_WRITER_H_ 6 #define TOOLS_GN_NINJA_TARGET_WRITER_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "tools/gn/path_output.h" 11 #include "tools/gn/path_output.h"
12 #include "tools/gn/substitution_type.h" 12 #include "tools/gn/substitution_type.h"
13 13
14 class FileTemplate; 14 class FileTemplate;
15 class OutputFile; 15 class OutputFile;
16 class Settings; 16 class Settings;
17 class Target; 17 class Target;
18 struct SubstitutionBits; 18 struct SubstitutionBits;
19 19
20 // Generates one target's ".ninja" file. The toplevel "build.ninja" file is 20 // Generates one target's ".ninja" file. The toplevel "build.ninja" file is
21 // generated by the NinjaBuildWriter. 21 // generated by the NinjaBuildWriter.
22 class NinjaTargetWriter { 22 class NinjaTargetWriter {
23 public: 23 public:
24 NinjaTargetWriter(const Target* target, std::ostream& out); 24 NinjaTargetWriter(const Target* target, std::ostream& out);
25 virtual ~NinjaTargetWriter(); 25 virtual ~NinjaTargetWriter();
26 26
27 static void RunAndWriteFile(const Target* target); 27 // Returns the build line to be written to the toolchain build file.
28 //
29 // Some targets have their rules written to separate files, and some can have
30 // their rules coalesced in the main build file. For the coalesced case, this
31 // function will return the rules as a string. For the separate file case,
32 // the separate ninja file will be written and the return string will be the
33 // subninja command to load that file.
34 static std::string RunAndWriteFile(const Target* target);
28 35
29 virtual void Run() = 0; 36 virtual void Run() = 0;
30 37
31 protected: 38 protected:
32 // Writes out the substitution values that are shared between the different 39 // Writes out the substitution values that are shared between the different
33 // types of tools (target gen dir, target label, etc.). Only the substitutions 40 // types of tools (target gen dir, target label, etc.). Only the substitutions
34 // identified by the given bits will be written. 41 // identified by the given bits will be written.
35 void WriteSharedVars(const SubstitutionBits& bits); 42 void WriteSharedVars(const SubstitutionBits& bits);
36 43
37 // Writes to the output stream a stamp rule for input dependencies, and 44 // Writes to the output stream a stamp rule for input dependencies, and
(...skipping 16 matching lines...) Expand all
54 PathOutput path_output_; 61 PathOutput path_output_;
55 62
56 private: 63 private:
57 void WriteCopyRules(); 64 void WriteCopyRules();
58 void WriteEscapedSubstitution(SubstitutionType type); 65 void WriteEscapedSubstitution(SubstitutionType type);
59 66
60 DISALLOW_COPY_AND_ASSIGN(NinjaTargetWriter); 67 DISALLOW_COPY_AND_ASSIGN(NinjaTargetWriter);
61 }; 68 };
62 69
63 #endif // TOOLS_GN_NINJA_TARGET_WRITER_H_ 70 #endif // TOOLS_GN_NINJA_TARGET_WRITER_H_
OLDNEW
« no previous file with comments | « tools/gn/ninja_build_writer_unittest.cc ('k') | tools/gn/ninja_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698