| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 << "Toolchain must be specified before getting the computed output name."; | 210 << "Toolchain must be specified before getting the computed output name."; |
| 211 | 211 |
| 212 const std::string& name = output_name_.empty() ? label().name() | 212 const std::string& name = output_name_.empty() ? label().name() |
| 213 : output_name_; | 213 : output_name_; |
| 214 | 214 |
| 215 std::string result; | 215 std::string result; |
| 216 if (include_prefix) { | 216 if (include_prefix) { |
| 217 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); | 217 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); |
| 218 const std::string& prefix = tool->output_prefix(); | 218 const std::string& prefix = tool->output_prefix(); |
| 219 // Only add the prefix if the name doesn't already have it. | 219 // Only add the prefix if the name doesn't already have it. |
| 220 if (!StartsWithASCII(name, prefix, true)) | 220 if (!base::StartsWithASCII(name, prefix, true)) |
| 221 result = prefix; | 221 result = prefix; |
| 222 } | 222 } |
| 223 | 223 |
| 224 result.append(name); | 224 result.append(name); |
| 225 return result; | 225 return result; |
| 226 } | 226 } |
| 227 | 227 |
| 228 bool Target::SetToolchain(const Toolchain* toolchain, Err* err) { | 228 bool Target::SetToolchain(const Toolchain* toolchain, Err* err) { |
| 229 DCHECK(!toolchain_); | 229 DCHECK(!toolchain_); |
| 230 DCHECK_NE(UNKNOWN, output_type_); | 230 DCHECK_NE(UNKNOWN, output_type_); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 return; // Not in output dir, this is OK. | 497 return; // Not in output dir, this is OK. |
| 498 | 498 |
| 499 // Tell the scheduler about unknown files. This will be noted for later so | 499 // Tell the scheduler about unknown files. This will be noted for later so |
| 500 // the list of files written by the GN build itself (often response files) | 500 // the list of files written by the GN build itself (often response files) |
| 501 // can be filtered out of this list. | 501 // can be filtered out of this list. |
| 502 OutputFile out_file(settings()->build_settings(), source); | 502 OutputFile out_file(settings()->build_settings(), source); |
| 503 std::set<const Target*> seen_targets; | 503 std::set<const Target*> seen_targets; |
| 504 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) | 504 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, &seen_targets)) |
| 505 g_scheduler->AddUnknownGeneratedInput(this, source); | 505 g_scheduler->AddUnknownGeneratedInput(this, source); |
| 506 } | 506 } |
| OLD | NEW |