| Index: tools/gn/xcode_writer.h
|
| diff --git a/tools/gn/xcode_writer.h b/tools/gn/xcode_writer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0a11dde0403c7f8560dedeb01239aa993b9603fb
|
| --- /dev/null
|
| +++ b/tools/gn/xcode_writer.h
|
| @@ -0,0 +1,90 @@
|
| +// 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_XCODE_WRITER_H_
|
| +#define TOOLS_GN_XCODE_WRITER_H_
|
| +
|
| +#include <iosfwd>
|
| +#include <map>
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/macros.h"
|
| +
|
| +class Builder;
|
| +class BuildSettings;
|
| +class Err;
|
| +class SourceDir;
|
| +class Target;
|
| +
|
| +using PBXAttributes = std::map<std::string, std::string>;
|
| +class PBXProject;
|
| +
|
| +class XcodeWriter {
|
| + public:
|
| + enum TargetOsType {
|
| + WRITER_TARGET_OS_IOS,
|
| + WRITER_TARGET_OS_MACOS,
|
| + };
|
| +
|
| + // Writes Xcode workspace and project files.
|
| + //
|
| + // |workspace_name| is the optional name of the workspace file name ("all"
|
| + // is used if not specified). |root_target_name| is the name of the main
|
| + // target corresponding to building "All" (for example "gn_all" in Chromium).
|
| + // |ninja_extra_args| are additional arguments to pass to ninja invocation
|
| + // (can be used to increase limit of concurrent processes when using goma).
|
| + // |target_filter_pattern| is a regular expression used to filter the targets
|
| + // to generate. If not set, all targets are present in the generated project.
|
| + //
|
| + // On failure will populate |err| and return false.
|
| + static bool RunAndWriteFiles(const std::string& workspace_name,
|
| + const std::string& root_target_name,
|
| + const std::string& ninja_extra_args,
|
| + const std::string& target_filter_pattern,
|
| + const BuildSettings* build_settings,
|
| + Builder* builder,
|
| + Err* err);
|
| +
|
| + private:
|
| + XcodeWriter(const std::string& name);
|
| + ~XcodeWriter();
|
| +
|
| + static std::vector<const Target*> FilterTargets(
|
| + const std::vector<const Target*>& all_targets,
|
| + const std::string& target_filter_pattern);
|
| +
|
| + void CreateMainProject(const std::vector<const Target*>& targets,
|
| + const PBXAttributes& attributes,
|
| + const std::string& project_name,
|
| + const std::string& source_path,
|
| + const std::string& config_name,
|
| + const std::string& root_target,
|
| + const std::string& ninja_extra_args,
|
| + const std::string& target_filter_pattern,
|
| + TargetOsType target_os);
|
| +
|
| + void CreateSourceForIndexingProject(const std::vector<const Target*>& targets,
|
| + const SourceDir& root_build_dir,
|
| + const PBXAttributes& attributes,
|
| + const std::string& project_name,
|
| + const std::string& source_path,
|
| + const std::string& config_name,
|
| + TargetOsType target_os);
|
| +
|
| + bool WriteFiles(const BuildSettings* build_settings, Err* err);
|
| + bool WriteProjectFile(const BuildSettings* build_settings,
|
| + PBXProject* project,
|
| + Err* err);
|
| +
|
| + void WriteWorkspaceContent(std::ostream& out);
|
| + void WriteProjectContent(std::ostream& out, PBXProject* project);
|
| +
|
| + std::string name_;
|
| + std::vector<std::unique_ptr<PBXProject>> projects_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(XcodeWriter);
|
| +};
|
| +
|
| +#endif // TOOLS_GN_XCODE_WRITER_H_
|
|
|