Changeset 200774 in webkit


Ignore:
Timestamp:
May 12, 2016 8:47:45 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Windows Perl fails to run copy-user-interface-resources.pl
https://bugs.webkit.org/show_bug.cgi?id=157620
<rdar://problem/26241548>

Patch by Fujii Hironori <Fujii Hironori> on 2016-05-12
Reviewed by Timothy Hatcher.

There are two problems on Windows platform. 'cat' command is
missing and can not execute shebang.

  • Scripts/copy-user-interface-resources.pl: Invoke Perl scripts

with explicitly specifying Perl command instead of relying on
shebang. Add a new subroutine 'appendFile' to concatenate files
instread of 'cat' command.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r200773 r200774  
     12016-05-12  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        Web Inspector: Windows Perl fails to run copy-user-interface-resources.pl
     4        https://bugs.webkit.org/show_bug.cgi?id=157620
     5        <rdar://problem/26241548>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        There are two problems on Windows platform. 'cat' command is
     10        missing and can not execute shebang.
     11
     12        * Scripts/copy-user-interface-resources.pl: Invoke Perl scripts
     13        with explicitly specifying Perl command instead of relying on
     14        shebang.  Add a new subroutine 'appendFile' to concatenate files
     15        instread of 'cat' command.
     16
    1172016-05-12  Joseph Pecoraro  <pecoraro@apple.com>
    218
  • trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl

    r200229 r200774  
    6060        close(TARGET_FILE);
    6161    }
     62}
     63
     64sub appendFile($$)
     65{
     66    my ($targetFile, $srcFile) = @_;
     67
     68    open(SRC_FILE, '<', $srcFile) or die "Unable to open $srcFile: $!";
     69    my @srcText = <SRC_FILE>;
     70    close(SRC_FILE);
     71    open(TARGET_FILE, '>>', $targetFile) or die "Unable to open $targetFile: $!";
     72    print TARGET_FILE @srcText;
     73    close(TARGET_FILE);
    6274}
    6375
     
    120132EOF
    121133
     134my $perl = $^X;
    122135my $python = ($OSNAME =~ /cygwin/) ? "/usr/bin/python" : "python";
    123136my $derivedSourcesDir = $ENV{'DERIVED_SOURCES_DIR'};
     
    156169if ($shouldCombineMain) {
    157170    # Remove Debug JavaScript and CSS files in Production builds.
    158     system($combineResourcesCmd, '--input-dir', 'Debug', '--input-html', File::Spec->catfile($uiRoot, 'Main.html'), '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'Debug.js', '--output-style-name', 'Debug.css', '--strip');
     171    system($perl, $combineResourcesCmd, '--input-dir', 'Debug', '--input-html', File::Spec->catfile($uiRoot, 'Main.html'), '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'Debug.js', '--output-style-name', 'Debug.css', '--strip');
    159172
    160173    # Combine the JavaScript and CSS files in Production builds into single files (Main.js and Main.css).
    161174    my $derivedSourcesMainHTML = File::Spec->catfile($derivedSourcesDir, 'Main.html');
    162     system($combineResourcesCmd, '--input-html', $derivedSourcesMainHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'Main.js', '--output-style-name', 'Main.css');
     175    system($perl, $combineResourcesCmd, '--input-html', $derivedSourcesMainHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'Main.js', '--output-style-name', 'Main.css');
    163176
    164177    # Combine the CodeMirror JavaScript and CSS files in Production builds into single files (CodeMirror.js and CodeMirror.css).
    165     system($combineResourcesCmd, '--input-dir', 'External/CodeMirror', '--input-html', $derivedSourcesMainHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'CodeMirror.js', '--output-style-name', 'CodeMirror.css');
     178    system($perl, $combineResourcesCmd, '--input-dir', 'External/CodeMirror', '--input-html', $derivedSourcesMainHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'CodeMirror.js', '--output-style-name', 'CodeMirror.css');
    166179
    167180    # Combine the Esprima JavaScript files in Production builds into a single file (Esprima.js).
    168     system($combineResourcesCmd, '--input-dir', 'External/Esprima', '--input-html', $derivedSourcesMainHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'Esprima.js');
     181    system($perl, $combineResourcesCmd, '--input-dir', 'External/Esprima', '--input-html', $derivedSourcesMainHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'Esprima.js');
    169182
    170183    # Combine the ESLint JavaScript files in Production builds into a single file (ESLint.js).
    171     system($combineResourcesCmd, '--input-dir', 'External/ESLint', '--input-html', $derivedSourcesMainHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'ESLint.js');
     184    system($perl, $combineResourcesCmd, '--input-dir', 'External/ESLint', '--input-html', $derivedSourcesMainHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'ESLint.js');
    172185
    173186    # Remove console.assert calls from the Main.js file.
    174187    my $derivedSourcesMainJS = File::Spec->catfile($derivedSourcesDir, 'Main.js');
    175     system(File::Spec->catfile($scriptsRoot, 'remove-console-asserts.pl'), '--input-script', $derivedSourcesMainJS, '--output-script', $derivedSourcesMainJS);
     188    system($perl, File::Spec->catfile($scriptsRoot, 'remove-console-asserts.pl'), '--input-script', $derivedSourcesMainJS, '--output-script', $derivedSourcesMainJS);
    176189
    177190    # Fix Image URLs in the Main.css file by removing the "../".
     
    245258
    246259    # Remove console.assert calls from the Worker js files.
    247     system(File::Spec->catfile($scriptsRoot, 'remove-console-asserts.pl'), '--input-directory', $workersDir);
     260    system($perl, File::Spec->catfile($scriptsRoot, 'remove-console-asserts.pl'), '--input-directory', $workersDir);
    248261
    249262    # Fix import references in Workers directories. This rewrites "../../External/script.js" import paths to their new locations.
    250     system(File::Spec->catfile($scriptsRoot, 'fix-worker-imports-for-optimized-builds.pl'), '--input-directory', $workersDir) and die "Failed to update Worker imports for optimized builds.";
     263    system($perl, File::Spec->catfile($scriptsRoot, 'fix-worker-imports-for-optimized-builds.pl'), '--input-directory', $workersDir) and die "Failed to update Worker imports for optimized builds.";
    251264} else {
    252265    # Keep the files separate for engineering builds.
     
    256269if ($shouldCombineTest) {
    257270    # Combine the JavaScript files for testing into a single file (TestCombined.js).
    258     system($combineResourcesCmd, '--input-html', File::Spec->catfile($uiRoot, 'Test.html'), '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'TestCombined.js', '--output-style-name', 'TestCombined.css');
     271    system($perl, $combineResourcesCmd, '--input-html', File::Spec->catfile($uiRoot, 'Test.html'), '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'TestCombined.js', '--output-style-name', 'TestCombined.css');
    259272
    260273    my $derivedSourcesTestHTML = File::Spec->catfile($derivedSourcesDir, 'Test.html');
    261274    my $derivedSourcesTestJS = File::Spec->catfile($derivedSourcesDir, 'TestCombined.js');
    262275    # Combine the Esprima JavaScript files for testing into a single file (Esprima.js).
    263     system($combineResourcesCmd, '--input-dir', 'External/Esprima', '--input-html', $derivedSourcesTestHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'TestEsprima.js');
     276    system($perl, $combineResourcesCmd, '--input-dir', 'External/Esprima', '--input-html', $derivedSourcesTestHTML, '--input-html-dir', $uiRoot, '--derived-sources-dir', $derivedSourcesDir, '--output-dir', $derivedSourcesDir, '--output-script-name', 'TestEsprima.js');
    264277
    265278    # Export the license into TestCombined.js.
     
    272285
    273286    # Append TestCombined.js to the license that was exported above.
    274     system(qq(cat "$derivedSourcesTestJS" >> "$targetTestJS")) and die "Failed to append $derivedSourcesTestJS: $!";
     287    appendFile($targetTestJS, $derivedSourcesTestJS);
    275288
    276289    # Append Esprima.js to the license that was exported above.
    277290    my $derivedSourcesEsprimaJS = File::Spec->catfile($derivedSourcesDir, 'TestEsprima.js');
    278     system(qq(cat "$derivedSourcesEsprimaJS" >> "$targetEsprimaJS")) and die "Failed to append $derivedSourcesEsprimaJS: $!";
     291    appendFile($targetEsprimaJS, $derivedSourcesEsprimaJS);
    279292
    280293    # Copy over Test.html.
Note: See TracChangeset for help on using the changeset viewer.