Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 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_ECLIPSE_WRITER_H_ | |
| 6 #define TOOLS_GN_ECLIPSE_WRITER_H_ | |
| 7 | |
| 8 #include <iosfwd> | |
| 9 #include <map> | |
| 10 #include <set> | |
| 11 #include <string> | |
| 12 #include <vector> | |
| 13 | |
| 14 #include "base/macros.h" | |
| 15 | |
| 16 class BuildSettings; | |
| 17 class Builder; | |
| 18 class Err; | |
| 19 class Target; | |
| 20 | |
| 21 // This DOES NOT generate Eclipse CDT projects. Instead, it generates a settings | |
| 22 // file which can be imported into an Eclipse CDT project. The XML file contains | |
| 23 // a list of include paths and defines. | |
| 24 // | |
| 25 // Because a full .cproject definition is not created by this generator, it's | |
| 26 // not possible to properly define the include dirs and defines for each file | |
| 27 // individually. Instead, one set of includes/defines is generated for the | |
| 28 // entire project. This works fairly well (and is a vast improvement in | |
| 29 // general), but may still result in a few indexer issues here and there. | |
| 30 class EclipseWriter { | |
| 31 public: | |
| 32 static bool RunAndWriteFile(const BuildSettings* build_settings, | |
| 33 const Builder* builder, | |
| 34 Err* err); | |
| 35 | |
| 36 private: | |
| 37 EclipseWriter(const BuildSettings* build_settings, | |
| 38 const Builder* builder, | |
| 39 std::ostream& out); | |
| 40 ~EclipseWriter(); | |
| 41 | |
| 42 void Run(); | |
| 43 | |
| 44 // Populates |include_dirs_| with the include dirs of all the targets for the | |
|
brettw
2016/02/17 18:47:00
There should be a "private:" label somewhere in he
pkotwicz
2016/02/17 20:53:38
The private label is on line 36
| |
| 45 // default toolchain. | |
| 46 void GetAllIncludeDirs(); | |
| 47 | |
| 48 // Populates |defines_| with the defines of all the targets for the default | |
| 49 // toolchain. | |
| 50 void GetAllDefines(); | |
| 51 | |
| 52 // Returns true if |target| uses the default toolchain. | |
| 53 bool UsesDefaultToolchain(const Target* target) const; | |
| 54 | |
| 55 // Writes the XML settings file. | |
| 56 void WriteCDTSettings(); | |
| 57 | |
| 58 const BuildSettings* build_settings_; | |
| 59 const Builder* builder_; | |
| 60 | |
| 61 // The output stream for the settings file. | |
| 62 std::ostream& out_; | |
| 63 | |
| 64 // Eclipse languages for which the include dirs and defines apply. | |
| 65 std::vector<std::string> languages_; | |
| 66 | |
| 67 // The include dirs of all the targets which use the default toolchain. | |
| 68 std::set<std::string> include_dirs_; | |
| 69 | |
| 70 // The defines of all the targets which use the default toolchain. | |
| 71 std::map<std::string, std::string> defines_; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(EclipseWriter); | |
| 74 }; | |
| 75 | |
| 76 #endif // TOOLS_GN_ECLIPSE_WRITER_H_ | |
| OLD | NEW |