Chromium Code Reviews| Index: tools/gn/eclipse_writer.h |
| diff --git a/tools/gn/eclipse_writer.h b/tools/gn/eclipse_writer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..800b7d73b621dffcbbac50d03212e37b927a6b8a |
| --- /dev/null |
| +++ b/tools/gn/eclipse_writer.h |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef TOOLS_GN_ECLIPSE_WRITER_H_ |
| +#define TOOLS_GN_ECLIPSE_WRITER_H_ |
| + |
| +#include <iosfwd> |
| +#include <map> |
| +#include <set> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| + |
| +class BuildSettings; |
| +class Builder; |
| +class Err; |
| +class Target; |
| + |
| +// This DOES NOT generate Eclipse CDT projects. Instead, it generates a settings |
| +// file which can be imported into an Eclipse CDT project. The XML file contains |
| +// a list of include paths and defines. |
| +// |
| +// Because a full .cproject definition is not created by this generator, it's |
| +// not possible to properly define the include dirs and defines for each file |
| +// individually. Instead, one set of includes/defines is generated for the |
| +// entire project. This works fairly well (and is a vast improvement in |
| +// general), but may still result in a few indexer issues here and there. |
| +class EclipseWriter { |
| + public: |
| + static bool RunAndWriteFile(const BuildSettings* build_settings, |
| + const Builder* builder, |
| + Err* err); |
| + |
| + private: |
| + EclipseWriter(const BuildSettings* build_settings, |
| + const Builder* builder, |
| + std::ostream& out); |
| + ~EclipseWriter(); |
| + |
| + void Run(); |
| + |
| + // 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
|
| + // default toolchain. |
| + void GetAllIncludeDirs(); |
| + |
| + // Populates |defines_| with the defines of all the targets for the default |
| + // toolchain. |
| + void GetAllDefines(); |
| + |
| + // Returns true if |target| uses the default toolchain. |
| + bool UsesDefaultToolchain(const Target* target) const; |
| + |
| + // Writes the XML settings file. |
| + void WriteCDTSettings(); |
| + |
| + const BuildSettings* build_settings_; |
| + const Builder* builder_; |
| + |
| + // The output stream for the settings file. |
| + std::ostream& out_; |
| + |
| + // Eclipse languages for which the include dirs and defines apply. |
| + std::vector<std::string> languages_; |
| + |
| + // The include dirs of all the targets which use the default toolchain. |
| + std::set<std::string> include_dirs_; |
| + |
| + // The defines of all the targets which use the default toolchain. |
| + std::map<std::string, std::string> defines_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(EclipseWriter); |
| +}; |
| + |
| +#endif // TOOLS_GN_ECLIPSE_WRITER_H_ |