Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (205691 => 205692)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-09-09 03:49:13 UTC (rev 205691)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-09-09 04:33:11 UTC (rev 205692)
@@ -1,3 +1,27 @@
+2016-09-08 Brian Burg <[email protected]>
+
+ Web Inspector: get rid of extra copies of jsmin.py and cssmin.py
+ https://bugs.webkit.org/show_bug.cgi?id=161770
+ <rdar://problem/28216813>
+
+ Reviewed by Joseph Pecoraro.
+
+ * Scripts/copy-user-interface-resources-dryrun.rb:
+ - Keep track of the original working directory.
+ - Stage scripts from PrivateHeaders into the temporary directory.
+ - Add a comment to clarify what this script is simulating.
+ - Use system instead of exec so we can print an error message.
+
+ * Scripts/copy-user-interface-resources.pl:
+ - Use jsmin.py and cssmin.py from _javascript_Core instead of
+ WebInspectorUI. There are no differences between the two copies.
+
+ * Scripts/cssmin.py: Removed.
+ * Scripts/jsmin.py: Removed.
+
+ * WebInspectorUI.xcodeproj/project.pbxproj:
+ - Remove unused copies of jsmin.py and cssmin.py.
+
2016-09-08 Matt Baker <[email protected]>
Web Inspector: TimelineDataGridNode should refresh when graph column is resized
Modified: trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources-dryrun.rb (205691 => 205692)
--- trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources-dryrun.rb 2016-09-09 03:49:13 UTC (rev 205691)
+++ trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources-dryrun.rb 2016-09-09 04:33:11 UTC (rev 205692)
@@ -31,10 +31,16 @@
exit 1
end
+_javascript_CORE_PATH = File.expand_path File.join(File.dirname(__FILE__), "..", "..", "_javascript_Core")
WEB_INSPECTOR_PATH = File.expand_path File.join(File.dirname(__FILE__), "..")
COPY_USER_INTERFACE_RESOURCES_PATH = File.join WEB_INSPECTOR_PATH, "Scripts", "copy-user-interface-resources.pl"
+# This script simulates processing user interface resources located in SRCROOT.
+# It places processed files in the specified output directory. This is most similar
+# to an isolated OBJROOT since it includes DerivedSources. It doesn't place files
+# into their DSTROOT locations, such as inside of WebInspectorUI.framework.
$output_directory = File.expand_path ARGV[0]
+$start_directory = FileUtils.pwd
Dir.mktmpdir do |tmpdir|
@@ -46,12 +52,17 @@
# Setup the environment and run.
ENV["DERIVED_SOURCES_DIR"] = tmpdir
+ # Stage some scripts expected to be in various framework PrivateHeaders.
ENV["_javascript_CORE_PRIVATE_HEADERS_DIR"] = tmpdir
+ FileUtils.cp(File.join(_javascript_CORE_PATH, "Scripts", "cssmin.py"), tmpdir)
+ FileUtils.cp(File.join(_javascript_CORE_PATH, "Scripts", "jsmin.py"), tmpdir)
ENV["SRCROOT"] = WEB_INSPECTOR_PATH
ENV["TARGET_BUILD_DIR"] = $output_directory
ENV["UNLOCALIZED_RESOURCES_FOLDER_PATH"] = ""
ENV["COMBINE_INSPECTOR_RESOURCES"] = "YES"
ENV["COMBINE_TEST_RESOURCES"] = "YES"
- exec COPY_USER_INTERFACE_RESOURCES_PATH
+ ENV["FORCE_TOOL_INSTALL"] = "NO"
+ FileUtils.cd $start_directory
+ system(COPY_USER_INTERFACE_RESOURCES_PATH) or raise "Failed to process user interface resources."
end
Modified: trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl (205691 => 205692)
--- trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl 2016-09-09 03:49:13 UTC (rev 205691)
+++ trunk/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl 2016-09-09 04:33:11 UTC (rev 205692)
@@ -90,7 +90,7 @@
my $inspectorLicense = <<'EOF';
/*
- * Copyright (C) 2007-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2016 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek. All rights reserved.
* Copyright (C) 2008-2009 Anthony Ricaud <[email protected]>
* Copyright (C) 2009-2010 Joseph Pecoraro. All rights reserved.
@@ -135,6 +135,7 @@
my $python = ($OSNAME =~ /cygwin/) ? "/usr/bin/python" : "python";
my $derivedSourcesDir = $ENV{'DERIVED_SOURCES_DIR'};
my $scriptsRoot = File::Spec->catdir($ENV{'SRCROOT'}, 'Scripts');
+my $sharedScriptsRoot = File::Spec->catdir($ENV{'_javascript_CORE_PRIVATE_HEADERS_DIR'});
my $uiRoot = File::Spec->catdir($ENV{'SRCROOT'}, 'UserInterface');
my $targetResourcePath = File::Spec->catdir($ENV{'TARGET_BUILD_DIR'}, $ENV{'UNLOCALIZED_RESOURCES_FOLDER_PATH'});
my $protocolDir = File::Spec->catdir($targetResourcePath, 'Protocol');
@@ -222,8 +223,8 @@
seedFile($targetESLintJS, $eslintLicense);
# Minify the Main.js and Main.css files, with Main.js appending to the license that was exported above.
- my $jsMinScript = File::Spec->catfile($scriptsRoot, 'jsmin.py');
- my $cssMinScript = File::Spec->catfile($scriptsRoot, 'cssmin.py');
+ my $jsMinScript = File::Spec->catfile($sharedScriptsRoot, 'jsmin.py');
+ my $cssMinScript = File::Spec->catfile($sharedScriptsRoot, 'cssmin.py');
system(qq("$python" "$jsMinScript" < "$derivedSourcesMainJS" >> "$targetMainJS")) and die "Failed to minify $derivedSourcesMainJS: $!";
system(qq("$python" "$cssMinScript" < "$derivedSourcesMainCSS" >> "$targetMainCSS")) and die "Failed to minify $derivedSourcesMainCSS: $!";
Deleted: trunk/Source/WebInspectorUI/Scripts/cssmin.py (205691 => 205692)
--- trunk/Source/WebInspectorUI/Scripts/cssmin.py 2016-09-09 03:49:13 UTC (rev 205691)
+++ trunk/Source/WebInspectorUI/Scripts/cssmin.py 2016-09-09 04:33:11 UTC (rev 205692)
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-
-# Copyright (C) 2013 Apple Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-# THE POSSIBILITY OF SUCH DAMAGE.
-
-import re
-
-def cssminify(css):
- rules = (
- (r"\/\*.*?\*\/", ""), # delete comments
- (r"\n", ""), # delete new lines
- (r"\s+", " "), # change multiple spaces to one space
- (r"\s?([;{},~>!])\s?", r"\1"), # delete space where it is not needed
- (r":\s", ":"), # delete spaces after colons, but not before. E.g. do not break selectors "a :focus", "b :matches(...)", "c :not(...)" where the leading space is significant
- (r"\s?([-+])(?:\s(?![0-9(])(?!var))", r"\1"), # delete whitespace around + and - when not followed by a number, paren, or var(). E.g. strip for selector "a + b" but not "calc(a + b)" which requires spaces.
- (r";}", "}") # change ';}' to '}' because the semicolon is not needed
- )
-
- css = css.replace("\r\n", "\n")
- for rule in rules:
- css = re.compile(rule[0], re.MULTILINE | re.UNICODE | re.DOTALL).sub(rule[1], css)
- return css
-
-if __name__ == "__main__":
- import sys
- if sys.version_info[0] == 3 and sys.stdin.encoding != 'UTF-8':
- import io
- sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='UTF-8')
- sys.stdout.write(cssminify(sys.stdin.read()))
Deleted: trunk/Source/WebInspectorUI/Scripts/jsmin.py (205691 => 205692)
--- trunk/Source/WebInspectorUI/Scripts/jsmin.py 2016-09-09 03:49:13 UTC (rev 205691)
+++ trunk/Source/WebInspectorUI/Scripts/jsmin.py 2016-09-09 04:33:11 UTC (rev 205692)
@@ -1,238 +0,0 @@
-# This code is original from jsmin by Douglas Crockford, it was translated to
-# Python by Baruch Even. It was rewritten by Dave St.Germain for speed.
-#
-# The MIT License (MIT)
-#
-# Copyright (c) 2013 Dave St.Germain
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-
-import sys
-is_3 = sys.version_info >= (3, 0)
-if is_3:
- import io
-else:
- import StringIO
- try:
- import cStringIO
- except ImportError:
- cStringIO = None
-
-
-__all__ = ['jsmin', '_javascript_Minify']
-__version__ = '2.0.9'
-
-
-def jsmin(js):
- """
- returns a minified version of the _javascript_ string
- """
- if not is_3:
- if cStringIO and not isinstance(js, unicode):
- # strings can use cStringIO for a 3x performance
- # improvement, but unicode (in python2) cannot
- klass = cStringIO.StringIO
- else:
- klass = StringIO.StringIO
- else:
- klass = io.StringIO
- ins = klass(js)
- outs = klass()
- _javascript_Minify(ins, outs).minify()
- return outs.getvalue()
-
-
-class _javascript_Minify(object):
- """
- Minify an input stream of _javascript_, writing
- to an output stream
- """
-
- def __init__(self, instream=None, outstream=None):
- self.ins = instream
- self.outs = outstream
-
- def minify(self, instream=None, outstream=None):
- if instream and outstream:
- self.ins, self.outs = instream, outstream
-
- self.is_return = False
- self.return_buf = ''
-
- def write(char):
- # all of this is to support literal regular expressions.
- # sigh
- if char in 'return':
- self.return_buf += char
- self.is_return = self.return_buf == 'return'
- self.outs.write(char)
- if self.is_return:
- self.return_buf = ''
-
- read = self.ins.read
-
- space_strings = "abcdefghijklmnopqrstuvwxyz"\
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$\\"
- starters, enders = '{[(+-', '}])+-"\''
- newlinestart_strings = starters + space_strings
- newlineend_strings = enders + space_strings
- do_newline = False
- do_space = False
- escape_slash_count = 0
- doing_single_comment = False
- previous_before_comment = ''
- doing_multi_comment = False
- in_re = False
- in_quote = ''
- quote_buf = []
-
- previous = read(1)
- if previous == '\\':
- escape_slash_count += 1
- next1 = read(1)
- if previous == '/':
- if next1 == '/':
- doing_single_comment = True
- elif next1 == '*':
- doing_multi_comment = True
- previous = next1
- next1 = read(1)
- else:
- write(previous)
- elif not previous:
- return
- elif previous >= '!':
- if previous in "'\"":
- in_quote = previous
- write(previous)
- previous_non_space = previous
- else:
- previous_non_space = ' '
- if not next1:
- return
-
- while 1:
- next2 = read(1)
- if not next2:
- last = next1.strip()
- if not (doing_single_comment or doing_multi_comment)\
- and last not in ('', '/'):
- if in_quote:
- write(''.join(quote_buf))
- write(last)
- break
- if doing_multi_comment:
- if next1 == '*' and next2 == '/':
- doing_multi_comment = False
- next2 = read(1)
- elif doing_single_comment:
- if next1 in '\r\n':
- doing_single_comment = False
- while next2 in '\r\n':
- next2 = read(1)
- if not next2:
- break
- if previous_before_comment in ')}]':
- do_newline = True
- elif previous_before_comment in space_strings:
- write('\n')
- elif in_quote:
- quote_buf.append(next1)
-
- if next1 == in_quote:
- numslashes = 0
- for c in reversed(quote_buf[:-1]):
- if c != '\\':
- break
- else:
- numslashes += 1
- if numslashes % 2 == 0:
- in_quote = ''
- write(''.join(quote_buf))
- elif next1 in '\r\n':
- if previous_non_space in newlineend_strings \
- or previous_non_space > '~':
- while 1:
- if next2 < '!':
- next2 = read(1)
- if not next2:
- break
- else:
- if next2 in newlinestart_strings \
- or next2 > '~' or next2 == '/':
- do_newline = True
- break
- elif next1 < '!' and not in_re:
- if (previous_non_space in space_strings \
- or previous_non_space > '~') \
- and (next2 in space_strings or next2 > '~'):
- do_space = True
- elif previous_non_space in '-+' and next2 == previous_non_space:
- # protect against + ++ or - -- sequences
- do_space = True
- elif self.is_return and next2 == '/':
- # returning a regex...
- write(' ')
- elif next1 == '/':
- if do_space:
- write(' ')
- if in_re:
- if previous != '\\' or (not escape_slash_count % 2) or next2 in 'gimy':
- in_re = False
- write('/')
- elif next2 == '/':
- doing_single_comment = True
- previous_before_comment = previous_non_space
- elif next2 == '*':
- doing_multi_comment = True
- previous = next1
- next1 = next2
- next2 = read(1)
- else:
- in_re = previous_non_space in '(,=:[?!&|' or self.is_return # literal regular _expression_
- write('/')
- else:
- if do_space:
- do_space = False
- write(' ')
- if do_newline:
- write('\n')
- do_newline = False
-
- write(next1)
- if not in_re and next1 in "'\"`":
- in_quote = next1
- quote_buf = []
-
- previous = next1
- next1 = next2
-
- if previous >= '!':
- previous_non_space = previous
-
- if previous == '\\':
- escape_slash_count += 1
- else:
- escape_slash_count = 0
-
-if __name__ == '__main__':
- minifier = _javascript_Minify(sys.stdin, sys.stdout)
- minifier.minify()
- sys.stdout.write('\n')
Modified: trunk/Source/WebInspectorUI/WebInspectorUI.xcodeproj/project.pbxproj (205691 => 205692)
--- trunk/Source/WebInspectorUI/WebInspectorUI.xcodeproj/project.pbxproj 2016-09-09 03:49:13 UTC (rev 205691)
+++ trunk/Source/WebInspectorUI/WebInspectorUI.xcodeproj/project.pbxproj 2016-09-09 04:33:11 UTC (rev 205692)
@@ -12,8 +12,6 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
- 1C435CAC14E7B287004E10EA /* cssmin.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = cssmin.py; sourceTree = "<group>"; };
- 1C435CAD14E7B287004E10EA /* jsmin.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = jsmin.py; sourceTree = "<group>"; };
1C60FE2F14E5F3CD006CD77D /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
1C60FE3114E5F3CD006CD77D /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
1C60FE3214E5F3CD006CD77D /* Version.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
@@ -54,8 +52,6 @@
children = (
1C60FF1914E73C64006CD77D /* combine-resources.pl */,
1C60FFE114E79B0F006CD77D /* copy-user-interface-resources.pl */,
- 1C435CAC14E7B287004E10EA /* cssmin.py */,
- 1C435CAD14E7B287004E10EA /* jsmin.py */,
1C60FF1A14E73DCA006CD77D /* remove-console-asserts.pl */,
);
path = Scripts;