| 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/build_settings.h" | 5 #include "tools/gn/build_settings.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" |
| 7 #include "tools/gn/filesystem_utils.h" | 8 #include "tools/gn/filesystem_utils.h" |
| 8 | 9 |
| 9 BuildSettings::BuildSettings() | 10 BuildSettings::BuildSettings() |
| 10 : using_external_generator_(false), | 11 : using_external_generator_(false), |
| 11 item_tree_(), | 12 item_tree_(), |
| 12 target_manager_(this), | 13 target_manager_(this), |
| 13 toolchain_manager_(this) { | 14 toolchain_manager_(this) { |
| 14 } | 15 } |
| 15 | 16 |
| 16 BuildSettings::BuildSettings(const BuildSettings& other) | 17 BuildSettings::BuildSettings(const BuildSettings& other) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 38 root_path_utf8_ = FilePathToUTF8(root_path_); | 39 root_path_utf8_ = FilePathToUTF8(root_path_); |
| 39 } | 40 } |
| 40 | 41 |
| 41 void BuildSettings::SetSecondarySourcePath(const SourceDir& d) { | 42 void BuildSettings::SetSecondarySourcePath(const SourceDir& d) { |
| 42 secondary_source_path_ = GetFullPath(d); | 43 secondary_source_path_ = GetFullPath(d); |
| 43 } | 44 } |
| 44 | 45 |
| 45 void BuildSettings::SetBuildDir(const SourceDir& d) { | 46 void BuildSettings::SetBuildDir(const SourceDir& d) { |
| 46 build_dir_ = d; | 47 build_dir_ = d; |
| 47 build_to_source_dir_string_ = InvertDir(d); | 48 build_to_source_dir_string_ = InvertDir(d); |
| 49 |
| 50 DCHECK(!root_path_.empty()); |
| 51 file_util::CreateDirectory(build_dir_.Resolve(root_path_)); |
| 48 } | 52 } |
| 49 | 53 |
| 50 base::FilePath BuildSettings::GetFullPath(const SourceFile& file) const { | 54 base::FilePath BuildSettings::GetFullPath(const SourceFile& file) const { |
| 51 return file.Resolve(root_path_); | 55 return file.Resolve(root_path_); |
| 52 } | 56 } |
| 53 | 57 |
| 54 base::FilePath BuildSettings::GetFullPath(const SourceDir& dir) const { | 58 base::FilePath BuildSettings::GetFullPath(const SourceDir& dir) const { |
| 55 return dir.Resolve(root_path_); | 59 return dir.Resolve(root_path_); |
| 56 } | 60 } |
| 57 | 61 |
| 58 base::FilePath BuildSettings::GetFullPathSecondary( | 62 base::FilePath BuildSettings::GetFullPathSecondary( |
| 59 const SourceFile& file) const { | 63 const SourceFile& file) const { |
| 60 return file.Resolve(secondary_source_path_); | 64 return file.Resolve(secondary_source_path_); |
| 61 } | 65 } |
| 62 | 66 |
| 63 base::FilePath BuildSettings::GetFullPathSecondary( | 67 base::FilePath BuildSettings::GetFullPathSecondary( |
| 64 const SourceDir& dir) const { | 68 const SourceDir& dir) const { |
| 65 return dir.Resolve(secondary_source_path_); | 69 return dir.Resolve(secondary_source_path_); |
| 66 } | 70 } |
| 67 | 71 |
| OLD | NEW |