Title: [200774] trunk/Source/WebInspectorUI
Revision
200774
Author
[email protected]
Date
2016-05-12 08:47:45 -0700 (Thu, 12 May 2016)

Log 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 <[email protected]> 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.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (200773 => 200774)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-05-12 15:43:43 UTC (rev 200773)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-05-12 15:47:45 UTC (rev 200774)
@@ -1,3 +1,19 @@
+2016-05-12  Fujii Hironori  <[email protected]>
+
+        Web Inspector: Windows Perl fails to run copy-user-interface-resources.pl
+        https://bugs.webkit.org/show_bug.cgi?id=157620
+        <rdar://problem/26241548>
+
+        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.
+
 2016-05-12  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: 3.8% of timeline recording spent in NavigationSidebarPanel _updateContentOverflowShadowVisibility for background tab

Modified: trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl (200773 => 200774)


--- trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl	2016-05-12 15:43:43 UTC (rev 200773)
+++ trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl	2016-05-12 15:47:45 UTC (rev 200774)
@@ -61,6 +61,18 @@
     }
 }
 
+sub appendFile($$)
+{
+    my ($targetFile, $srcFile) = @_;
+
+    open(SRC_FILE, '<', $srcFile) or die "Unable to open $srcFile: $!";
+    my @srcText = <SRC_FILE>;
+    close(SRC_FILE);
+    open(TARGET_FILE, '>>', $targetFile) or die "Unable to open $targetFile: $!";
+    print TARGET_FILE @srcText;
+    close(TARGET_FILE);
+}
+
 sub readLicenseFile($)
 {
     my ($licenseFilePath) = @_;
@@ -119,6 +131,7 @@
  */
 EOF
 
+my $perl = $^X;
 my $python = ($OSNAME =~ /cygwin/) ? "/usr/bin/python" : "python";
 my $derivedSourcesDir = $ENV{'DERIVED_SOURCES_DIR'};
 my $scriptsRoot = File::Spec->catdir($ENV{'SRCROOT'}, 'Scripts');
@@ -155,24 +168,24 @@
 
 if ($shouldCombineMain) {
     # Remove Debug _javascript_ and CSS files in Production builds.
-    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');
+    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');
 
     # Combine the _javascript_ and CSS files in Production builds into single files (Main.js and Main.css).
     my $derivedSourcesMainHTML = File::Spec->catfile($derivedSourcesDir, 'Main.html');
-    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');
+    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');
 
     # Combine the CodeMirror _javascript_ and CSS files in Production builds into single files (CodeMirror.js and CodeMirror.css).
-    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');
+    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');
 
     # Combine the Esprima _javascript_ files in Production builds into a single file (Esprima.js).
-    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');
+    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');
 
     # Combine the ESLint _javascript_ files in Production builds into a single file (ESLint.js).
-    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');
+    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');
 
     # Remove console.assert calls from the Main.js file.
     my $derivedSourcesMainJS = File::Spec->catfile($derivedSourcesDir, 'Main.js');
-    system(File::Spec->catfile($scriptsRoot, 'remove-console-asserts.pl'), '--input-script', $derivedSourcesMainJS, '--output-script', $derivedSourcesMainJS);
+    system($perl, File::Spec->catfile($scriptsRoot, 'remove-console-asserts.pl'), '--input-script', $derivedSourcesMainJS, '--output-script', $derivedSourcesMainJS);
 
     # Fix Image URLs in the Main.css file by removing the "../".
     my $derivedSourcesMainCSS = File::Spec->catfile($derivedSourcesDir, 'Main.css');
@@ -244,10 +257,10 @@
     ditto(File::Spec->catfile($uiRoot, 'Workers'), $workersDir);
 
     # Remove console.assert calls from the Worker js files.
-    system(File::Spec->catfile($scriptsRoot, 'remove-console-asserts.pl'), '--input-directory', $workersDir);
+    system($perl, File::Spec->catfile($scriptsRoot, 'remove-console-asserts.pl'), '--input-directory', $workersDir);
 
     # Fix import references in Workers directories. This rewrites "../../External/script.js" import paths to their new locations.
-    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.";
+    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.";
 } else {
     # Keep the files separate for engineering builds.
     ditto($uiRoot, $targetResourcePath);
@@ -255,12 +268,12 @@
 
 if ($shouldCombineTest) {
     # Combine the _javascript_ files for testing into a single file (TestCombined.js).
-    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');
+    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');
 
     my $derivedSourcesTestHTML = File::Spec->catfile($derivedSourcesDir, 'Test.html');
     my $derivedSourcesTestJS = File::Spec->catfile($derivedSourcesDir, 'TestCombined.js');
     # Combine the Esprima _javascript_ files for testing into a single file (Esprima.js).
-    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');
+    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');
 
     # Export the license into TestCombined.js.
     my $targetTestJS = File::Spec->catfile($targetResourcePath, 'TestCombined.js');
@@ -271,11 +284,11 @@
     seedFile($targetEsprimaJS, $esprimaLicense);
 
     # Append TestCombined.js to the license that was exported above.
-    system(qq(cat "$derivedSourcesTestJS" >> "$targetTestJS")) and die "Failed to append $derivedSourcesTestJS: $!";
+    appendFile($targetTestJS, $derivedSourcesTestJS);
 
     # Append Esprima.js to the license that was exported above.
     my $derivedSourcesEsprimaJS = File::Spec->catfile($derivedSourcesDir, 'TestEsprima.js');
-    system(qq(cat "$derivedSourcesEsprimaJS" >> "$targetEsprimaJS")) and die "Failed to append $derivedSourcesEsprimaJS: $!";
+    appendFile($targetEsprimaJS, $derivedSourcesEsprimaJS);
 
     # Copy over Test.html.
     copy($derivedSourcesTestHTML, File::Spec->catfile($targetResourcePath, 'Test.html'));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to