- Revision
- 276355
- Author
- [email protected]
- Date
- 2021-04-21 02:57:13 -0700 (Wed, 21 Apr 2021)
Log Message
[WPE] Allow defining custom repo and branch for Cog checkout
https://bugs.webkit.org/show_bug.cgi?id=224739
Reviewed by Philippe Normand.
Use cmake args "-DWPE_COG_REPO=<repo>" and "-DWPE_COG_TAG=<tag>" to
build different cog versions without having to edit the cmake files.
There might be the need to wipe the checked-out dir from time to time,
as only CMake 3.18 introduced different checkout strategies. Previous
cmakes try to rebase the previously checked out branch which might
lead to conflicts.
This commit also allows selecting between Cog and MiniBrowser with the
WPE_BROWSER envvar.
* PlatformWPE.cmake:
* Scripts/webkitpy/port/wpe.py:
(WPEPort.cog_path):
(WPEPort):
(WPEPort.browser_name):
(WPEPort.run_minibrowser):
* Scripts/webkitpy/port/wpe_unittest.py:
(WPEPortTest.test_default_upload_configuration):
(WPEPortTest):
(WPEPortTest.test_browser_name_default):
(WPEPortTest.test_browser_name_with_cog_built):
(WPEPortTest.test_browser_name_override_minibrowser_with_cog_built):
(WPEPortTest.test_browser_name_override_cog_without_cog_built):
(WPEPortTest.test_browser_name_override_unknown):
* Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py:
(WebDriverWPE.browser_name): Make it cog-aware.
(WebDriverWPE.browser_path): Ditto.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (276354 => 276355)
--- trunk/Tools/ChangeLog 2021-04-21 09:38:17 UTC (rev 276354)
+++ trunk/Tools/ChangeLog 2021-04-21 09:57:13 UTC (rev 276355)
@@ -1,3 +1,39 @@
+2021-04-21 Lauro Moura <[email protected]>
+
+ [WPE] Allow defining custom repo and branch for Cog checkout
+ https://bugs.webkit.org/show_bug.cgi?id=224739
+
+ Reviewed by Philippe Normand.
+
+ Use cmake args "-DWPE_COG_REPO=<repo>" and "-DWPE_COG_TAG=<tag>" to
+ build different cog versions without having to edit the cmake files.
+
+ There might be the need to wipe the checked-out dir from time to time,
+ as only CMake 3.18 introduced different checkout strategies. Previous
+ cmakes try to rebase the previously checked out branch which might
+ lead to conflicts.
+
+ This commit also allows selecting between Cog and MiniBrowser with the
+ WPE_BROWSER envvar.
+
+ * PlatformWPE.cmake:
+ * Scripts/webkitpy/port/wpe.py:
+ (WPEPort.cog_path):
+ (WPEPort):
+ (WPEPort.browser_name):
+ (WPEPort.run_minibrowser):
+ * Scripts/webkitpy/port/wpe_unittest.py:
+ (WPEPortTest.test_default_upload_configuration):
+ (WPEPortTest):
+ (WPEPortTest.test_browser_name_default):
+ (WPEPortTest.test_browser_name_with_cog_built):
+ (WPEPortTest.test_browser_name_override_minibrowser_with_cog_built):
+ (WPEPortTest.test_browser_name_override_cog_without_cog_built):
+ (WPEPortTest.test_browser_name_override_unknown):
+ * Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py:
+ (WebDriverWPE.browser_name): Make it cog-aware.
+ (WebDriverWPE.browser_path): Ditto.
+
2021-04-21 Tim Horton <[email protected]>
Long-pressing a data detectors link causes the link to be followed
Modified: trunk/Tools/PlatformWPE.cmake (276354 => 276355)
--- trunk/Tools/PlatformWPE.cmake 2021-04-21 09:38:17 UTC (rev 276354)
+++ trunk/Tools/PlatformWPE.cmake 2021-04-21 09:57:13 UTC (rev 276355)
@@ -19,8 +19,17 @@
if (DEVELOPER_MODE AND ENABLE_COG)
include(ExternalProject)
+ if ("${WPE_COG_REPO}" STREQUAL "")
+ set(WPE_COG_REPO "https://github.com/Igalia/cog.git")
+ endif ()
+ if ("${WPE_COG_TAG}" STREQUAL "")
+ set(WPE_COG_TAG "origin/master")
+ endif ()
+ # TODO Use GIT_REMOTE_UPDATE_STRATEGY with 3.18 to allow switching between
+ # conflicting branches without having to delete the repo
ExternalProject_Add(cog
- GIT_REPOSITORY "https://github.com/Igalia/cog.git"
+ GIT_REPOSITORY "${WPE_COG_REPO}"
+ GIT_TAG "${WPE_COG_TAG}"
SOURCE_DIR "${CMAKE_SOURCE_DIR}/Tools/wpe/cog"
CMAKE_ARGS "-DCOG_PLATFORM_GTK4=ON"
INSTALL_COMMAND "")
Modified: trunk/Tools/Scripts/webkitpy/port/wpe.py (276354 => 276355)
--- trunk/Tools/Scripts/webkitpy/port/wpe.py 2021-04-21 09:38:17 UTC (rev 276354)
+++ trunk/Tools/Scripts/webkitpy/port/wpe.py 2021-04-21 09:57:13 UTC (rev 276355)
@@ -149,19 +149,46 @@
configuration['platform'] = 'WPE'
return configuration
+ def cog_path(self):
+ return self._build_path('Tools', 'cog-prefix', 'src', 'cog-build', 'cog')
+
+ def browser_name(self):
+ """Returns the lower case name of the browser to be used (Cog or MiniBrowser)
+
+ Users can select between both with the environment variable WPE_BROWSER
+ """
+ browser = os.environ.get("WPE_BROWSER", "").lower()
+ if browser in ("cog", "minibrowser"):
+ return browser
+
+ if browser:
+ print("Unknown browser {}. Defaulting to Cog and MiniBrowser selection".format(browser))
+
+ if self._filesystem.isfile(self.cog_path()):
+ return "cog"
+ return "minibrowser"
+
def run_minibrowser(self, args):
env = None
- cog = self._build_path('Tools', 'cog-prefix', 'src', 'cog-build', 'cog')
- if self._filesystem.isfile(cog):
- miniBrowser = cog
- env = os.environ.copy()
- env.update({'WEBKIT_EXEC_PATH': self._build_path('bin'),
- 'WEBKIT_INJECTED_BUNDLE_PATH': self._build_path('lib')})
- has_platform_arg = any((a == "-P" or a.startswith("--platform=") for a in args))
- if not has_platform_arg:
- args.insert(0, "--platform=gtk4")
- else:
- print("Cog not found 😢. If you wish to enable it, rebuild with `-DENABLE_COG=ON`. Falling back to good old MiniBrowser")
+ browser_name = self.browser_name()
+ miniBrowser = None
+
+ if browser_name == "cog":
+ miniBrowser = self.cog_path()
+ if not self._filesystem.isfile(miniBrowser):
+ print("Cog not found 😢. If you wish to enable it, rebuild with `-DENABLE_COG=ON`. Falling back to good old MiniBrowser")
+ miniBrowser = None
+ else:
+ print("Using Cog as MiniBrowser")
+ env = os.environ.copy()
+ env.update({'WEBKIT_EXEC_PATH': self._build_path('bin'),
+ 'WEBKIT_INJECTED_BUNDLE_PATH': self._build_path('lib')})
+ has_platform_arg = any((a == "-P" or a.startswith("--platform=") for a in args))
+ if not has_platform_arg:
+ args.insert(0, "--platform=gtk4")
+
+ if not miniBrowser:
+ print("Using default MiniBrowser")
miniBrowser = self._build_path('bin', 'MiniBrowser')
if not self._filesystem.isfile(miniBrowser):
print("%s not found... Did you run build-webkit?" % miniBrowser)
Modified: trunk/Tools/Scripts/webkitpy/port/wpe_unittest.py (276354 => 276355)
--- trunk/Tools/Scripts/webkitpy/port/wpe_unittest.py 2021-04-21 09:38:17 UTC (rev 276354)
+++ trunk/Tools/Scripts/webkitpy/port/wpe_unittest.py 2021-04-21 09:57:13 UTC (rev 276355)
@@ -36,7 +36,7 @@
from webkitpy.port.config import clear_cached_configuration
from webkitpy.port.wpe import WPEPort
from webkitpy.port import port_testcase
-from webkitpy.thirdparty.mock import Mock
+from webkitpy.thirdparty.mock import Mock, patch
from webkitpy.tool.mocktool import MockOptions
@@ -77,3 +77,32 @@
self.assertEqual(configuration['is_simulator'], False)
self.assertEqual(configuration['platform'], 'WPE')
self.assertEqual(configuration['style'], 'release')
+
+ def test_browser_name_default(self):
+ port = self.make_port()
+ self.assertEqual(port.browser_name(), "minibrowser")
+
+ def test_browser_name_with_cog_built(self):
+ port = self.make_port()
+ port._filesystem = MockFileSystem({
+ "/mock-build/Tools/cog-prefix/src/cog-build/cog": "",
+ })
+ self.assertEqual(port.browser_name(), "cog")
+
+ def test_browser_name_override_minibrowser_with_cog_built(self):
+ with patch('os.environ', {'WPE_BROWSER': 'MiniBrowser'}):
+ port = self.make_port()
+ port._filesystem = MockFileSystem({
+ "/mock-build/Tools/cog-prefix/src/cog-build/cog": "",
+ })
+ self.assertEqual(port.browser_name(), "minibrowser")
+
+ def test_browser_name_override_cog_without_cog_built(self):
+ with patch('os.environ', {'WPE_BROWSER': 'Cog'}):
+ port = self.make_port()
+ self.assertEqual(port.browser_name(), "cog")
+
+ def test_browser_name_override_unknown(self):
+ with patch('os.environ', {'WPE_BROWSER': 'Mosaic'}):
+ port = self.make_port()
+ self.assertEqual(port.browser_name(), "minibrowser")
Modified: trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py (276354 => 276355)
--- trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py 2021-04-21 09:38:17 UTC (rev 276354)
+++ trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py 2021-04-21 09:57:13 UTC (rev 276355)
@@ -32,9 +32,11 @@
return self._port._build_path('bin', 'WPEWebDriver')
def browser_name(self):
- return 'MiniBrowser'
+ return self._port.browser_name()
def browser_path(self):
+ if self._port.browser_name() == "cog":
+ return self._port.cog_path()
return self._port._build_path('bin', 'MiniBrowser')
def browser_args(self):