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

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

Issue 2198433004: Make get_label_info take into account the toolchain for target_gen_dir (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused static function Created 4 years, 4 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/scope_per_file_provider.cc ('k') | tools/gn/target.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/substitution_writer.h" 5 #include "tools/gn/substitution_writer.h"
6 6
7 #include "tools/gn/build_settings.h" 7 #include "tools/gn/build_settings.h"
8 #include "tools/gn/escape.h" 8 #include "tools/gn/escape.h"
9 #include "tools/gn/filesystem_utils.h" 9 #include "tools/gn/filesystem_utils.h"
10 #include "tools/gn/output_file.h" 10 #include "tools/gn/output_file.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 break; 357 break;
358 358
359 case SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR: 359 case SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR:
360 if (source.is_system_absolute()) 360 if (source.is_system_absolute())
361 return DirectoryWithNoLastSlash(source.GetDir()); 361 return DirectoryWithNoLastSlash(source.GetDir());
362 return RebasePath( 362 return RebasePath(
363 DirectoryWithNoLastSlash(source.GetDir()), SourceDir("//"), 363 DirectoryWithNoLastSlash(source.GetDir()), SourceDir("//"),
364 settings->build_settings()->root_path_utf8()); 364 settings->build_settings()->root_path_utf8());
365 365
366 case SUBSTITUTION_SOURCE_GEN_DIR: 366 case SUBSTITUTION_SOURCE_GEN_DIR:
367 to_rebase = DirectoryWithNoLastSlash( 367 to_rebase = DirectoryWithNoLastSlash(GetSubBuildDirAsSourceDir(
368 GetGenDirForSourceDir(settings, source.GetDir())); 368 BuildDirContext(settings), source.GetDir(), BuildDirType::GEN));
369 break; 369 break;
370 370
371 case SUBSTITUTION_SOURCE_OUT_DIR: 371 case SUBSTITUTION_SOURCE_OUT_DIR:
372 to_rebase = DirectoryWithNoLastSlash( 372 to_rebase = DirectoryWithNoLastSlash(GetSubBuildDirAsSourceDir(
373 GetOutputDirForSourceDir(settings, source.GetDir())); 373 BuildDirContext(settings), source.GetDir(), BuildDirType::OBJ));
374 break; 374 break;
375 375
376 default: 376 default:
377 NOTREACHED() 377 NOTREACHED()
378 << "Unsupported substitution for this function: " 378 << "Unsupported substitution for this function: "
379 << kSubstitutionNames[type]; 379 << kSubstitutionNames[type];
380 return std::string(); 380 return std::string();
381 } 381 }
382 382
383 // If we get here, the result is a path that should be made relative or 383 // If we get here, the result is a path that should be made relative or
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 case SUBSTITUTION_LABEL: 426 case SUBSTITUTION_LABEL:
427 // Only include the toolchain for non-default toolchains. 427 // Only include the toolchain for non-default toolchains.
428 *result = target->label().GetUserVisibleName( 428 *result = target->label().GetUserVisibleName(
429 !target->settings()->is_default()); 429 !target->settings()->is_default());
430 break; 430 break;
431 case SUBSTITUTION_LABEL_NAME: 431 case SUBSTITUTION_LABEL_NAME:
432 *result = target->label().name(); 432 *result = target->label().name();
433 break; 433 break;
434 case SUBSTITUTION_ROOT_GEN_DIR: 434 case SUBSTITUTION_ROOT_GEN_DIR:
435 SetDirOrDotWithNoSlash( 435 SetDirOrDotWithNoSlash(
436 GetToolchainGenDirAsOutputFile(target->settings()).value(), 436 GetBuildDirAsOutputFile(BuildDirContext(target),
437 BuildDirType::GEN).value(),
437 result); 438 result);
438 break; 439 break;
439 case SUBSTITUTION_ROOT_OUT_DIR: 440 case SUBSTITUTION_ROOT_OUT_DIR:
440 SetDirOrDotWithNoSlash( 441 SetDirOrDotWithNoSlash(
441 target->settings()->toolchain_output_subdir().value(), 442 target->settings()->toolchain_output_subdir().value(),
442 result); 443 result);
443 break; 444 break;
444 case SUBSTITUTION_TARGET_GEN_DIR: 445 case SUBSTITUTION_TARGET_GEN_DIR:
445 SetDirOrDotWithNoSlash( 446 SetDirOrDotWithNoSlash(
446 GetTargetGenDirAsOutputFile(target).value(), 447 GetBuildDirForTargetAsOutputFile(target, BuildDirType::GEN).value(),
447 result); 448 result);
448 break; 449 break;
449 case SUBSTITUTION_TARGET_OUT_DIR: 450 case SUBSTITUTION_TARGET_OUT_DIR:
450 SetDirOrDotWithNoSlash( 451 SetDirOrDotWithNoSlash(
451 GetTargetOutputDirAsOutputFile(target).value(), 452 GetBuildDirForTargetAsOutputFile(target, BuildDirType::OBJ).value(),
452 result); 453 result);
453 break; 454 break;
454 case SUBSTITUTION_TARGET_OUTPUT_NAME: 455 case SUBSTITUTION_TARGET_OUTPUT_NAME:
455 *result = target->GetComputedOutputName(); 456 *result = target->GetComputedOutputName();
456 break; 457 break;
457 default: 458 default:
458 return false; 459 return false;
459 } 460 }
460 return true; 461 return true;
461 } 462 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 return tool->default_output_extension(); 576 return tool->default_output_extension();
576 if (target->output_extension().empty()) 577 if (target->output_extension().empty())
577 return std::string(); // Explicitly set to no extension. 578 return std::string(); // Explicitly set to no extension.
578 return std::string(".") + target->output_extension(); 579 return std::string(".") + target->output_extension();
579 580
580 default: 581 default:
581 NOTREACHED(); 582 NOTREACHED();
582 return std::string(); 583 return std::string();
583 } 584 }
584 } 585 }
OLDNEW
« no previous file with comments | « tools/gn/scope_per_file_provider.cc ('k') | tools/gn/target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698