OLD | NEW |
---|---|
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 <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 } | 205 } |
206 | 206 |
207 return true; | 207 return true; |
208 } | 208 } |
209 | 209 |
210 } // namespace | 210 } // namespace |
211 | 211 |
212 Target::Target(const Settings* settings, const Label& label) | 212 Target::Target(const Settings* settings, const Label& label) |
213 : Item(settings, label), | 213 : Item(settings, label), |
214 output_type_(UNKNOWN), | 214 output_type_(UNKNOWN), |
215 output_prefix_override_(false), | |
216 output_extension_set_(false), | |
215 all_headers_public_(true), | 217 all_headers_public_(true), |
216 check_includes_(true), | 218 check_includes_(true), |
217 complete_static_lib_(false), | 219 complete_static_lib_(false), |
218 testonly_(false), | 220 testonly_(false), |
219 toolchain_(nullptr) { | 221 toolchain_(nullptr) { |
220 } | 222 } |
221 | 223 |
222 Target::~Target() { | 224 Target::~Target() { |
223 } | 225 } |
224 | 226 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 DepsIteratorRange Target::GetDeps(DepsIterationType type) const { | 353 DepsIteratorRange Target::GetDeps(DepsIterationType type) const { |
352 if (type == DEPS_LINKED) { | 354 if (type == DEPS_LINKED) { |
353 return DepsIteratorRange(DepsIterator( | 355 return DepsIteratorRange(DepsIterator( |
354 &public_deps_, &private_deps_, nullptr)); | 356 &public_deps_, &private_deps_, nullptr)); |
355 } | 357 } |
356 // All deps. | 358 // All deps. |
357 return DepsIteratorRange(DepsIterator( | 359 return DepsIteratorRange(DepsIterator( |
358 &public_deps_, &private_deps_, &data_deps_)); | 360 &public_deps_, &private_deps_, &data_deps_)); |
359 } | 361 } |
360 | 362 |
361 std::string Target::GetComputedOutputName(bool include_prefix) const { | 363 std::string Target::GetComputedOutputName(bool include_prefix) const { |
Robert Sesek
2016/04/07 21:34:47
This method is only ever called by non-test code w
brettw
2016/04/07 23:12:29
Good point.
| |
362 DCHECK(toolchain_) | 364 DCHECK(toolchain_) |
363 << "Toolchain must be specified before getting the computed output name."; | 365 << "Toolchain must be specified before getting the computed output name."; |
364 | 366 |
365 const std::string& name = output_name_.empty() ? label().name() | 367 const std::string& name = output_name_.empty() ? label().name() |
366 : output_name_; | 368 : output_name_; |
367 | 369 |
368 std::string result; | 370 std::string result; |
369 if (include_prefix) { | 371 if (include_prefix) { |
370 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); | 372 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); |
371 if (tool) { | 373 if (tool) { |
372 // Only add the prefix if the name doesn't already have it. | 374 // Only add the prefix if the name doesn't already have it and it's not |
373 if (!base::StartsWith(name, tool->output_prefix(), | 375 // being overridden. |
376 if (!output_prefix_override_ && | |
377 !base::StartsWith(name, tool->output_prefix(), | |
374 base::CompareCase::SENSITIVE)) | 378 base::CompareCase::SENSITIVE)) |
375 result = tool->output_prefix(); | 379 result = tool->output_prefix(); |
376 } | 380 } |
377 } | 381 } |
378 result.append(name); | 382 result.append(name); |
379 return result; | 383 return result; |
380 } | 384 } |
381 | 385 |
382 bool Target::SetToolchain(const Toolchain* toolchain, Err* err) { | 386 bool Target::SetToolchain(const Toolchain* toolchain, Err* err) { |
383 DCHECK(!toolchain_); | 387 DCHECK(!toolchain_); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
777 check_data_deps = g_scheduler->IsFileGeneratedByWriteRuntimeDeps(out_file); | 781 check_data_deps = g_scheduler->IsFileGeneratedByWriteRuntimeDeps(out_file); |
778 // Check object files (much slower and very rare) only if the "normal" | 782 // Check object files (much slower and very rare) only if the "normal" |
779 // output check failed. | 783 // output check failed. |
780 consider_object_files = !check_data_deps; | 784 consider_object_files = !check_data_deps; |
781 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, | 785 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, |
782 consider_object_files, | 786 consider_object_files, |
783 check_data_deps, &seen_targets)) | 787 check_data_deps, &seen_targets)) |
784 g_scheduler->AddUnknownGeneratedInput(this, source); | 788 g_scheduler->AddUnknownGeneratedInput(this, source); |
785 } | 789 } |
786 } | 790 } |
OLD | NEW |