OLD | NEW |
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/ninja_binary_target_writer.h" | 5 #include "tools/gn/ninja_binary_target_writer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 void NinjaBinaryTargetWriter::Run() { | 265 void NinjaBinaryTargetWriter::Run() { |
266 // Figure out what source types are needed. | 266 // Figure out what source types are needed. |
267 SourceFileTypeSet used_types; | 267 SourceFileTypeSet used_types; |
268 for (const auto& source : target_->sources()) | 268 for (const auto& source : target_->sources()) |
269 used_types.Set(GetSourceFileType(source)); | 269 used_types.Set(GetSourceFileType(source)); |
270 | 270 |
271 WriteCompilerVars(used_types); | 271 WriteCompilerVars(used_types); |
272 | 272 |
273 // The input dependencies will be an order-only dependency. This will cause | 273 // The input dependencies will be an order-only dependency. This will cause |
274 // Ninja to make sure the inputs are up-to-date before compiling this source, | 274 // Ninja to make sure the inputs are up to date before compiling this source, |
275 // but changes in the inputs deps won't cause the file to be recompiled. | 275 // but changes in the inputs deps won't cause the file to be recompiled. |
276 // | 276 // |
277 // This is important to prevent changes in unrelated actions that are | 277 // This is important to prevent changes in unrelated actions that are |
278 // upstream of this target from causing everything to be recompiled. | 278 // upstream of this target from causing everything to be recompiled. |
279 // | 279 // |
280 // Why can we get away with this rather than using implicit deps ("|", which | 280 // Why can we get away with this rather than using implicit deps ("|", which |
281 // will force rebuilds when the inputs change)? For source code, the | 281 // will force rebuilds when the inputs change)? For source code, the |
282 // computed dependencies of all headers will be computed by the compiler, | 282 // computed dependencies of all headers will be computed by the compiler, |
283 // which will cause source rebuilds if any "real" upstream dependencies | 283 // which will cause source rebuilds if any "real" upstream dependencies |
284 // change. | 284 // change. |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 "\n" | 1015 "\n" |
1016 "In the latter case, either rename one of the files or move one of\n" | 1016 "In the latter case, either rename one of the files or move one of\n" |
1017 "the sources to a separate source_set to avoid them both being in\n" | 1017 "the sources to a separate source_set to avoid them both being in\n" |
1018 "the same target."); | 1018 "the same target."); |
1019 g_scheduler->FailWithError(err); | 1019 g_scheduler->FailWithError(err); |
1020 return false; | 1020 return false; |
1021 } | 1021 } |
1022 } | 1022 } |
1023 return true; | 1023 return true; |
1024 } | 1024 } |
OLD | NEW |