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

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

Issue 23606031: GN: Use build directory for CD for scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « tools/gn/gn.gyp ('k') | tools/gn/ninja_script_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_SCRIPT_TARGET_WRITER_H_ 5 #ifndef TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_
6 #define TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_ 6 #define TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "tools/gn/ninja_target_writer.h" 9 #include "tools/gn/ninja_target_writer.h"
10 10
11 // Writes a .ninja file for a custom script target type. 11 // Writes a .ninja file for a custom script target type.
12 class NinjaScriptTargetWriter : public NinjaTargetWriter { 12 class NinjaScriptTargetWriter : public NinjaTargetWriter {
13 public: 13 public:
14 NinjaScriptTargetWriter(const Target* target, std::ostream& out); 14 NinjaScriptTargetWriter(const Target* target, std::ostream& out);
15 virtual ~NinjaScriptTargetWriter(); 15 virtual ~NinjaScriptTargetWriter();
16 16
17 virtual void Run() OVERRIDE; 17 virtual void Run() OVERRIDE;
18 18
19 private: 19 private:
20 bool has_sources() const { return !target_->sources().empty(); } 20 bool has_sources() const { return !target_->sources().empty(); }
21 21
22 // Writes the Ninja rule for invoking the script. 22 // Writes the Ninja rule for invoking the script.
23 // 23 //
24 // Returns the name of the custom rule generated. This will be based on the 24 // Returns the name of the custom rule generated. This will be based on the
25 // target name, and will include the string "$unique_name" if there are 25 // target name, and will include the string "$unique_name" if there are
26 // multiple inputs. 26 // multiple inputs.
27 std::string WriteRuleDefinition(const std::string& script_relative_to_cd); 27 std::string WriteRuleDefinition();
28 28
29 // Writes the rules for compiling each source, writing all output files 29 // Writes the rules for compiling each source, writing all output files
30 // to the given vector. 30 // to the given vector.
31 // 31 //
32 // implicit_deps is a precomputed string of all ninja files that are common 32 // implicit_deps is a precomputed string of all ninja files that are common
33 // to each build step, it starts with a "|" if it's nonempty. 33 // to each build step, it starts with a "|" if it's nonempty.
34 void WriteSourceRules(const std::string& custom_rule_name, 34 void WriteSourceRules(const std::string& custom_rule_name,
35 const std::string& implicit_deps, 35 const std::string& implicit_deps,
36 const SourceDir& script_cd,
37 const std::string& script_cd_to_root,
38 std::vector<OutputFile>* output_files); 36 std::vector<OutputFile>* output_files);
39 37
40 void WriteArg(const std::string& arg); 38 void WriteArg(const std::string& arg);
41 39
42 // Writes the .stamp rule that names this target and collects all invocations 40 // Writes the .stamp rule that names this target and collects all invocations
43 // of the script into one thing that other targets can depend on. 41 // of the script into one thing that other targets can depend on.
44 void WriteStamp(const std::vector<OutputFile>& output_files); 42 void WriteStamp(const std::vector<OutputFile>& output_files);
45 43
46 DISALLOW_COPY_AND_ASSIGN(NinjaScriptTargetWriter); 44 DISALLOW_COPY_AND_ASSIGN(NinjaScriptTargetWriter);
47 }; 45 };
48 46
49 #endif // TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_ 47 #endif // TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_
OLDNEW
« no previous file with comments | « tools/gn/gn.gyp ('k') | tools/gn/ninja_script_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698