1 // Copyright 2019 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. 4 5 #ifndef TOOLS_GN_NINJA_RUST_BINARY_TARGET_WRITER_H_ 6 #define TOOLS_GN_NINJA_RUST_BINARY_TARGET_WRITER_H_ 7 8 #include "base/macros.h" 9 #include "gn/ninja_binary_target_writer.h" 10 #include "gn/rust_tool.h" 11 12 struct EscapeOptions; 13 14 // Writes a .ninja file for a binary target type (an executable, a shared 15 // library, or a static library). 16 class NinjaRustBinaryTargetWriter : public NinjaBinaryTargetWriter { 17 public: 18 NinjaRustBinaryTargetWriter(const Target* target, std::ostream& out); 19 ~NinjaRustBinaryTargetWriter() override; 20 21 void Run() override; 22 23 private: 24 void WriteCompilerVars(); 25 void WriteSources(const OutputFile& input_dep, 26 const std::vector<OutputFile>& order_only_deps); 27 void WriteExterns(const std::vector<const Target*>& deps); 28 void WriteRustdeps(const std::vector<OutputFile>& rustdeps, 29 const std::vector<OutputFile>& nonrustdeps); 30 void WriteEdition(); 31 32 const RustTool* tool_; 33 34 DISALLOW_COPY_AND_ASSIGN(NinjaRustBinaryTargetWriter); 35 }; 36 37 #endif // TOOLS_GN_NINJA_RUST_BINARY_TARGET_WRITER_H_ 38