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

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

Issue 1842563006: DO NOT SUBMIT. Experimental Mac GN Framework support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Binary bundle data Created 4 years, 8 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
« no previous file with comments | « tools/gn/substitution_type.cc ('k') | tools/gn/variables.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 9 #include <algorithm>
10 10
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 344 }
345 345
346 std::string Target::GetComputedOutputName(bool include_prefix) const { 346 std::string Target::GetComputedOutputName(bool include_prefix) const {
347 DCHECK(toolchain_) 347 DCHECK(toolchain_)
348 << "Toolchain must be specified before getting the computed output name."; 348 << "Toolchain must be specified before getting the computed output name.";
349 349
350 const std::string& name = output_name_.empty() ? label().name() 350 const std::string& name = output_name_.empty() ? label().name()
351 : output_name_; 351 : output_name_;
352 352
353 std::string result; 353 std::string result;
354 FindDir(&name).AppendToString(&result);
355 base::StringPiece basename = FindFilename(&name);
354 if (include_prefix) { 356 if (include_prefix) {
355 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); 357 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this);
356 if (tool) { 358 if (tool) {
357 // Only add the prefix if the name doesn't already have it. 359 // Only add the prefix if the name doesn't already have it.
358 if (!base::StartsWith(name, tool->output_prefix(), 360 if (!base::StartsWith(basename, tool->output_prefix(),
359 base::CompareCase::SENSITIVE)) 361 base::CompareCase::SENSITIVE)) {
360 result = tool->output_prefix(); 362 result.append(tool->output_prefix());
363 }
361 } 364 }
362 } 365 }
363 result.append(name); 366 basename.AppendToString(&result);
364 return result; 367 return result;
365 } 368 }
366 369
367 bool Target::SetToolchain(const Toolchain* toolchain, Err* err) { 370 bool Target::SetToolchain(const Toolchain* toolchain, Err* err) {
368 DCHECK(!toolchain_); 371 DCHECK(!toolchain_);
369 DCHECK_NE(UNKNOWN, output_type_); 372 DCHECK_NE(UNKNOWN, output_type_);
370 toolchain_ = toolchain; 373 toolchain_ = toolchain;
371 374
372 const Tool* tool = toolchain->GetToolForTargetFinalOutput(this); 375 const Tool* tool = toolchain->GetToolForTargetFinalOutput(this);
373 if (tool) 376 if (tool)
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, false, 758 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, false,
756 &seen_targets)) { 759 &seen_targets)) {
757 // Check object files (much slower and very rare) only if the "normal" 760 // Check object files (much slower and very rare) only if the "normal"
758 // output check failed. 761 // output check failed.
759 seen_targets.clear(); 762 seen_targets.clear();
760 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, true, 763 if (!EnsureFileIsGeneratedByDependency(this, out_file, true, true,
761 &seen_targets)) 764 &seen_targets))
762 g_scheduler->AddUnknownGeneratedInput(this, source); 765 g_scheduler->AddUnknownGeneratedInput(this, source);
763 } 766 }
764 } 767 }
OLDNEW
« no previous file with comments | « tools/gn/substitution_type.cc ('k') | tools/gn/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698