Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: tools/gn/xcode_object.cc

Issue 2779833002: [iOS] Add application target as dependency of xctest module target. (Closed)
Patch Set: Update comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/xcode_object.h ('k') | tools/gn/xcode_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/xcode_object.cc
diff --git a/tools/gn/xcode_object.cc b/tools/gn/xcode_object.cc
index 9d574a570debfa9dabe79fa00a002f47aacc6c41..b8c8502a213f65dad3dddd46b59d8ddaa03a48cf 100644
--- a/tools/gn/xcode_object.cc
+++ b/tools/gn/xcode_object.cc
@@ -244,6 +244,8 @@ const char* ToString(PBXObjectClass cls) {
return "PBXAggregateTarget";
case PBXBuildFileClass:
return "PBXBuildFile";
+ case PBXContainerItemProxyClass:
+ return "PBXContainerItemProxy";
case PBXFileReferenceClass:
return "PBXFileReference";
case PBXFrameworksBuildPhaseClass:
@@ -258,6 +260,8 @@ const char* ToString(PBXObjectClass cls) {
return "PBXShellScriptBuildPhase";
case PBXSourcesBuildPhaseClass:
return "PBXSourcesBuildPhase";
+ case PBXTargetDependencyClass:
+ return "PBXTargetDependency";
case XCBuildConfigurationClass:
return "XCBuildConfiguration";
case XCConfigurationListClass:
@@ -323,6 +327,11 @@ PBXTarget::PBXTarget(const std::string& name,
PBXTarget::~PBXTarget() {}
+void PBXTarget::AddDependency(std::unique_ptr<PBXTargetDependency> dependency) {
+ DCHECK(dependency);
+ dependencies_.push_back(std::move(dependency));
+}
+
std::string PBXTarget::Name() const {
return name_;
}
@@ -330,9 +339,10 @@ std::string PBXTarget::Name() const {
void PBXTarget::Visit(PBXObjectVisitor& visitor) {
PBXObject::Visit(visitor);
configurations_->Visit(visitor);
- for (const auto& build_phase : build_phases_) {
+ for (const auto& dependency : dependencies_)
+ dependency->Visit(visitor);
+ for (const auto& build_phase : build_phases_)
build_phase->Visit(visitor);
- }
}
// PBXAggregateTarget ---------------------------------------------------------
@@ -399,6 +409,37 @@ void PBXBuildFile::Print(std::ostream& out, unsigned indent) const {
out << "};\n";
}
+// PBXContainerItemProxy ------------------------------------------------------
+PBXContainerItemProxy::PBXContainerItemProxy(const PBXProject* project,
+ const PBXTarget* target)
+ : project_(project), target_(target) {}
+
+PBXContainerItemProxy::~PBXContainerItemProxy() {}
+
+PBXObjectClass PBXContainerItemProxy::Class() const {
+ return PBXContainerItemProxyClass;
+}
+
+void PBXContainerItemProxy::Visit(PBXObjectVisitor& visitor) {
+ PBXObject::Visit(visitor);
+}
+
+std::string PBXContainerItemProxy::Name() const {
+ return "PBXContainerItemProxy";
+}
+
+void PBXContainerItemProxy::Print(std::ostream& out, unsigned indent) const {
+ const std::string indent_str(indent, '\t');
+ const IndentRules rules = {true, 0};
+ out << indent_str << Reference() << " = {";
+ PrintProperty(out, rules, "isa", ToString(Class()));
+ PrintProperty(out, rules, "containerPortal", project_);
+ PrintProperty(out, rules, "proxyType", 1u);
+ PrintProperty(out, rules, "remoteGlobalIDString", target_);
+ PrintProperty(out, rules, "remoteInfo", target_->Name());
+ out << indent_str << "};\n";
+}
+
// PBXFileReference -----------------------------------------------------------
PBXFileReference::PBXFileReference(const std::string& name,
@@ -604,7 +645,7 @@ void PBXNativeTarget::Print(std::ostream& out, unsigned indent) const {
PrintProperty(out, rules, "buildConfigurationList", configurations_);
PrintProperty(out, rules, "buildPhases", build_phases_);
PrintProperty(out, rules, "buildRules", EmptyPBXObjectVector());
- PrintProperty(out, rules, "dependencies", EmptyPBXObjectVector());
+ PrintProperty(out, rules, "dependencies", dependencies_);
PrintProperty(out, rules, "name", name_);
PrintProperty(out, rules, "productName", product_name_);
PrintProperty(out, rules, "productReference", product_reference_);
@@ -843,6 +884,33 @@ void PBXSourcesBuildPhase::Print(std::ostream& out, unsigned indent) const {
out << indent_str << "};\n";
}
+PBXTargetDependency::PBXTargetDependency(
+ const PBXTarget* target,
+ std::unique_ptr<PBXContainerItemProxy> container_item_proxy)
+ : target_(target), container_item_proxy_(std::move(container_item_proxy)) {}
+
+PBXTargetDependency::~PBXTargetDependency() {}
+
+PBXObjectClass PBXTargetDependency::Class() const {
+ return PBXTargetDependencyClass;
+}
+std::string PBXTargetDependency::Name() const {
+ return "PBXTargetDependency";
+}
+void PBXTargetDependency::Visit(PBXObjectVisitor& visitor) {
+ PBXObject::Visit(visitor);
+ container_item_proxy_->Visit(visitor);
+}
+void PBXTargetDependency::Print(std::ostream& out, unsigned indent) const {
+ const std::string indent_str(indent, '\t');
+ const IndentRules rules = {false, indent + 1};
+ out << indent_str << Reference() << " = {\n";
+ PrintProperty(out, rules, "isa", ToString(Class()));
+ PrintProperty(out, rules, "target", target_);
+ PrintProperty(out, rules, "targetProxy", container_item_proxy_);
+ out << indent_str << "};\n";
+}
+
// XCBuildConfiguration -------------------------------------------------------
XCBuildConfiguration::XCBuildConfiguration(const std::string& name,
« no previous file with comments | « tools/gn/xcode_object.h ('k') | tools/gn/xcode_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698