| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/visual_studio_writer.h" | 5 #include "tools/gn/visual_studio_writer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 return false; | 229 return false; |
| 230 | 230 |
| 231 processed_targets.insert(target_path); | 231 processed_targets.insert(target_path); |
| 232 } | 232 } |
| 233 | 233 |
| 234 if (writer.projects_.empty()) { | 234 if (writer.projects_.empty()) { |
| 235 *err = Err(Location(), "No Visual Studio projects generated."); | 235 *err = Err(Location(), "No Visual Studio projects generated."); |
| 236 return false; | 236 return false; |
| 237 } | 237 } |
| 238 | 238 |
| 239 // Sort projects so they appear always in the same order in solution file. |
| 240 // Otherwise solution file is rewritten and reloaded by Visual Studio. |
| 241 std::sort(writer.projects_.begin(), writer.projects_.end(), |
| 242 [](const SolutionEntry* a, const SolutionEntry* b) { |
| 243 return a->path < b->path; |
| 244 }); |
| 245 |
| 239 writer.ResolveSolutionFolders(); | 246 writer.ResolveSolutionFolders(); |
| 240 return writer.WriteSolutionFile(err); | 247 return writer.WriteSolutionFile(err); |
| 241 } | 248 } |
| 242 | 249 |
| 243 bool VisualStudioWriter::WriteProjectFiles(const Target* target, Err* err) { | 250 bool VisualStudioWriter::WriteProjectFiles(const Target* target, Err* err) { |
| 244 SourceFile target_file = GetTargetOutputDir(target).ResolveRelativeFile( | 251 SourceFile target_file = GetTargetOutputDir(target).ResolveRelativeFile( |
| 245 Value(nullptr, target->label().name() + ".vcxproj"), err); | 252 Value(nullptr, target->label().name() + ".vcxproj"), err); |
| 246 if (target_file.is_null()) | 253 if (target_file.is_null()) |
| 247 return false; | 254 return false; |
| 248 | 255 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 base::CompareCase::SENSITIVE)) { | 752 base::CompareCase::SENSITIVE)) { |
| 746 folder->parent_folder = parents.back(); | 753 folder->parent_folder = parents.back(); |
| 747 break; | 754 break; |
| 748 } else { | 755 } else { |
| 749 parents.pop_back(); | 756 parents.pop_back(); |
| 750 } | 757 } |
| 751 } | 758 } |
| 752 parents.push_back(folder); | 759 parents.push_back(folder); |
| 753 } | 760 } |
| 754 } | 761 } |
| OLD | NEW |