| 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/setup.h" | 5 #include "tools/gn/setup.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 } | 287 } |
| 288 | 288 |
| 289 if (scheduler_.verbose_logging()) | 289 if (scheduler_.verbose_logging()) |
| 290 scheduler_.Log("Using source root", FilePathToUTF8(root_path)); | 290 scheduler_.Log("Using source root", FilePathToUTF8(root_path)); |
| 291 build_settings_.SetRootPath(root_path); | 291 build_settings_.SetRootPath(root_path); |
| 292 | 292 |
| 293 return true; | 293 return true; |
| 294 } | 294 } |
| 295 | 295 |
| 296 bool Setup::FillBuildDir(const std::string& build_dir) { | 296 bool Setup::FillBuildDir(const std::string& build_dir) { |
| 297 std::string normalized_build_dir = PathToSystem(build_dir); | |
| 298 | |
| 299 SourceDir resolved = | 297 SourceDir resolved = |
| 300 SourceDirForCurrentDirectory(build_settings_.root_path()). | 298 SourceDirForCurrentDirectory(build_settings_.root_path()). |
| 301 ResolveRelativeDir(normalized_build_dir); | 299 ResolveRelativeDir(build_dir); |
| 302 if (resolved.is_null()) { | 300 if (resolved.is_null()) { |
| 303 Err(Location(), "Couldn't resolve build directory.", | 301 Err(Location(), "Couldn't resolve build directory.", |
| 304 "The build directory supplied (\"" + build_dir + "\") was not valid."). | 302 "The build directory supplied (\"" + build_dir + "\") was not valid."). |
| 305 PrintToStdout(); | 303 PrintToStdout(); |
| 306 return false; | 304 return false; |
| 307 } | 305 } |
| 308 | 306 |
| 309 if (scheduler_.verbose_logging()) | 307 if (scheduler_.verbose_logging()) |
| 310 scheduler_.Log("Using build dir", resolved.value()); | 308 scheduler_.Log("Using build dir", resolved.value()); |
| 311 build_settings_.SetBuildDir(resolved); | 309 build_settings_.SetBuildDir(resolved); |
| 312 return true; | 310 return true; |
| 313 } | 311 } |
| 314 | 312 |
| 315 void Setup::FillPythonPath() { | 313 void Setup::FillPythonPath() { |
| 316 #if defined(OS_WIN) | 314 #if defined(OS_WIN) |
| 317 // Find Python on the path so we can use the absolute path in the build. | 315 // Find Python on the path so we can use the absolute path in the build. |
| 318 const base::char16 kGetPython[] = | 316 const base::char16 kGetPython[] = |
| 319 L"cmd.exe /c python -c \"import sys; print sys.executable\""; | 317 L"cmd.exe /c python -c \"import sys; print sys.executable\""; |
| 320 std::string python_path; | 318 std::string python_path; |
| 321 if (base::GetAppOutput(kGetPython, &python_path)) { | 319 if (base::GetAppOutput(kGetPython, &python_path)) { |
| 322 base::TrimWhitespaceASCII(python_path, base::TRIM_ALL, &python_path); | 320 base::TrimWhitespaceASCII(python_path, base::TRIM_ALL, &python_path); |
| 323 if (scheduler_.verbose_logging()) | 321 if (scheduler_.verbose_logging()) |
| 324 scheduler_.Log("Found python", python_path); | 322 scheduler_.Log("Found python", python_path); |
| 325 } else { | 323 } else { |
| 326 scheduler_.Log("WARNING", "Could not find python on path, using " | 324 scheduler_.Log("WARNING", "Could not find python on path, using " |
| 327 "just \"python.exe\""); | 325 "just \"python.exe\""); |
| 328 python_path = "python.exe"; | 326 python_path = "python.exe"; |
| 329 } | 327 } |
| 330 build_settings_.set_python_path( | 328 build_settings_.set_python_path(base::FilePath(base::UTF8ToUTF16(python_path)) |
| 331 base::FilePath(base::UTF8ToUTF16(python_path))); | 329 .NormalizePathSeparatorsTo('/')); |
| 332 #else | 330 #else |
| 333 build_settings_.set_python_path(base::FilePath("python")); | 331 build_settings_.set_python_path(base::FilePath("python")); |
| 334 #endif | 332 #endif |
| 335 } | 333 } |
| 336 | 334 |
| 337 bool Setup::RunConfigFile() { | 335 bool Setup::RunConfigFile() { |
| 338 if (scheduler_.verbose_logging()) | 336 if (scheduler_.verbose_logging()) |
| 339 scheduler_.Log("Got dotfile", FilePathToUTF8(dotfile_name_)); | 337 scheduler_.Log("Got dotfile", FilePathToUTF8(dotfile_name_)); |
| 340 | 338 |
| 341 dotfile_input_file_.reset(new InputFile(SourceFile("//.gn"))); | 339 dotfile_input_file_.reset(new InputFile(SourceFile("//.gn"))); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 431 } |
| 434 | 432 |
| 435 void DependentSetup::RunPreMessageLoop() { | 433 void DependentSetup::RunPreMessageLoop() { |
| 436 CommonSetup::RunPreMessageLoop(); | 434 CommonSetup::RunPreMessageLoop(); |
| 437 } | 435 } |
| 438 | 436 |
| 439 bool DependentSetup::RunPostMessageLoop() { | 437 bool DependentSetup::RunPostMessageLoop() { |
| 440 return CommonSetup::RunPostMessageLoop(); | 438 return CommonSetup::RunPostMessageLoop(); |
| 441 } | 439 } |
| 442 | 440 |
| OLD | NEW |