Add utility functions needed for rect-based event targeting
[chromium-blink-merge.git] / tools / gn / ninja_target_writer.h
blob9e6f2406f4404bcb835e89c0c6ef0b52b3aadf43
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
3 // found in the LICENSE file.
5 #ifndef TOOLS_GN_NINJA_TARGET_WRITER_H_
6 #define TOOLS_GN_NINJA_TARGET_WRITER_H_
8 #include <iosfwd>
10 #include "base/basictypes.h"
11 #include "tools/gn/ninja_helper.h"
12 #include "tools/gn/path_output.h"
14 class FileTemplate;
15 class Settings;
16 class Target;
18 // Generates one target's ".ninja" file. The toplevel "build.ninja" file is
19 // generated by the NinjaBuildWriter.
20 class NinjaTargetWriter {
21 public:
22 NinjaTargetWriter(const Target* target, std::ostream& out);
23 virtual ~NinjaTargetWriter();
25 static void RunAndWriteFile(const Target* target);
27 virtual void Run() = 0;
29 protected:
30 void WriteEnvironment();
32 // Returns the toolchain associated with the target.
33 const Toolchain* GetToolchain() const;
35 // Returns the string to be appended to source rules that encodes the
36 // order-only dependencies for the current target. This will include the
37 // "|" character so can just be appended to the source rules. If there are no
38 // implicit dependencies, returns the empty string.
39 std::string GetSourcesImplicitDeps() const;
41 // Returns the FileTemplate constructed from the outputs variable.
42 FileTemplate GetOutputTemplate() const;
44 const Settings* settings_; // Non-owning.
45 const Target* target_; // Non-owning.
46 std::ostream& out_;
47 PathOutput path_output_;
49 NinjaHelper helper_;
51 private:
52 void WriteCopyRules();
54 DISALLOW_COPY_AND_ASSIGN(NinjaTargetWriter);
57 #endif // TOOLS_GN_NINJA_TARGET_WRITER_H_