• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2016 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_JSON_WRITER_H_
6 #define TOOLS_GN_JSON_WRITER_H_
7 
8 #include "gn/err.h"
9 #include "gn/target.h"
10 
11 class Builder;
12 class BuildSettings;
13 class StringOutputBuffer;
14 
15 class JSONProjectWriter {
16  public:
17   static bool RunAndWriteFiles(const BuildSettings* build_setting,
18                                const Builder& builder,
19                                const std::string& file_name,
20                                const std::string& exec_script,
21                                const std::string& exec_script_extra_args,
22                                const std::string& dir_filter_string,
23                                bool quiet,
24                                Err* err);
25 
26  private:
27   FRIEND_TEST_ALL_PREFIXES(JSONWriter, ActionWithResponseFile);
28   FRIEND_TEST_ALL_PREFIXES(JSONWriter, ForEachWithResponseFile);
29   FRIEND_TEST_ALL_PREFIXES(JSONWriter, RustTarget);
30 
31   static StringOutputBuffer GenerateJSON(
32       const BuildSettings* build_settings,
33       std::vector<const Target*>& all_targets);
34 
35   static std::string RenderJSON(const BuildSettings* build_settings,
36                                 std::vector<const Target*>& all_targets);
37 };
38 
39 #endif
40