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

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

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 unified diff | Download patch
« no previous file with comments | « tools/gn/substitution_writer_unittest.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 (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 #ifndef TOOLS_GN_TARGET_H_ 5 #ifndef TOOLS_GN_TARGET_H_
6 #define TOOLS_GN_TARGET_H_ 6 #define TOOLS_GN_TARGET_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // This is also true of action and copy steps even though they don't link 82 // This is also true of action and copy steps even though they don't link
83 // dependencies, because they also don't propogate libraries up. 83 // dependencies, because they also don't propogate libraries up.
84 bool IsFinal() const; 84 bool IsFinal() const;
85 85
86 // Will be the empty string to use the target label as the output name. 86 // Will be the empty string to use the target label as the output name.
87 // See GetComputedOutputName(). 87 // See GetComputedOutputName().
88 const std::string& output_name() const { return output_name_; } 88 const std::string& output_name() const { return output_name_; }
89 void set_output_name(const std::string& name) { output_name_ = name; } 89 void set_output_name(const std::string& name) { output_name_ = name; }
90 90
91 // Returns the output name for this target, which is the output_name if 91 // Returns the output name for this target, which is the output_name if
92 // specified, or the target label if not. If the flag is set, it will also 92 // specified, or the target label if not.
93 // include any output prefix specified on the tool (often "lib" on Linux).
94 // 93 //
95 // Because this depends on the tool for this target, the toolchain must 94 // Because this depends on the tool for this target, the toolchain must
96 // have been set before calling. 95 // have been set before calling.
97 std::string GetComputedOutputName(bool include_prefix) const; 96 std::string GetComputedOutputName() const;
98 97
98 bool output_prefix_override() const { return output_prefix_override_; }
99 void set_output_prefix_override(bool prefix_override) {
100 output_prefix_override_ = prefix_override;
101 }
102
103 // The output extension is really a tri-state: unset (output_extension_set
104 // is false and the string is empty, meaning the default extension should be
105 // used), the output extension is set but empty (output should have no
106 // extension) and the output extension is set but nonempty (use the given
107 // extension).
99 const std::string& output_extension() const { return output_extension_; } 108 const std::string& output_extension() const { return output_extension_; }
100 void set_output_extension(const std::string& extension) { 109 void set_output_extension(const std::string& extension) {
101 output_extension_ = extension; 110 output_extension_ = extension;
111 output_extension_set_ = true;
112 }
113 bool output_extension_set() const {
114 return output_extension_set_;
102 } 115 }
103 116
104 const FileList& sources() const { return sources_; } 117 const FileList& sources() const { return sources_; }
105 FileList& sources() { return sources_; } 118 FileList& sources() { return sources_; }
106 119
107 // Set to true when all sources are public. This is the default. In this case 120 // Set to true when all sources are public. This is the default. In this case
108 // the public headers list should be empty. 121 // the public headers list should be empty.
109 bool all_headers_public() const { return all_headers_public_; } 122 bool all_headers_public() const { return all_headers_public_; }
110 void set_all_headers_public(bool p) { all_headers_public_ = p; } 123 void set_all_headers_public(bool p) { all_headers_public_ = p; }
111 124
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // Validates the given thing when a target is resolved. 324 // Validates the given thing when a target is resolved.
312 bool CheckVisibility(Err* err) const; 325 bool CheckVisibility(Err* err) const;
313 bool CheckTestonly(Err* err) const; 326 bool CheckTestonly(Err* err) const;
314 bool CheckNoNestedStaticLibs(Err* err) const; 327 bool CheckNoNestedStaticLibs(Err* err) const;
315 bool CheckAssertNoDeps(Err* err) const; 328 bool CheckAssertNoDeps(Err* err) const;
316 void CheckSourcesGenerated() const; 329 void CheckSourcesGenerated() const;
317 void CheckSourceGenerated(const SourceFile& source) const; 330 void CheckSourceGenerated(const SourceFile& source) const;
318 331
319 OutputType output_type_; 332 OutputType output_type_;
320 std::string output_name_; 333 std::string output_name_;
334 bool output_prefix_override_;
321 std::string output_extension_; 335 std::string output_extension_;
336 bool output_extension_set_;
322 337
323 FileList sources_; 338 FileList sources_;
324 bool all_headers_public_; 339 bool all_headers_public_;
325 FileList public_headers_; 340 FileList public_headers_;
326 bool check_includes_; 341 bool check_includes_;
327 bool complete_static_lib_; 342 bool complete_static_lib_;
328 bool testonly_; 343 bool testonly_;
329 FileList inputs_; 344 FileList inputs_;
330 std::vector<std::string> data_; 345 std::vector<std::string> data_;
331 BundleData bundle_data_; 346 BundleData bundle_data_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // Output files. Empty until the target is resolved. 386 // Output files. Empty until the target is resolved.
372 std::vector<OutputFile> computed_outputs_; 387 std::vector<OutputFile> computed_outputs_;
373 OutputFile link_output_file_; 388 OutputFile link_output_file_;
374 OutputFile dependency_output_file_; 389 OutputFile dependency_output_file_;
375 OutputFile runtime_link_output_file_; 390 OutputFile runtime_link_output_file_;
376 391
377 DISALLOW_COPY_AND_ASSIGN(Target); 392 DISALLOW_COPY_AND_ASSIGN(Target);
378 }; 393 };
379 394
380 #endif // TOOLS_GN_TARGET_H_ 395 #endif // TOOLS_GN_TARGET_H_
OLDNEW
« no previous file with comments | « tools/gn/substitution_writer_unittest.cc ('k') | tools/gn/target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698