Changeset 96448 in webkit


Ignore:
Timestamp:
Sep 30, 2011 6:40:31 PM (13 years ago)
Author:
dbates@webkit.org
Message:

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.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r96444 r96448  
     12011-09-30  Daniel Bates  <dbates@rim.com>
     2
     3        Cleanup: Extract code to launch a Mac WebKit application into a common function
     4        https://bugs.webkit.org/show_bug.cgi?id=68662
     5
     6        Reviewed by Adam Roben.
     7
     8        Extracts common code to launch a WebKit application on Mac OS X into a function
     9        so that we can remove duplicate code.
     10
     11        * Scripts/run-webkit-app: Modified to use webkitdirs::runMacWebKitApp().
     12        * Scripts/webkitdirs.pm: Sorted @EXPORT list and added constant USE_OPEN_COMMAND.
     13        (runMacWebKitApp): Added.
     14        (runSafari): Modified to use webkitdirs::runMacWebKitApp().
     15        (runMiniBrowser): Ditto.
     16        (runWebKitTestRunner): Ditto.
     17        (runTestWebKitAPI): Ditto.
     18
    1192011-09-29  David Levin  <levin@chromium.org>
    220
  • trunk/Tools/Scripts/run-webkit-app

    r39852 r96448  
    3535
    3636setConfiguration();
    37 my $productDir = productDir();
    3837
    3938die "Did not specify an application to open (e.g. run-webkit-app AppName).\n" unless length($ARGV[0]) > 0;
     
    4241checkFrameworks();
    4342
    44 # Set up DYLD_FRAMEWORK_PATH to point to the product directory.
    45 print "Start $ARGV[0] with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
    46 $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
    47 $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
    48 
    49 unshift(@ARGV, "-a");
    50 exec "open", @ARGV;
     43my $appPath = shift(@ARGV);
     44exit exitStatus(runMacWebKitApp($appPath, USE_OPEN_COMMAND));
  • trunk/Tools/Scripts/webkitdirs.pm

    r96235 r96448  
    4444   $VERSION     = 1.00;
    4545   @ISA         = qw(Exporter);
    46    @EXPORT      = qw(&chdirWebKit &baseProductDir &productDir &XcodeOptions &XcodeOptionString &XcodeOptionStringNoConfig &passedConfiguration &setConfiguration &safariPath &checkFrameworks &currentSVNRevision);
     46   @EXPORT      = qw(
     47       &XcodeOptionString
     48       &XcodeOptionStringNoConfig
     49       &XcodeOptions
     50       &baseProductDir
     51       &chdirWebKit
     52       &checkFrameworks
     53       &currentSVNRevision
     54       &passedConfiguration
     55       &productDir
     56       &runMacWebKitApp
     57       &safariPath
     58       &setConfiguration
     59       USE_OPEN_COMMAND
     60   );
    4761   %EXPORT_TAGS = ( );
    4862   @EXPORT_OK   = ();
    4963}
     64
     65use constant USE_OPEN_COMMAND => 1; # Used in runMacWebKitApp().
    5066
    5167our @EXPORT_OK;
     
    20012017}
    20022018
     2019sub runMacWebKitApp($;$)
     2020{
     2021    my ($appPath, $useOpenCommand) = @_;
     2022    my $productDir = productDir();
     2023    print "Starting @{[basename($appPath)]} with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
     2024    $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
     2025    $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
     2026    if ($useOpenCommand == USE_OPEN_COMMAND) {
     2027        return system("open", "-W", "-a", $appPath, "--args", @ARGV);
     2028    }
     2029    if (architecture()) {
     2030        return system "arch", "-" . architecture(), $appPath, @ARGV;
     2031    }
     2032    return system { $appPath } $appPath, @ARGV;
     2033}
     2034
    20032035sub runSafari
    20042036{
     
    20062038
    20072039    if (isAppleMacWebKit()) {
    2008         return system "$FindBin::Bin/gdb-safari", argumentsForConfiguration() if $debugger;
    2009 
    2010         my $productDir = productDir();
    2011         print "Starting Safari with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
    2012         $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
    2013         $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
    2014         if (architecture()) {
    2015             return system "arch", "-" . architecture(), safariPath(), @ARGV;
    2016         } else {
    2017             return system safariPath(), @ARGV;
    2018         }
     2040        if ($debugger) {
     2041            return system "$FindBin::Bin/gdb-safari", argumentsForConfiguration();
     2042        }
     2043        return runMacWebKitApp(safariPath());
    20192044    }
    20202045
     
    20412066{
    20422067    if (isAppleMacWebKit()) {
    2043         my $productDir = productDir();
    2044         print "Starting MiniBrowser with DYLD_FRAMEWORK_PATH set to point to $productDir.\n";
    2045         $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
    2046         $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
    2047         my $miniBrowserPath = "$productDir/MiniBrowser.app/Contents/MacOS/MiniBrowser";
    2048         if (architecture()) {
    2049             return system "arch", "-" . architecture(), $miniBrowserPath, @ARGV;
    2050         } else {
    2051             return system $miniBrowserPath, @ARGV;
    2052         }
     2068        return runMacWebKitApp(File::Spec->catfile(productDir(), "MiniBrowser.app", "Contents", "MacOS", "MiniBrowser"));
    20532069    }
    20542070
     
    20812097{
    20822098    if (isAppleMacWebKit()) {
    2083         my $productDir = productDir();
    2084         print "Starting WebKitTestRunner with DYLD_FRAMEWORK_PATH set to point to $productDir.\n";
    2085         $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
    2086         $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
    2087         my $webKitTestRunnerPath = "$productDir/WebKitTestRunner";
    2088         if (architecture()) {
    2089             return system "arch", "-" . architecture(), $webKitTestRunnerPath, @ARGV;
    2090         } else {
    2091             return system $webKitTestRunnerPath, @ARGV;
    2092         }
     2099        return runMacWebKitApp(File::Spec->catfile(productDir(), "WebKitTestRunner"));
    20932100    } elsif (isGtk()) {
    20942101        my $productDir = productDir();
     
    21272134{
    21282135    if (isAppleMacWebKit()) {
    2129         my $productDir = productDir();
    2130         print "Starting TestWebKitAPI with DYLD_FRAMEWORK_PATH set to point to $productDir.\n";
    2131         $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
    2132         $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
    2133         my $testWebKitAPIPath = "$productDir/TestWebKitAPI";
    2134         if (architecture()) {
    2135             return system "arch", "-" . architecture(), $testWebKitAPIPath, @ARGV;
    2136         } else {
    2137             return system $testWebKitAPIPath, @ARGV;
    2138         }
     2136        return runMacWebKitApp(File::Spec->catfile(productDir(), "TestWebKitAPI"));
    21392137    }
    21402138
Note: See TracChangeset for help on using the changeset viewer.