| 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 "base/file_util.h" | 
| 8 #include "tools/gn/filesystem_utils.h" | 8 #include "tools/gn/filesystem_utils.h" | 
| 9 | 9 | 
| 10 BuildSettings::BuildSettings() { | 10 BuildSettings::BuildSettings() { | 
| 11 } | 11 } | 
| 12 | 12 | 
| 13 BuildSettings::BuildSettings(const BuildSettings& other) | 13 BuildSettings::BuildSettings(const BuildSettings& other) | 
| 14     : root_path_(other.root_path_), | 14     : root_path_(other.root_path_), | 
| 15       root_path_utf8_(other.root_path_utf8_), | 15       root_path_utf8_(other.root_path_utf8_), | 
| 16       secondary_source_path_(other.secondary_source_path_), | 16       secondary_source_path_(other.secondary_source_path_), | 
| 17       python_path_(other.python_path_), | 17       python_path_(other.python_path_), | 
| 18       build_config_file_(other.build_config_file_), | 18       build_config_file_(other.build_config_file_), | 
| 19       build_dir_(other.build_dir_), | 19       build_dir_(other.build_dir_), | 
| 20       build_to_source_dir_string_(other.build_to_source_dir_string_), | 20       build_to_source_dir_string_(other.build_to_source_dir_string_), | 
| 21       build_args_(other.build_args_) { | 21       build_args_(other.build_args_) { | 
| 22 } | 22 } | 
| 23 | 23 | 
| 24 BuildSettings::~BuildSettings() { | 24 BuildSettings::~BuildSettings() { | 
| 25 } | 25 } | 
| 26 | 26 | 
| 27 void BuildSettings::SetRootPath(const base::FilePath& r) { | 27 void BuildSettings::SetRootPath(const base::FilePath& r) { | 
| 28   DCHECK(r.value()[r.value().size() - 1] != base::FilePath::kSeparators[0]); | 28   DCHECK(r.value()[r.value().size() - 1] != base::FilePath::kSeparators[0]); | 
| 29   root_path_ = r; | 29   root_path_ = r.NormalizePathSeparatorsTo('/'); | 
| 30   root_path_utf8_ = FilePathToUTF8(root_path_); | 30   root_path_utf8_ = FilePathToUTF8(root_path_); | 
| 31 } | 31 } | 
| 32 | 32 | 
| 33 void BuildSettings::SetSecondarySourcePath(const SourceDir& d) { | 33 void BuildSettings::SetSecondarySourcePath(const SourceDir& d) { | 
| 34   secondary_source_path_ = GetFullPath(d); | 34   secondary_source_path_ = GetFullPath(d).NormalizePathSeparatorsTo('/'); | 
| 35 } | 35 } | 
| 36 | 36 | 
| 37 void BuildSettings::SetBuildDir(const SourceDir& d) { | 37 void BuildSettings::SetBuildDir(const SourceDir& d) { | 
| 38   build_dir_ = d; | 38   build_dir_ = d; | 
| 39   build_to_source_dir_string_ = InvertDir(d); | 39   build_to_source_dir_string_ = InvertDir(d); | 
| 40 } | 40 } | 
| 41 | 41 | 
| 42 base::FilePath BuildSettings::GetFullPath(const SourceFile& file) const { | 42 base::FilePath BuildSettings::GetFullPath(const SourceFile& file) const { | 
| 43   return file.Resolve(root_path_); | 43   return file.Resolve(root_path_).NormalizePathSeparatorsTo('/'); | 
| 44 } | 44 } | 
| 45 | 45 | 
| 46 base::FilePath BuildSettings::GetFullPath(const SourceDir& dir) const { | 46 base::FilePath BuildSettings::GetFullPath(const SourceDir& dir) const { | 
| 47   return dir.Resolve(root_path_); | 47   return dir.Resolve(root_path_).NormalizePathSeparatorsTo('/'); | 
| 48 } | 48 } | 
| 49 | 49 | 
| 50 base::FilePath BuildSettings::GetFullPathSecondary( | 50 base::FilePath BuildSettings::GetFullPathSecondary( | 
| 51     const SourceFile& file) const { | 51     const SourceFile& file) const { | 
| 52   return file.Resolve(secondary_source_path_); | 52   return file.Resolve(secondary_source_path_).NormalizePathSeparatorsTo('/'); | 
| 53 } | 53 } | 
| 54 | 54 | 
| 55 base::FilePath BuildSettings::GetFullPathSecondary( | 55 base::FilePath BuildSettings::GetFullPathSecondary( | 
| 56     const SourceDir& dir) const { | 56     const SourceDir& dir) const { | 
| 57   return dir.Resolve(secondary_source_path_); | 57   return dir.Resolve(secondary_source_path_).NormalizePathSeparatorsTo('/'); | 
| 58 } | 58 } | 
| 59 | 59 | 
| 60 void BuildSettings::ItemDefined(scoped_ptr<Item> item) const { | 60 void BuildSettings::ItemDefined(scoped_ptr<Item> item) const { | 
| 61   DCHECK(item); | 61   DCHECK(item); | 
| 62   if (!item_defined_callback_.is_null()) | 62   if (!item_defined_callback_.is_null()) | 
| 63     item_defined_callback_.Run(item.Pass()); | 63     item_defined_callback_.Run(item.Pass()); | 
| 64 } | 64 } | 
| OLD | NEW | 
|---|