<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[190515] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/190515">190515</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2015-10-02 12:43:09 -0700 (Fri, 02 Oct 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>LayoutTestRelay is not built and archived when building for iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=149753

Reviewed by Alexey Proskuryakov and Andy Estes.

Towards running layout tests on the iOS Simulator test bots, we need to teach scripts build-webkit
and built-product-archive to build the Mac tool LayoutTestRelay and include this tool in the built
product archive when building for iOS Simulator, respectively.

* BuildSlaveSupport/built-product-archive:
(main): Pass the full platform name (options.platform) to archiveBuiltProduct() so that it can
differentiate between iOS device and iOS Simulator platforms.
(webkitBuildDirectoryForConfigurationAndPlatform): Extracted logic to run the script webkit-build-directory
from determineWebKitBuildDirectories() into this function so that it can be used by both
determineWebKitBuildDirectories() and archiveBuiltProduct().
(determineWebKitBuildDirectories): Moved logic to execute the script webkit-build-directory from here to
webkitBuildDirectoryForConfigurationAndPlatform().
(createZip): Added parameter embedParentDirectoryNameOnDarwin (defaults to False) to specify whether
we should call ditto(1) with --keepParent to embed the parent directory name in the zip archive. This
argument is only applicable when building on Darwin. We only pass embedParentDirectoryNameOnDarwin=True
when making an archive for a Mac or iOS device build. For iOS Simulator builds we archive two directories
and we do not want to keep the parent directory because it is a placeholder directory used as a workaround
for the limitation that ditto(1) can only accept a single directory to archive on its command line.
(archiveBuiltProduct): Modified to take the full platform name as an argument. Added logic for iOS.
For iOS device builds we use the same logic as for a Mac build and archive the configuration-specific
build directory. For iOS Simulator builds we archive the configuration-specific iOS build directory,
LayoutTestRelay and LayoutTestRelay.dSYM (if it exists) from the configuration-specific Mac build.
* Scripts/build-layouttestrelay:
    - Remove unnecessary include of Perl module POSIX.
    - Only build LayoutTestRelay when building for iOS Simulator (i.e. --ios-simulator is passed).
* Scripts/build-webkit:
    - Invoke script build-layouttestrelay when building for iOS Simulator.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsBuildSlaveSupportbuiltproductarchive">trunk/Tools/BuildSlaveSupport/built-product-archive</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsbuildlayouttestrelay">trunk/Tools/Scripts/build-layouttestrelay</a></li>
<li><a href="#trunkToolsScriptsbuildwebkit">trunk/Tools/Scripts/build-webkit</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsBuildSlaveSupportbuiltproductarchive"></a>
<div class="modfile"><h4>Modified: trunk/Tools/BuildSlaveSupport/built-product-archive (190514 => 190515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/BuildSlaveSupport/built-product-archive        2015-10-02 19:36:32 UTC (rev 190514)
+++ trunk/Tools/BuildSlaveSupport/built-product-archive        2015-10-02 19:43:09 UTC (rev 190515)
</span><span class="lines">@@ -62,21 +62,29 @@
</span><span class="cx">         return 1
</span><span class="cx"> 
</span><span class="cx">     if action == 'archive':
</span><del>-        return archiveBuiltProduct(options.configuration, genericPlatform)
</del><ins>+        return archiveBuiltProduct(options.configuration, genericPlatform, options.platform)
</ins><span class="cx">     else:
</span><span class="cx">         return extractBuiltProduct(options.configuration, genericPlatform)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-def determineWebKitBuildDirectories(platform, fullPlatform, configuration):
-    global _configurationBuildDirectory
-    global _topLevelBuildDirectory
</del><ins>+def webkitBuildDirectoryForConfigurationAndPlatform(configuration, platform, fullPlatform='', returnTopLevelDirectory=False):
</ins><span class="cx">     if fullPlatform.startswith('ios-simulator'):
</span><span class="cx">         platform = 'ios-simulator'
</span><span class="cx">     elif platform == 'ios':
</span><span class="cx">         platform = 'device'
</span><span class="cx">     command = ['perl', os.path.join(os.path.dirname(__file__), '..', 'Scripts', 'webkit-build-directory'), '--' + platform, '--' + configuration]
</span><del>-    _configurationBuildDirectory = subprocess.Popen(command + ['--configuration'], stdout=subprocess.PIPE).communicate()[0].strip()
-    _topLevelBuildDirectory = subprocess.Popen(command + ['--top-level'], stdout=subprocess.PIPE).communicate()[0].strip()
</del><ins>+    if returnTopLevelDirectory:
+        command += ['--top-level']
+    else:
+        command += ['--configuration']
+    return subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0].strip()
+
+
+def determineWebKitBuildDirectories(platform, fullPlatform, configuration):
+    global _configurationBuildDirectory
+    global _topLevelBuildDirectory
+    _configurationBuildDirectory = webkitBuildDirectoryForConfigurationAndPlatform(configuration, platform, fullPlatform)
+    _topLevelBuildDirectory = webkitBuildDirectoryForConfigurationAndPlatform(configuration, platform, fullPlatform, returnTopLevelDirectory=True)
</ins><span class="cx">     return _topLevelBuildDirectory
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -100,7 +108,7 @@
</span><span class="cx">     archiveZip.close()
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-def createZip(directoryToZip, configuration):
</del><ins>+def createZip(directoryToZip, configuration, embedParentDirectoryNameOnDarwin=False):
</ins><span class="cx">     archiveDir = os.path.abspath(os.path.join(os.path.dirname(__file__), &quot;..&quot;, &quot;..&quot;, &quot;WebKitBuild&quot;))
</span><span class="cx">     archiveFile = os.path.join(archiveDir, configuration + &quot;.zip&quot;)
</span><span class="cx"> 
</span><span class="lines">@@ -111,7 +119,11 @@
</span><span class="cx">             raise
</span><span class="cx"> 
</span><span class="cx">     if sys.platform == 'darwin':
</span><del>-        return subprocess.call([&quot;ditto&quot;, &quot;-c&quot;, &quot;-k&quot;, &quot;--keepParent&quot;, &quot;--sequesterRsrc&quot;, directoryToZip, archiveFile])
</del><ins>+        command = ['ditto', '-c', '-k', '--sequesterRsrc']
+        if embedParentDirectoryNameOnDarwin:
+            command += ['--keepParent']
+        command += [directoryToZip, archiveFile]
+        return subprocess.call(command)
</ins><span class="cx">     elif sys.platform == 'cygwin':
</span><span class="cx">         return subprocess.call([&quot;zip&quot;, &quot;-r&quot;, archiveFile, &quot;bin32&quot;], cwd=directoryToZip)
</span><span class="cx">     elif sys.platform == 'win32':
</span><span class="lines">@@ -121,11 +133,33 @@
</span><span class="cx">         return subprocess.call([&quot;zip&quot;, &quot;-y&quot;, &quot;-r&quot;, archiveFile, &quot;.&quot;], cwd=directoryToZip)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-def archiveBuiltProduct(configuration, platform):
</del><ins>+def archiveBuiltProduct(configuration, platform, fullPlatform):
</ins><span class="cx">     assert platform in ('mac', 'win', 'gtk', 'efl', 'ios')
</span><span class="cx"> 
</span><del>-    if platform in ('mac', 'ios'):
-        return createZip(_configurationBuildDirectory, configuration)
</del><ins>+    if fullPlatform.startswith('ios-simulator'):
+        # We need to include in the archive the Mac tool, LayoutTestRelay, to run layout tests in the iOS simulator.
+        combinedDirectory = os.path.join(_topLevelBuildDirectory, 'combined-mac-and-ios')
+        removeDirectoryIfExists(combinedDirectory)
+        os.makedirs(combinedDirectory)
+
+        if subprocess.call(['/bin/cp', '-pR', _configurationBuildDirectory, combinedDirectory]):
+            return 1
+
+        macBuildDirectory = webkitBuildDirectoryForConfigurationAndPlatform(configuration, 'mac')
+        destinationDirectory = os.path.join(combinedDirectory, os.path.relpath(macBuildDirectory, _topLevelBuildDirectory))
+        os.makedirs(destinationDirectory)
+        for filename in ['LayoutTestRelay', 'LayoutTestRelay.dSYM']:
+            sourceFile = os.path.join(macBuildDirectory, filename)
+            if not os.path.exists(sourceFile):
+                continue
+            if subprocess.call(['/bin/cp', '-pR', sourceFile, destinationDirectory]):
+                return 1
+
+        if createZip(combinedDirectory, configuration):
+            return 1
+        shutil.rmtree(combinedDirectory)
+    elif platform in ('mac', 'ios'):
+        return createZip(_configurationBuildDirectory, configuration, embedParentDirectoryNameOnDarwin=True)
</ins><span class="cx">     elif platform == 'win':
</span><span class="cx">         # FIXME: We shouldn't hardcode the assumption of a 32-bit build. See &lt;https://bugs.webkit.org/show_bug.cgi?id=149715&gt;.
</span><span class="cx">         binDirectory = os.path.join(_configurationBuildDirectory, 'bin32')
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (190514 => 190515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-10-02 19:36:32 UTC (rev 190514)
+++ trunk/Tools/ChangeLog        2015-10-02 19:43:09 UTC (rev 190515)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2015-10-02  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        LayoutTestRelay is not built and archived when building for iOS Simulator
+        https://bugs.webkit.org/show_bug.cgi?id=149753
+
+        Reviewed by Alexey Proskuryakov and Andy Estes.
+
+        Towards running layout tests on the iOS Simulator test bots, we need to teach scripts build-webkit
+        and built-product-archive to build the Mac tool LayoutTestRelay and include this tool in the built
+        product archive when building for iOS Simulator, respectively.
+
+        * BuildSlaveSupport/built-product-archive:
+        (main): Pass the full platform name (options.platform) to archiveBuiltProduct() so that it can
+        differentiate between iOS device and iOS Simulator platforms.
+        (webkitBuildDirectoryForConfigurationAndPlatform): Extracted logic to run the script webkit-build-directory
+        from determineWebKitBuildDirectories() into this function so that it can be used by both
+        determineWebKitBuildDirectories() and archiveBuiltProduct().
+        (determineWebKitBuildDirectories): Moved logic to execute the script webkit-build-directory from here to
+        webkitBuildDirectoryForConfigurationAndPlatform().
+        (createZip): Added parameter embedParentDirectoryNameOnDarwin (defaults to False) to specify whether
+        we should call ditto(1) with --keepParent to embed the parent directory name in the zip archive. This
+        argument is only applicable when building on Darwin. We only pass embedParentDirectoryNameOnDarwin=True
+        when making an archive for a Mac or iOS device build. For iOS Simulator builds we archive two directories
+        and we do not want to keep the parent directory because it is a placeholder directory used as a workaround
+        for the limitation that ditto(1) can only accept a single directory to archive on its command line.
+        (archiveBuiltProduct): Modified to take the full platform name as an argument. Added logic for iOS.
+        For iOS device builds we use the same logic as for a Mac build and archive the configuration-specific
+        build directory. For iOS Simulator builds we archive the configuration-specific iOS build directory,
+        LayoutTestRelay and LayoutTestRelay.dSYM (if it exists) from the configuration-specific Mac build.
+        * Scripts/build-layouttestrelay:
+            - Remove unnecessary include of Perl module POSIX.
+            - Only build LayoutTestRelay when building for iOS Simulator (i.e. --ios-simulator is passed).
+        * Scripts/build-webkit:
+            - Invoke script build-layouttestrelay when building for iOS Simulator.
+
</ins><span class="cx"> 2015-10-02  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Unreviewed test fix.
</span></span></pre></div>
<a id="trunkToolsScriptsbuildlayouttestrelay"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/build-layouttestrelay (190514 => 190515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/build-layouttestrelay        2015-10-02 19:36:32 UTC (rev 190514)
+++ trunk/Tools/Scripts/build-layouttestrelay        2015-10-02 19:43:09 UTC (rev 190515)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #!/usr/bin/perl -w
</span><span class="cx"> 
</span><del>-# Copyright (C) 2014 Apple Inc. All rights reserved.
</del><ins>+# Copyright (C) 2014-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> use Getopt::Long qw(:config pass_through);
</span><span class="cx"> use lib $FindBin::Bin;
</span><span class="cx"> use webkitdirs;
</span><del>-use POSIX;
</del><span class="cx"> 
</span><span class="cx"> my $showHelp = 0;
</span><span class="cx"> my $clean = 0;
</span><span class="lines">@@ -57,10 +56,10 @@
</span><span class="cx"> 
</span><span class="cx"> chdir &quot;Tools/LayoutTestRelay&quot; or die;
</span><span class="cx"> 
</span><del>-if (isAppleMacWebKit()) {
-    $result = buildXCodeProject(&quot;LayoutTestRelay&quot;, $clean, XcodeOptions(), @ARGV);
-} else {
-    die &quot;WebKitTestRunner is not supported on this platform.\n&quot;;
</del><ins>+if (isIOSWebKit() &amp;&amp; willUseIOSSimulatorSDKWhenBuilding()) {
+    setXcodeSDK(undef); # Force use of Mac SDK
+    exit exitStatus(buildXCodeProject(&quot;LayoutTestRelay&quot;, $clean, XcodeOptions(), @ARGV));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-exit exitStatus($result);
</del><ins>+print STDERR &quot;LayoutTestRelay is only supported for iOS Simulator.\n&quot;;
+exit 1;
</ins></span></pre></div>
<a id="trunkToolsScriptsbuildwebkit"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/build-webkit (190514 => 190515)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/build-webkit        2015-10-02 19:36:32 UTC (rev 190514)
+++ trunk/Tools/Scripts/build-webkit        2015-10-02 19:43:09 UTC (rev 190515)
</span><span class="lines">@@ -201,6 +201,10 @@
</span><span class="cx">         );
</span><span class="cx">         print(join(&quot; &quot;, @copyLibrariesArgs) . &quot;\n&quot;);
</span><span class="cx">         (system(@copyLibrariesArgs) == 0) or die;
</span><ins>+
+        if (willUseIOSSimulatorSDKWhenBuilding()) {
+            (system(&quot;perl&quot;, &quot;Tools/Scripts/build-layouttestrelay&quot;, argumentsForConfiguration()) == 0) or die;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # Build Tools needed for Apple ports
</span></span></pre>
</div>
</div>

</body>
</html>