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

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

Issue 440333002: Support more configurability in GN toolchains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/basictypes.h" 10 #include "base/basictypes.h"
11 #include "tools/gn/ninja_helper.h"
12 #include "tools/gn/path_output.h" 11 #include "tools/gn/path_output.h"
12 #include "tools/gn/substitution_type.h"
jamesr 2014/08/19 19:30:41 could just forward declare SubstitutionBits, but t
13 13
14 class FileTemplate; 14 class FileTemplate;
15 class Settings; 15 class Settings;
16 class Target; 16 class Target;
17 17
18 // Generates one target's ".ninja" file. The toplevel "build.ninja" file is 18 // Generates one target's ".ninja" file. The toplevel "build.ninja" file is
19 // generated by the NinjaBuildWriter. 19 // generated by the NinjaBuildWriter.
20 class NinjaTargetWriter { 20 class NinjaTargetWriter {
21 public: 21 public:
22 NinjaTargetWriter(const Target* target, 22 NinjaTargetWriter(const Target* target, std::ostream& out);
23 const Toolchain* toolchain,
24 std::ostream& out);
25 virtual ~NinjaTargetWriter(); 23 virtual ~NinjaTargetWriter();
26 24
27 static void RunAndWriteFile(const Target* target, const Toolchain* toolchain); 25 static void RunAndWriteFile(const Target* target);
28 26
29 virtual void Run() = 0; 27 virtual void Run() = 0;
30 28
31 protected: 29 protected:
30 // Writes out the substitution values that are shared between the different
31 // types of tools (target gen dir, target label, etc.). Only the substitutions
32 // identified by the given bits will be written.
33 void WriteSharedVars(const SubstitutionBits& bits);
34
32 // Writes to the output stream a stamp rule for input dependencies, and 35 // Writes to the output stream a stamp rule for input dependencies, and
33 // returns the string to be appended to source rules that encodes the 36 // returns the string to be appended to source rules that encodes the
34 // order-only dependencies for the current target. This will include the "|" 37 // order-only dependencies for the current target. This will include the "|"
35 // character so can just be appended to the source rules. If there are no 38 // character so can just be appended to the source rules. If there are no
36 // implicit dependencies and no extra target dependencies passed in, returns 39 // implicit dependencies and no extra target dependencies passed in, returns
37 // the empty string. 40 // the empty string.
38 std::string WriteInputDepsStampAndGetDep( 41 std::string WriteInputDepsStampAndGetDep(
39 const std::vector<const Target*>& extra_hard_deps) const; 42 const std::vector<const Target*>& extra_hard_deps) const;
40 43
44 // Writes to the output file a final stamp rule for the target that stamps
45 // the given list of files. This function assumes the stamp is for the target
46 // as a whole so the stamp file is set as the target's dependency output.
47 void WriteStampForTarget(const std::vector<OutputFile>& deps,
48 const std::vector<OutputFile>& order_only_deps);
49
41 const Settings* settings_; // Non-owning. 50 const Settings* settings_; // Non-owning.
42 const Target* target_; // Non-owning. 51 const Target* target_; // Non-owning.
43 const Toolchain* toolchain_; // Non-owning.
44 std::ostream& out_; 52 std::ostream& out_;
45 PathOutput path_output_; 53 PathOutput path_output_;
46 54
47 NinjaHelper helper_;
48
49 private: 55 private:
50 void WriteCopyRules(); 56 void WriteCopyRules();
51 57
52 DISALLOW_COPY_AND_ASSIGN(NinjaTargetWriter); 58 DISALLOW_COPY_AND_ASSIGN(NinjaTargetWriter);
53 }; 59 };
54 60
55 #endif // TOOLS_GN_NINJA_TARGET_WRITER_H_ 61 #endif // TOOLS_GN_NINJA_TARGET_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698