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

Side by Side Diff: tools/gn/target.cc

Issue 1606553002: Add support for Mac/iOS application bundles to GN tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: base_unittests builds and pass all tests with GN Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/target.h" 5 #include "tools/gn/target.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 case LOADABLE_MODULE: 131 case LOADABLE_MODULE:
132 return "Loadable module"; 132 return "Loadable module";
133 case SHARED_LIBRARY: 133 case SHARED_LIBRARY:
134 return "Shared library"; 134 return "Shared library";
135 case STATIC_LIBRARY: 135 case STATIC_LIBRARY:
136 return "Static library"; 136 return "Static library";
137 case SOURCE_SET: 137 case SOURCE_SET:
138 return "Source set"; 138 return "Source set";
139 case COPY_FILES: 139 case COPY_FILES:
140 return "Copy"; 140 return "Copy";
141 case COPY_BUNDLE_DATA:
142 return "Copy bundle data";
141 case ACTION: 143 case ACTION:
142 return "Action"; 144 return "Action";
143 case ACTION_FOREACH: 145 case ACTION_FOREACH:
144 return "ActionForEach"; 146 return "ActionForEach";
145 default: 147 default:
146 return ""; 148 return "";
147 } 149 }
148 } 150 }
149 151
150 Target* Target::AsTarget() { 152 Target* Target::AsTarget() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // inherited through the dependency tree (other flags don't work this way). 188 // inherited through the dependency tree (other flags don't work this way).
187 // 189 //
188 // This needs to happen after we pull dependent target configs for the 190 // This needs to happen after we pull dependent target configs for the
189 // public config's libs to be included here. And it needs to happen 191 // public config's libs to be included here. And it needs to happen
190 // before pulling the dependent target libs so the libs are in the correct 192 // before pulling the dependent target libs so the libs are in the correct
191 // order (local ones first, then the dependency's). 193 // order (local ones first, then the dependency's).
192 for (ConfigValuesIterator iter(this); !iter.done(); iter.Next()) { 194 for (ConfigValuesIterator iter(this); !iter.done(); iter.Next()) {
193 const ConfigValues& cur = iter.cur(); 195 const ConfigValues& cur = iter.cur();
194 all_lib_dirs_.append(cur.lib_dirs().begin(), cur.lib_dirs().end()); 196 all_lib_dirs_.append(cur.lib_dirs().begin(), cur.lib_dirs().end());
195 all_libs_.append(cur.libs().begin(), cur.libs().end()); 197 all_libs_.append(cur.libs().begin(), cur.libs().end());
198 if (output_type_ == COPY_BUNDLE_DATA) {
199 sources_.insert(
200 sources_.end(), cur.bundle_data().begin(), cur.bundle_data().end());
201 }
196 } 202 }
197 203
198 PullDependentTargetLibs(); 204 PullDependentTargetLibs();
199 PullRecursiveHardDeps(); 205 PullRecursiveHardDeps();
200 if (!ResolvePrecompiledHeaders(err)) 206 if (!ResolvePrecompiledHeaders(err))
201 return false; 207 return false;
202 208
203 FillOutputFiles(); 209 FillOutputFiles();
204 210
205 if (settings()->build_settings()->check_for_bad_items()) { 211 if (settings()->build_settings()->check_for_bad_items()) {
(...skipping 13 matching lines...) Expand all
219 return output_type_ == STATIC_LIBRARY || output_type_ == SHARED_LIBRARY; 225 return output_type_ == STATIC_LIBRARY || output_type_ == SHARED_LIBRARY;
220 } 226 }
221 227
222 bool Target::IsFinal() const { 228 bool Target::IsFinal() const {
223 return output_type_ == EXECUTABLE || 229 return output_type_ == EXECUTABLE ||
224 output_type_ == SHARED_LIBRARY || 230 output_type_ == SHARED_LIBRARY ||
225 output_type_ == LOADABLE_MODULE || 231 output_type_ == LOADABLE_MODULE ||
226 output_type_ == ACTION || 232 output_type_ == ACTION ||
227 output_type_ == ACTION_FOREACH || 233 output_type_ == ACTION_FOREACH ||
228 output_type_ == COPY_FILES || 234 output_type_ == COPY_FILES ||
235 output_type_ == COPY_BUNDLE_DATA ||
229 (output_type_ == STATIC_LIBRARY && complete_static_lib_); 236 (output_type_ == STATIC_LIBRARY && complete_static_lib_);
230 } 237 }
231 238
232 DepsIteratorRange Target::GetDeps(DepsIterationType type) const { 239 DepsIteratorRange Target::GetDeps(DepsIterationType type) const {
233 if (type == DEPS_LINKED) { 240 if (type == DEPS_LINKED) {
234 return DepsIteratorRange(DepsIterator( 241 return DepsIteratorRange(DepsIterator(
235 &public_deps_, &private_deps_, nullptr)); 242 &public_deps_, &private_deps_, nullptr));
236 } 243 }
237 // All deps. 244 // All deps.
238 return DepsIteratorRange(DepsIterator( 245 return DepsIteratorRange(DepsIterator(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 363 }
357 } 364 }
358 365
359 void Target::FillOutputFiles() { 366 void Target::FillOutputFiles() {
360 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); 367 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this);
361 bool check_tool_outputs = false; 368 bool check_tool_outputs = false;
362 switch (output_type_) { 369 switch (output_type_) {
363 case GROUP: 370 case GROUP:
364 case SOURCE_SET: 371 case SOURCE_SET:
365 case COPY_FILES: 372 case COPY_FILES:
373 case COPY_BUNDLE_DATA:
366 case ACTION: 374 case ACTION:
367 case ACTION_FOREACH: { 375 case ACTION_FOREACH: {
368 // These don't get linked to and use stamps which should be the first 376 // These don't get linked to and use stamps which should be the first
369 // entry in the outputs. These stamps are named 377 // entry in the outputs. These stamps are named
370 // "<target_out_dir>/<targetname>.stamp". 378 // "<target_out_dir>/<targetname>.stamp".
371 dependency_output_file_ = GetTargetOutputDirAsOutputFile(this); 379 dependency_output_file_ = GetTargetOutputDirAsOutputFile(this);
372 dependency_output_file_.value().append(GetComputedOutputName(true)); 380 dependency_output_file_.value().append(GetComputedOutputName(true));
373 dependency_output_file_.value().append(".stamp"); 381 dependency_output_file_.value().append(".stamp");
374 break; 382 break;
375 } 383 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 return; // Not in output dir, this is OK. 572 return; // Not in output dir, this is OK.
565 573
566 // Tell the scheduler about unknown files. This will be noted for later so 574 // Tell the scheduler about unknown files. This will be noted for later so
567 // the list of files written by the GN build itself (often response files) 575 // the list of files written by the GN build itself (often response files)
568 // can be filtered out of this list. 576 // can be filtered out of this list.
569 OutputFile out_file(settings()->build_settings(), source); 577 OutputFile out_file(settings()->build_settings(), source);
570 std::set<const Target*> seen_targets; 578 std::set<const Target*> seen_targets;
571 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) 579 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets))
572 g_scheduler->AddUnknownGeneratedInput(this, source); 580 g_scheduler->AddUnknownGeneratedInput(this, source);
573 } 581 }
OLDNEW
« tools/gn/target.h ('K') | « tools/gn/target.h ('k') | tools/gn/target_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698