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

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

Issue 1494883002: GN: Makes GN output deterministic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moves sort into ninja_toolchain_writer.cc for consistency Created 5 years 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
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>
11 11
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "tools/gn/action_values.h" 15 #include "tools/gn/action_values.h"
16 #include "tools/gn/config_values.h" 16 #include "tools/gn/config_values.h"
17 #include "tools/gn/dereference_comparator.h"
17 #include "tools/gn/inherited_libraries.h" 18 #include "tools/gn/inherited_libraries.h"
18 #include "tools/gn/item.h" 19 #include "tools/gn/item.h"
19 #include "tools/gn/label_ptr.h" 20 #include "tools/gn/label_ptr.h"
20 #include "tools/gn/ordered_set.h" 21 #include "tools/gn/ordered_set.h"
21 #include "tools/gn/output_file.h" 22 #include "tools/gn/output_file.h"
22 #include "tools/gn/source_file.h" 23 #include "tools/gn/source_file.h"
23 #include "tools/gn/unique_vector.h" 24 #include "tools/gn/unique_vector.h"
24 25
25 class DepsIteratorRange; 26 class DepsIteratorRange;
26 class InputFile; 27 class InputFile;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // This config represents the configuration set directly on this target. 193 // This config represents the configuration set directly on this target.
193 ConfigValues& config_values() { return config_values_; } 194 ConfigValues& config_values() { return config_values_; }
194 const ConfigValues& config_values() const { return config_values_; } 195 const ConfigValues& config_values() const { return config_values_; }
195 196
196 ActionValues& action_values() { return action_values_; } 197 ActionValues& action_values() { return action_values_; }
197 const ActionValues& action_values() const { return action_values_; } 198 const ActionValues& action_values() const { return action_values_; }
198 199
199 const OrderedSet<SourceDir>& all_lib_dirs() const { return all_lib_dirs_; } 200 const OrderedSet<SourceDir>& all_lib_dirs() const { return all_lib_dirs_; }
200 const OrderedSet<std::string>& all_libs() const { return all_libs_; } 201 const OrderedSet<std::string>& all_libs() const { return all_libs_; }
201 202
202 const std::set<const Target*>& recursive_hard_deps() const { 203 const PointerSet<const Target>& recursive_hard_deps() const {
203 return recursive_hard_deps_; 204 return recursive_hard_deps_;
204 } 205 }
205 206
206 // The toolchain is only known once this target is resolved (all if its 207 // The toolchain is only known once this target is resolved (all if its
207 // dependencies are known). They will be null until then. Generally, this can 208 // dependencies are known). They will be null until then. Generally, this can
208 // only be used during target writing. 209 // only be used during target writing.
209 const Toolchain* toolchain() const { return toolchain_; } 210 const Toolchain* toolchain() const { return toolchain_; }
210 211
211 // Sets the toolchain. The toolchain must include a tool for this target 212 // Sets the toolchain. The toolchain must include a tool for this target
212 // or the error will be set and the function will return false. Unusually, 213 // or the error will be set and the function will return false. Unusually,
(...skipping 24 matching lines...) Expand all
237 // These are only known once the target is resolved and will be empty before 238 // These are only known once the target is resolved and will be empty before
238 // that. This is a cache of the files to prevent every target that depends on 239 // that. This is a cache of the files to prevent every target that depends on
239 // a given library from recomputing the same pattern. 240 // a given library from recomputing the same pattern.
240 const OutputFile& link_output_file() const { 241 const OutputFile& link_output_file() const {
241 return link_output_file_; 242 return link_output_file_;
242 } 243 }
243 const OutputFile& dependency_output_file() const { 244 const OutputFile& dependency_output_file() const {
244 return dependency_output_file_; 245 return dependency_output_file_;
245 } 246 }
246 247
248 bool operator<(const Target& other) const;
249
247 private: 250 private:
248 FRIEND_TEST_ALL_PREFIXES(Target, ResolvePrecompiledHeaders); 251 FRIEND_TEST_ALL_PREFIXES(Target, ResolvePrecompiledHeaders);
249 252
250 // Pulls necessary information from dependencies to this one when all 253 // Pulls necessary information from dependencies to this one when all
251 // dependencies have been resolved. 254 // dependencies have been resolved.
252 void PullDependentTarget(const Target* dep, bool is_public); 255 void PullDependentTarget(const Target* dep, bool is_public);
253 void PullDependentTargets(); 256 void PullDependentTargets();
254 257
255 // These each pull specific things from dependencies to this one when all 258 // These each pull specific things from dependencies to this one when all
256 // deps have been resolved. 259 // deps have been resolved.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // that need to be linked. 302 // that need to be linked.
300 InheritedLibraries inherited_libraries_; 303 InheritedLibraries inherited_libraries_;
301 304
302 // These libs and dirs are inherited from statically linked deps and all 305 // These libs and dirs are inherited from statically linked deps and all
303 // configs applying to this target. 306 // configs applying to this target.
304 OrderedSet<SourceDir> all_lib_dirs_; 307 OrderedSet<SourceDir> all_lib_dirs_;
305 OrderedSet<std::string> all_libs_; 308 OrderedSet<std::string> all_libs_;
306 309
307 // All hard deps from this target and all dependencies. Filled in when this 310 // All hard deps from this target and all dependencies. Filled in when this
308 // target is marked resolved. This will not include the current target. 311 // target is marked resolved. This will not include the current target.
309 std::set<const Target*> recursive_hard_deps_; 312 PointerSet<const Target> recursive_hard_deps_;
310 313
311 // Used for all binary targets. The precompiled header values in this struct 314 // Used for all binary targets. The precompiled header values in this struct
312 // will be resolved to the ones to use for this target, if precompiled 315 // will be resolved to the ones to use for this target, if precompiled
313 // headers are used. 316 // headers are used.
314 ConfigValues config_values_; 317 ConfigValues config_values_;
315 318
316 // Used for action[_foreach] targets. 319 // Used for action[_foreach] targets.
317 ActionValues action_values_; 320 ActionValues action_values_;
318 321
319 // Toolchain used by this target. Null until target is resolved. 322 // Toolchain used by this target. Null until target is resolved.
320 const Toolchain* toolchain_; 323 const Toolchain* toolchain_;
321 324
322 // Output files. Empty until the target is resolved. 325 // Output files. Empty until the target is resolved.
323 std::vector<OutputFile> computed_outputs_; 326 std::vector<OutputFile> computed_outputs_;
324 OutputFile link_output_file_; 327 OutputFile link_output_file_;
325 OutputFile dependency_output_file_; 328 OutputFile dependency_output_file_;
326 329
327 DISALLOW_COPY_AND_ASSIGN(Target); 330 DISALLOW_COPY_AND_ASSIGN(Target);
328 }; 331 };
329 332
330 #endif // TOOLS_GN_TARGET_H_ 333 #endif // TOOLS_GN_TARGET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698