+2011-09-30 Daniel Bates <dbates@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 <levin@chromium.org>
watchlist: Add webkit-patch command to run watchlist.
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;
}
}
+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()) {
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;
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";
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;