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

Unified Diff: tools/gn/target.cc

Issue 1868023002: Add GN output prefix override and allow empty output extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/target.h ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/target.cc
diff --git a/tools/gn/target.cc b/tools/gn/target.cc
index 005dd973b2961cb4f445a1a61bb302a85df03b71..18c353eac05d3b58732db4b1a2883040be51664a 100644
--- a/tools/gn/target.cc
+++ b/tools/gn/target.cc
@@ -212,6 +212,8 @@ bool RecursiveCheckAssertNoDeps(const Target* target,
Target::Target(const Settings* settings, const Label& label)
: Item(settings, label),
output_type_(UNKNOWN),
+ output_prefix_override_(false),
+ output_extension_set_(false),
all_headers_public_(true),
check_includes_(true),
complete_static_lib_(false),
@@ -358,7 +360,7 @@ DepsIteratorRange Target::GetDeps(DepsIterationType type) const {
&public_deps_, &private_deps_, &data_deps_));
}
-std::string Target::GetComputedOutputName(bool include_prefix) const {
+std::string Target::GetComputedOutputName() const {
DCHECK(toolchain_)
<< "Toolchain must be specified before getting the computed output name.";
@@ -366,14 +368,14 @@ std::string Target::GetComputedOutputName(bool include_prefix) const {
: output_name_;
std::string result;
- if (include_prefix) {
- const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this);
- if (tool) {
- // Only add the prefix if the name doesn't already have it.
- if (!base::StartsWith(name, tool->output_prefix(),
- base::CompareCase::SENSITIVE))
- result = tool->output_prefix();
- }
+ const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this);
+ if (tool) {
+ // Only add the prefix if the name doesn't already have it and it's not
+ // being overridden.
+ if (!output_prefix_override_ &&
+ !base::StartsWith(name, tool->output_prefix(),
+ base::CompareCase::SENSITIVE))
+ result = tool->output_prefix();
}
result.append(name);
return result;
@@ -536,7 +538,7 @@ void Target::FillOutputFiles() {
// entry in the outputs. These stamps are named
// "<target_out_dir>/<targetname>.stamp".
dependency_output_file_ = GetTargetOutputDirAsOutputFile(this);
- dependency_output_file_.value().append(GetComputedOutputName(true));
+ dependency_output_file_.value().append(GetComputedOutputName());
dependency_output_file_.value().append(".stamp");
break;
}
« no previous file with comments | « tools/gn/target.h ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698