Skip to content

Commit

Permalink
Make GetWebKitRootDirFilePath smarter about where the WebKit root is …
Browse files Browse the repository at this point in the history
…relative to the chromium root

BUG=104605
TEST=can run layout tests in a webkit-only build on mac using make

Review URL: http://codereview.chromium.org/8585029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120428 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jochen@chromium.org committed Feb 3, 2012
1 parent 2e81938 commit 569edab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 39 deletions.
33 changes: 5 additions & 28 deletions base/base_paths_posix.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -29,10 +29,6 @@ namespace base {
const char kSelfExe[] = "/proc/self/exe";
#endif

// The name of this file relative to the source root. This is used for checking
// that the source checkout is in the correct place.
static const char kThisSourceFile[] = "base/base_paths_posix.cc";

bool PathProviderPosix(int key, FilePath* result) {
FilePath path;
switch (key) {
Expand Down Expand Up @@ -84,40 +80,21 @@ bool PathProviderPosix(int key, FilePath* result) {
std::string cr_source_root;
if (env->GetVar("CR_SOURCE_ROOT", &cr_source_root)) {
path = FilePath(cr_source_root);
if (file_util::PathExists(path.Append(kThisSourceFile))) {
if (file_util::PathExists(path)) {
*result = path;
return true;
} else {
DLOG(WARNING) << "CR_SOURCE_ROOT is set, but it appears to not "
<< "point to the correct source root directory.";
<< "point to a directory.";
}
}
// On POSIX, unit tests execute two levels deep from the source root.
// For example: out/{Debug|Release}/net_unittest
if (PathService::Get(base::DIR_EXE, &path)) {
path = path.DirName().DirName();
if (file_util::PathExists(path.Append(kThisSourceFile))) {
*result = path;
return true;
}
}
// In a case of WebKit-only checkout, executable files are put into
// <root of checkout>/out/{Debug|Release}, and we should return
// <root of checkout>/Source/WebKit/chromium for DIR_SOURCE_ROOT.
if (PathService::Get(base::DIR_EXE, &path)) {
path = path.DirName().DirName().Append("Source/WebKit/chromium");
if (file_util::PathExists(path.Append(kThisSourceFile))) {
*result = path;
return true;
}
}
// If that failed (maybe the build output is symlinked to a different
// drive) try assuming the current directory is the source root.
if (file_util::GetCurrentDirectory(&path) &&
file_util::PathExists(path.Append(kThisSourceFile))) {
*result = path;
*result = path.DirName().DirName();
return true;
}

DLOG(ERROR) << "Couldn't find your source root. "
<< "Try running from your chromium/src directory.";
return false;
Expand Down
10 changes: 1 addition & 9 deletions base/base_paths_win.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -117,14 +117,6 @@ bool PathProviderWin(int key, FilePath* result) {
// For example: chrome/{Debug|Release}/ui_tests.exe
PathService::Get(base::DIR_EXE, &executableDir);
cur = executableDir.DirName().DirName();
FilePath checkedPath =
cur.Append(FILE_PATH_LITERAL("base/base_paths_win.cc"));
if (!file_util::PathExists(checkedPath)) {
// Check for WebKit-only checkout. Executable files are put into
// WebKit/WebKit/chromium/{Debug|Relese}, and we should return
// WebKit/WebKit/chromium.
cur = executableDir.DirName();
}
break;
}
default:
Expand Down
13 changes: 11 additions & 2 deletions webkit/support/webkit_support.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,20 @@ FilePath GetWebKitRootDirFilePath() {
FilePath basePath;
PathService::Get(base::DIR_SOURCE_ROOT, &basePath);
if (file_util::PathExists(basePath.Append(FILE_PATH_LITERAL("chrome")))) {
// We're in a WebKit-in-chrome checkout.
return basePath.Append(FILE_PATH_LITERAL("third_party/WebKit"));
} else {
// WebKit/Source/WebKit/chromium/ -> WebKit/
} else if (file_util::PathExists(
basePath.Append(FILE_PATH_LITERAL("chromium")))) {
// We're in a WebKit-only checkout on Windows.
return basePath.Append(FILE_PATH_LITERAL("../.."));
} else if (file_util::PathExists(
basePath.Append(FILE_PATH_LITERAL("webkit/support")))) {
// We're in a WebKit-only/xcodebuild checkout on Mac
return basePath.Append(FILE_PATH_LITERAL("../../.."));
}
// We're in a WebKit-only, make-build, so the DIR_SOURCE_ROOT is already the
// WebKit root. That, or we have no idea where we are.
return basePath;
}

class WebKitClientMessageLoopImpl
Expand Down

0 comments on commit 569edab

Please sign in to comment.