| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "tools/gn/config_values_extractors.h" | 10 #include "tools/gn/config_values_extractors.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 << "Toolchain must be specified before getting the computed output name."; | 212 << "Toolchain must be specified before getting the computed output name."; |
| 213 | 213 |
| 214 const std::string& name = output_name_.empty() ? label().name() | 214 const std::string& name = output_name_.empty() ? label().name() |
| 215 : output_name_; | 215 : output_name_; |
| 216 | 216 |
| 217 std::string result; | 217 std::string result; |
| 218 if (include_prefix) { | 218 if (include_prefix) { |
| 219 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); | 219 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); |
| 220 if (tool) { | 220 if (tool) { |
| 221 // Only add the prefix if the name doesn't already have it. | 221 // Only add the prefix if the name doesn't already have it. |
| 222 if (!base::StartsWithASCII(name, tool->output_prefix(), true)) | 222 if (!base::StartsWith(name, tool->output_prefix(), |
| 223 base::CompareCase::SENSITIVE)) |
| 223 result = tool->output_prefix(); | 224 result = tool->output_prefix(); |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 result.append(name); | 227 result.append(name); |
| 227 return result; | 228 return result; |
| 228 } | 229 } |
| 229 | 230 |
| 230 bool Target::SetToolchain(const Toolchain* toolchain, Err* err) { | 231 bool Target::SetToolchain(const Toolchain* toolchain, Err* err) { |
| 231 DCHECK(!toolchain_); | 232 DCHECK(!toolchain_); |
| 232 DCHECK_NE(UNKNOWN, output_type_); | 233 DCHECK_NE(UNKNOWN, output_type_); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 return; // Not in output dir, this is OK. | 554 return; // Not in output dir, this is OK. |
| 554 | 555 |
| 555 // Tell the scheduler about unknown files. This will be noted for later so | 556 // Tell the scheduler about unknown files. This will be noted for later so |
| 556 // the list of files written by the GN build itself (often response files) | 557 // the list of files written by the GN build itself (often response files) |
| 557 // can be filtered out of this list. | 558 // can be filtered out of this list. |
| 558 OutputFile out_file(settings()->build_settings(), source); | 559 OutputFile out_file(settings()->build_settings(), source); |
| 559 std::set<const Target*> seen_targets; | 560 std::set<const Target*> seen_targets; |
| 560 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) | 561 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) |
| 561 g_scheduler->AddUnknownGeneratedInput(this, source); | 562 g_scheduler->AddUnknownGeneratedInput(this, source); |
| 562 } | 563 } |
| OLD | NEW |