Title: [279563] trunk/Tools
Revision
279563
Author
[email protected]
Date
2021-07-05 01:25:09 -0700 (Mon, 05 Jul 2021)

Log Message

[GTK] Pack header and .pc files in the built-product archive
https://bugs.webkit.org/show_bug.cgi?id=227526

Patch by Philippe Normand <[email protected]> on 2021-07-05
Reviewed by Michael Catanzaro.

The header files and pkg-config files needed to build WebKitGTK apps are now included in the
built product zip file. As they're text files the impact on the zip size should not be
significant. In order to support this, two changes are introduced for the GTK build bot:

- build-webkit is now called with a --prefix option
- a new build step has been added, which installs the built files in the given prefix directory

Then built-product-archive can simply pack files from the install prefix directory.

Additionally the .a (potentially big) files are now excluded from the zip archive.

* CISupport/build-webkit-org/factories.py:
(BuildFactory.__init__):
* CISupport/build-webkit-org/steps.py:
(CompileWebKit.start):
(InstallBuiltProduct):
* CISupport/built-product-archive:
* Scripts/install-built-product: Added.

Modified Paths

Added Paths

Property Changed

Diff

Modified: trunk/Tools/CISupport/build-webkit-org/factories.py (279562 => 279563)


--- trunk/Tools/CISupport/build-webkit-org/factories.py	2021-07-05 05:54:12 UTC (rev 279562)
+++ trunk/Tools/CISupport/build-webkit-org/factories.py	2021-07-05 08:25:09 UTC (rev 279563)
@@ -63,6 +63,9 @@
             self.addStep(GenerateMiniBrowserBundle())
 
         if triggers:
+            if platform == "gtk":
+                self.addStep(InstallBuiltProduct())
+
             self.addStep(ArchiveBuiltProduct())
             self.addStep(UploadBuiltProduct())
             if platform.startswith('mac') or platform.startswith('ios-simulator') or platform.startswith('tvos-simulator') or platform.startswith('watchos-simulator'):

Modified: trunk/Tools/CISupport/build-webkit-org/steps.py (279562 => 279563)


--- trunk/Tools/CISupport/build-webkit-org/steps.py	2021-07-05 05:54:12 UTC (rev 279562)
+++ trunk/Tools/CISupport/build-webkit-org/steps.py	2021-07-05 08:25:09 UTC (rev 279563)
@@ -289,6 +289,9 @@
             # this much faster than full debug info, and crash logs still have line numbers.
             self.setCommand(self.command + ['DEBUG_INFORMATION_FORMAT=dwarf-with-dsym'])
             self.setCommand(self.command + ['CLANG_DEBUG_INFORMATION_LEVEL=line-tables-only'])
+        if platform == 'gtk':
+            prefix = os.path.join("/app", "webkit", "WebKitBuild", self.getProperty("configuration"), "install")
+            self.setCommand(self.command + [f'--prefix={prefix}'])
 
         appendCustomBuildFlags(self, platform, self.getProperty('fullPlatform'))
 
@@ -321,6 +324,10 @@
     command = ["perl", "./Tools/Scripts/build-jsc", WithProperties("--%(configuration)s")]
 
 
+class InstallBuiltProduct(shell.ShellCommand):
+    command = ["python3", "Tools/Scripts/install-built-product",
+               WithProperties("--platform=%(fullPlatform)s"), WithProperties("--%(configuration)s")]
+
 class ArchiveBuiltProduct(shell.ShellCommand):
     command = ["python3", "Tools/CISupport/built-product-archive",
                WithProperties("--platform=%(fullPlatform)s"), WithProperties("--%(configuration)s"), "archive"]

Modified: trunk/Tools/CISupport/build-webkit-org/steps_unittest.py (279562 => 279563)


--- trunk/Tools/CISupport/build-webkit-org/steps_unittest.py	2021-07-05 05:54:12 UTC (rev 279562)
+++ trunk/Tools/CISupport/build-webkit-org/steps_unittest.py	2021-07-05 08:25:09 UTC (rev 279563)
@@ -420,7 +420,7 @@
                 workdir='wkdir',
                 timeout=1200,
                 logEnviron=True,
-                command=['perl', './Tools/Scripts/build-webkit', '--release', '--gtk'],
+                command=['perl', './Tools/Scripts/build-webkit', '--release', '--prefix=/app/webkit/WebKitBuild/release/install', '--gtk'],
             ) + 0,
         )
         self.expectOutcome(result=SUCCESS, state_string='compiled')

Modified: trunk/Tools/CISupport/built-product-archive (279562 => 279563)


--- trunk/Tools/CISupport/built-product-archive	2021-07-05 05:54:12 UTC (rev 279562)
+++ trunk/Tools/CISupport/built-product-archive	2021-07-05 08:25:09 UTC (rev 279563)
@@ -110,7 +110,7 @@
     shutil.copytree(source, destination, ignore=shutil.ignore_patterns(*patterns))
 
 
-def createZipFromList(listToZip, configuration, excludePattern=None):
+def createZipFromList(listToZip, configuration, excludePatterns=None):
     global _topLevelBuildDirectory
     global _configurationBuildDirectory
     archiveDir = _topLevelBuildDirectory
@@ -124,8 +124,9 @@
 
     if sys.platform.startswith('linux'):
         zipCommand = ['zip', '-y', '-r', archiveFile] + listToZip
-        if excludePattern:
-            zipCommand += ['-x', excludePattern]
+        if excludePatterns:
+            for excludePattern in excludePatterns:
+                zipCommand += ['-x', excludePattern]
         return subprocess.call(zipCommand, cwd=_configurationBuildDirectory)
 
     raise NotImplementedError('Unsupported platform: {platform}'.format(platform=sys.platform))
@@ -251,6 +252,9 @@
                 if filename.startswith('libcogcore'):
                     contents.append(os.path.join(cogDirectory, filename))
 
+        if platform == 'gtk':
+            contents.extend([os.path.join('install', directory) for directory in ['include', os.path.join('lib', 'pkgconfig')]])
+
         # When debug fission is enabled the directories below contain dwo files
         # with the debug information needed to generate backtraces with GDB.
         for objectDir in ['Tools', 'Source']:
@@ -257,7 +261,7 @@
             if dirContainsdwo(objectDir):
                 contents.append(objectDir)
 
-        if createZipFromList(contents, configuration, excludePattern='*.o'):
+        if createZipFromList(contents, configuration, excludePatterns=['*.o', '*.a']):
             return 1
 
 def unzipArchive(directoryToExtractTo, configuration):
Property changes on: trunk/Tools/CISupport/built-product-archive
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: trunk/Tools/CISupport/ews-build/factories.py (279562 => 279563)


--- trunk/Tools/CISupport/ews-build/factories.py	2021-07-05 05:54:12 UTC (rev 279562)
+++ trunk/Tools/CISupport/ews-build/factories.py	2021-07-05 08:25:09 UTC (rev 279563)
@@ -32,7 +32,8 @@
                    RunEWSUnitTests, RunResultsdbpyTests, RunJavaScriptCoreTests, RunWebKit1Tests, RunWebKitPerlTests, RunWebKitPyPython2Tests,
                    RunWebKitPyPython3Tests, RunWebKitTests, RunWebKitTestsInStressMode, RunWebKitTestsInStressGuardmallocMode,
                    SetBuildSummary, ShowIdentifier, TriggerCrashLogSubmission, UpdateWorkingDirectory,
-                   ValidatePatch, ValidateChangeLogAndReviewer, ValidateCommiterAndReviewer, WaitForCrashCollection)
+                   ValidatePatch, ValidateChangeLogAndReviewer, ValidateCommiterAndReviewer, WaitForCrashCollection,
+                   InstallBuiltProduct)
 
 
 class Factory(factory.BuildFactory):
@@ -114,6 +115,8 @@
         if platform == 'gtk':
             self.addStep(InstallGtkDependencies())
         self.addStep(CompileWebKit(skipUpload=self.skipUpload))
+        if platform == 'gtk':
+            self.addStep(InstallBuiltProduct())
 
 
 class TestFactory(Factory):

Modified: trunk/Tools/CISupport/ews-build/factories_unittest.py (279562 => 279563)


--- trunk/Tools/CISupport/ews-build/factories_unittest.py	2021-07-05 05:54:12 UTC (rev 279562)
+++ trunk/Tools/CISupport/ews-build/factories_unittest.py	2021-07-05 08:25:09 UTC (rev 279563)
@@ -312,6 +312,7 @@
             _BuildStepFactory(steps.KillOldProcesses),
             _BuildStepFactory(steps.InstallGtkDependencies),
             _BuildStepFactory(steps.CompileWebKit, skipUpload=False),
+            _BuildStepFactory(steps.InstallBuiltProduct),
         ])
 
     def test_wpe_factory(self):

Modified: trunk/Tools/CISupport/ews-build/steps.py (279562 => 279563)


--- trunk/Tools/CISupport/ews-build/steps.py	2021-07-05 05:54:12 UTC (rev 279562)
+++ trunk/Tools/CISupport/ews-build/steps.py	2021-07-05 08:25:09 UTC (rev 279563)
@@ -1559,6 +1559,9 @@
             # this much faster than full debug info, and crash logs still have line numbers.
             self.setCommand(self.command + ['DEBUG_INFORMATION_FORMAT=dwarf-with-dsym'])
             self.setCommand(self.command + ['CLANG_DEBUG_INFORMATION_LEVEL=line-tables-only'])
+        if platform == 'gtk':
+            prefix = os.path.join("/app", "webkit", "WebKitBuild", self.getProperty("configuration"), "install")
+            self.setCommand(self.command + [f'--prefix={prefix}'])
 
         appendCustomBuildFlags(self, platform, self.getProperty('fullPlatform'))
 
@@ -2030,6 +2033,10 @@
             print('Error in sending email for pre-existing failure: {}'.format(e))
 
 
+class InstallBuiltProduct(shell.ShellCommand):
+    command = ["python3", "Tools/Scripts/install-built-product",
+               WithProperties("--platform=%(fullPlatform)s"), WithProperties("--%(configuration)s")]
+
 class CleanBuild(shell.Compile):
     name = 'delete-WebKitBuild-directory'
     description = ['deleting WebKitBuild directory']

Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (279562 => 279563)


--- trunk/Tools/CISupport/ews-build/steps_unittest.py	2021-07-05 05:54:12 UTC (rev 279562)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py	2021-07-05 08:25:09 UTC (rev 279563)
@@ -1079,7 +1079,7 @@
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
                         logEnviron=False,
-                        command=['perl', 'Tools/Scripts/build-webkit', '--release', '--gtk'],
+                        command=['perl', 'Tools/Scripts/build-webkit', '--release', '--prefix=/app/webkit/WebKitBuild/release/install', '--gtk'],
                         )
             + 0,
         )

Modified: trunk/Tools/ChangeLog (279562 => 279563)


--- trunk/Tools/ChangeLog	2021-07-05 05:54:12 UTC (rev 279562)
+++ trunk/Tools/ChangeLog	2021-07-05 08:25:09 UTC (rev 279563)
@@ -1,3 +1,29 @@
+2021-07-05  Philippe Normand  <[email protected]>
+
+        [GTK] Pack header and .pc files in the built-product archive
+        https://bugs.webkit.org/show_bug.cgi?id=227526
+
+        Reviewed by Michael Catanzaro.
+
+        The header files and pkg-config files needed to build WebKitGTK apps are now included in the
+        built product zip file. As they're text files the impact on the zip size should not be
+        significant. In order to support this, two changes are introduced for the GTK build bot:
+
+        - build-webkit is now called with a --prefix option
+        - a new build step has been added, which installs the built files in the given prefix directory
+
+        Then built-product-archive can simply pack files from the install prefix directory.
+
+        Additionally the .a (potentially big) files are now excluded from the zip archive.
+
+        * CISupport/build-webkit-org/factories.py:
+        (BuildFactory.__init__):
+        * CISupport/build-webkit-org/steps.py:
+        (CompileWebKit.start):
+        (InstallBuiltProduct):
+        * CISupport/built-product-archive:
+        * Scripts/install-built-product: Added.
+
 2021-07-04  Wenson Hsieh  <[email protected]>
 
         [iOS] Augment -_webView:didNotHandleTapAsMeaningfulClickAtPoint: to include meaningful taps

Added: trunk/Tools/Scripts/install-built-product (0 => 279563)


--- trunk/Tools/Scripts/install-built-product	                        (rev 0)
+++ trunk/Tools/Scripts/install-built-product	2021-07-05 08:25:09 UTC (rev 279563)
@@ -0,0 +1,66 @@
+#!/usr/bin/env python3
+# Copyright (C) 2021, Igalia S.L
+#
+# 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 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 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 optparse
+import os
+import subprocess
+import sys
+
+if sys.platform.startswith('linux'):
+    top_level_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
+    sys.path.insert(0, os.path.join(top_level_directory, 'Tools', 'flatpak'))
+    sys.path.insert(1, os.path.join(top_level_directory, 'Tools', 'Scripts'))
+
+    import flatpakutils
+    flatpakutils.run_in_sandbox_if_available(sys.argv)
+
+def main():
+    parser = optparse.OptionParser()
+    parser.add_option("--platform")
+    parser.add_option("--debug", action="" const="debug", dest="configuration")
+    parser.add_option("--release", action="" const="release", dest="configuration")
+
+    options, parameters = parser.parse_args()
+    if not options.platform:
+        parser.error("Platform is required")
+        return -1
+    if not options.configuration:
+        parser.error("Configuration is required")
+        return -2
+
+    platform = options.platform.split('-', 1)[0]
+
+    webkit_build_directory = subprocess.Popen(['perl', os.path.join(os.path.dirname(__file__), "webkit-build-directory"),
+        "--" + platform, "--" + options.configuration, '--configuration'], stdout=subprocess.PIPE).communicate()[0].strip()
+
+    if platform == 'gtk':
+        result = subprocess.run(["cmake", "--install", webkit_build_directory]).returncode
+    else:
+        parser.error(f"Platform {platform} is not supported yet")
+        return -3
+
+    return result
+
+if __name__ == '__main__':
+    sys.exit(main())
Property changes on: trunk/Tools/Scripts/install-built-product
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to