Modified: trunk/Tools/ChangeLog (96447 => 96448)
--- trunk/Tools/ChangeLog 2011-10-01 01:37:02 UTC (rev 96447)
+++ trunk/Tools/ChangeLog 2011-10-01 01:40:31 UTC (rev 96448)
@@ -1,3 +1,21 @@
+2011-09-30 Daniel Bates <dba...@rim.com>
+
+ Cleanup: Extract code to launch a Mac WebKit application into a common function
+ https://bugs.webkit.org/show_bug.cgi?id=68662
+
+ Reviewed by Adam Roben.
+
+ Extracts common code to launch a WebKit application on Mac OS X into a function
+ so that we can remove duplicate code.
+
+ * Scripts/run-webkit-app: Modified to use webkitdirs::runMacWebKitApp().
+ * Scripts/webkitdirs.pm: Sorted @EXPORT list and added constant USE_OPEN_COMMAND.
+ (runMacWebKitApp): Added.
+ (runSafari): Modified to use webkitdirs::runMacWebKitApp().
+ (runMiniBrowser): Ditto.
+ (runWebKitTestRunner): Ditto.
+ (runTestWebKitAPI): Ditto.
+
2011-09-29 David Levin <le...@chromium.org>
watchlist: Add webkit-patch command to run watchlist.
Modified: trunk/Tools/Scripts/run-webkit-app (96447 => 96448)
--- trunk/Tools/Scripts/run-webkit-app 2011-10-01 01:37:02 UTC (rev 96447)
+++ trunk/Tools/Scripts/run-webkit-app 2011-10-01 01:40:31 UTC (rev 96448)
@@ -34,17 +34,11 @@
use webkitdirs;
setConfiguration();
-my $productDir = productDir();
die "Did not specify an application to open (e.g. run-webkit-app AppName).\n" unless length($ARGV[0]) > 0;
# Check to see that all the frameworks are built.
checkFrameworks();
-# Set up DYLD_FRAMEWORK_PATH to point to the product directory.
-print "Start $ARGV[0] with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
-$ENV{DYLD_FRAMEWORK_PATH} = $productDir;
-$ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
-
-unshift(@ARGV, "-a");
-exec "open", @ARGV;
+my $appPath = shift(@ARGV);
+exit exitStatus(runMacWebKitApp($appPath, USE_OPEN_COMMAND));
Modified: trunk/Tools/Scripts/webkitdirs.pm (96447 => 96448)
--- trunk/Tools/Scripts/webkitdirs.pm 2011-10-01 01:37:02 UTC (rev 96447)
+++ trunk/Tools/Scripts/webkitdirs.pm 2011-10-01 01:40:31 UTC (rev 96448)
@@ -43,11 +43,27 @@
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
$VERSION = 1.00;
@ISA = qw(Exporter);
- @EXPORT = qw(&chdirWebKit &baseProductDir &productDir &XcodeOptions &XcodeOptionString &XcodeOptionStringNoConfig &passedConfiguration &setConfiguration &safariPath &checkFrameworks ¤tSVNRevision);
+ @EXPORT = qw(
+ &XcodeOptionString
+ &XcodeOptionStringNoConfig
+ &XcodeOptions
+ &baseProductDir
+ &chdirWebKit
+ &checkFrameworks
+ ¤tSVNRevision
+ &passedConfiguration
+ &productDir
+ &runMacWebKitApp
+ &safariPath
+ &setConfiguration
+ USE_OPEN_COMMAND
+ );
%EXPORT_TAGS = ( );
@EXPORT_OK = ();
}
+use constant USE_OPEN_COMMAND => 1; # Used in runMacWebKitApp().
+
our @EXPORT_OK;
my $architecture;
@@ -2000,22 +2016,31 @@
}
}
+sub runMacWebKitApp($;$)
+{
+ my ($appPath, $useOpenCommand) = @_;
+ my $productDir = productDir();
+ print "Starting @{[basename($appPath)]} with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
+ $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
+ $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
+ if ($useOpenCommand == USE_OPEN_COMMAND) {
+ return system("open", "-W", "-a", $appPath, "--args", @ARGV);
+ }
+ if (architecture()) {
+ return system "arch", "-" . architecture(), $appPath, @ARGV;
+ }
+ return system { $appPath } $appPath, @ARGV;
+}
+
sub runSafari
{
my ($debugger) = @_;
if (isAppleMacWebKit()) {
- return system "$FindBin::Bin/gdb-safari", argumentsForConfiguration() if $debugger;
-
- my $productDir = productDir();
- print "Starting Safari with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
- $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
- $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
- if (architecture()) {
- return system "arch", "-" . architecture(), safariPath(), @ARGV;
- } else {
- return system safariPath(), @ARGV;
+ if ($debugger) {
+ return system "$FindBin::Bin/gdb-safari", argumentsForConfiguration();
}
+ return runMacWebKitApp(safariPath());
}
if (isAppleWinWebKit()) {
@@ -2040,16 +2065,7 @@
sub runMiniBrowser
{
if (isAppleMacWebKit()) {
- my $productDir = productDir();
- print "Starting MiniBrowser with DYLD_FRAMEWORK_PATH set to point to $productDir.\n";
- $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
- $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
- my $miniBrowserPath = "$productDir/MiniBrowser.app/Contents/MacOS/MiniBrowser";
- if (architecture()) {
- return system "arch", "-" . architecture(), $miniBrowserPath, @ARGV;
- } else {
- return system $miniBrowserPath, @ARGV;
- }
+ return runMacWebKitApp(File::Spec->catfile(productDir(), "MiniBrowser.app", "Contents", "MacOS", "MiniBrowser"));
}
return 1;
@@ -2080,16 +2096,7 @@
sub runWebKitTestRunner
{
if (isAppleMacWebKit()) {
- my $productDir = productDir();
- print "Starting WebKitTestRunner with DYLD_FRAMEWORK_PATH set to point to $productDir.\n";
- $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
- $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
- my $webKitTestRunnerPath = "$productDir/WebKitTestRunner";
- if (architecture()) {
- return system "arch", "-" . architecture(), $webKitTestRunnerPath, @ARGV;
- } else {
- return system $webKitTestRunnerPath, @ARGV;
- }
+ return runMacWebKitApp(File::Spec->catfile(productDir(), "WebKitTestRunner"));
} elsif (isGtk()) {
my $productDir = productDir();
my $injectedBundlePath = "$productDir/Libraries/.libs/libTestRunnerInjectedBundle";
@@ -2126,16 +2133,7 @@
sub runTestWebKitAPI
{
if (isAppleMacWebKit()) {
- my $productDir = productDir();
- print "Starting TestWebKitAPI with DYLD_FRAMEWORK_PATH set to point to $productDir.\n";
- $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
- $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
- my $testWebKitAPIPath = "$productDir/TestWebKitAPI";
- if (architecture()) {
- return system "arch", "-" . architecture(), $testWebKitAPIPath, @ARGV;
- } else {
- return system $testWebKitAPIPath, @ARGV;
- }
+ return runMacWebKitApp(File::Spec->catfile(productDir(), "TestWebKitAPI"));
}
return 1;