Add a WinCairo EWS queue
[WebKit-https.git] / Tools / Scripts / webkitpy / common / config / ports.py
1 # Copyright (C) 2009, Google Inc. All rights reserved.
2 # Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
3 # Copyright (C) 2015, 2017 Apple Inc. All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
8 #
9 #     * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 #     * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
14 # distribution.
15 #     * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #
31 # WebKit's Python module for understanding the various ports
32
33 import os
34 import platform
35 import sys
36
37 from webkitpy.common.system.executive import Executive
38
39
40 class DeprecatedPort(object):
41     results_directory = "/tmp/layout-test-results"
42
43     # Subclasses must override
44     port_flag_name = None
45
46     # FIXME: This is only used by BotInfo.
47     def name(self):
48         return self.__class__
49
50     def flag(self):
51         if self.port_flag_name:
52             return "--port=%s" % self.port_flag_name
53         return None
54
55     # We might need to pass scm into this function for scm.checkout_root
56     def script_path(self, script_name):
57         return os.path.join("Tools", "Scripts", script_name)
58
59     def script_shell_command(self, script_name):
60         script_path = self.script_path(script_name)
61         return Executive.shell_command_for_script(script_path)
62
63     @staticmethod
64     def port(port_name):
65         ports = {
66             "gtk-wk2": GtkWK2Port,
67             "ios-device": IOSPort,
68             # FIXME: https://bugs.webkit.org/show_bug.cgi?id=169302
69             "ios": IOSPort,
70             "ios-simulator-wk2": IOSSimulatorWK2Port,
71             "mac": MacPort,
72             "mac-wk2": MacWK2Port,
73             "win": WinPort,
74             "wincairo": WinCairoPort,
75             "wpe": WpePort,
76         }
77         default_port = {
78             "Windows": WinPort,
79             "Darwin": MacPort,
80         }
81         # Do we really need MacPort as the ultimate default?
82         return ports.get(port_name, default_port.get(platform.system(), MacPort))()
83
84     def makeArgs(self):
85         # FIXME: This shouldn't use a static Executive().
86         args = '--makeargs="-j%s"' % Executive().cpu_count()
87         if os.environ.has_key('MAKEFLAGS'):
88             args = '--makeargs="%s"' % os.environ['MAKEFLAGS']
89         return args
90
91     def update_webkit_command(self, non_interactive=False):
92         return self.script_shell_command("update-webkit")
93
94     def check_webkit_style_command(self):
95         return self.script_shell_command("check-webkit-style")
96
97     def prepare_changelog_command(self):
98         return self.script_shell_command("prepare-ChangeLog")
99
100     def _append_build_style_flag(self, command, build_style):
101         if build_style == "debug":
102             command.append("--debug")
103         elif build_style == "release":
104             command.append("--release")
105         return command
106
107     def build_webkit_command(self, build_style=None):
108         command = self.script_shell_command("build-webkit")
109         return self._append_build_style_flag(command, build_style)
110
111     def build_jsc_command(self, build_style=None):
112         command = self.script_shell_command("build-jsc")
113         return self._append_build_style_flag(command, build_style)
114
115     def run_javascriptcore_tests_command(self, build_style=None):
116         command = self.script_shell_command("run-javascriptcore-tests")
117         command.append("--no-fail-fast")
118         return self._append_build_style_flag(command, build_style)
119
120     def run_webkit_tests_command(self, build_style=None):
121         command = self.script_shell_command("run-webkit-tests")
122         return self._append_build_style_flag(command, build_style)
123
124     def run_python_unittests_command(self):
125         return self.script_shell_command("test-webkitpy")
126
127     def run_perl_unittests_command(self):
128         return self.script_shell_command("test-webkitperl")
129
130     def run_bindings_tests_command(self):
131         return self.script_shell_command("run-bindings-tests")
132
133     def run_api_tests_command(self, build_style=None):
134         command = self.script_shell_command("run-api-tests")
135         return self._append_build_style_flag(command, build_style)
136
137     def run_sort_xcode_project_file_command(self):
138         return self.script_shell_command("sort-Xcode-project-file")
139
140
141 class IOSPort(DeprecatedPort):
142     port_flag_name = "ios-device"
143
144     def build_webkit_command(self, build_style=None):
145         command = super(IOSPort, self).build_webkit_command(build_style=build_style)
146         command.append("--sdk=iphoneos")
147         return command
148
149
150 class IOSSimulatorWK2Port(DeprecatedPort):
151     port_flag_name = "ios-simulator-wk2"
152
153     def build_webkit_command(self, build_style=None):
154         command = super(IOSSimulatorWK2Port, self).build_webkit_command(build_style=build_style)
155         command.append("--sdk=iphonesimulator")
156         return command
157
158     def run_webkit_tests_command(self, build_style=None):
159         command = super(IOSSimulatorWK2Port, self).run_webkit_tests_command(build_style)
160         command.append("--ios-simulator")
161         return command
162
163
164 class MacPort(DeprecatedPort):
165     port_flag_name = "mac"
166
167     def run_webkit_tests_command(self, build_style=None):
168         command = super(MacPort, self).run_webkit_tests_command(build_style)
169         command.append("--dump-render-tree")
170         return command
171
172
173 class MacWK2Port(DeprecatedPort):
174     port_flag_name = "mac-wk2"
175
176
177 class WinPort(DeprecatedPort):
178     port_flag_name = "win"
179
180     def run_bindings_tests_command(self):
181         return None
182
183     def run_webkit_tests_command(self, build_style=None):
184         command = super(WinPort, self).run_webkit_tests_command(build_style)
185         command.append("--dump-render-tree")
186         return command
187
188
189 class WinCairoPort(DeprecatedPort):
190     port_flag_name = "wincairo"
191
192     def build_webkit_command(self, build_style=None):
193         command = super(WinCairoPort, self).build_webkit_command(build_style=build_style)
194         command.append('--wincairo')
195         command.append('--64-bit')
196         return command
197
198
199 class GtkWK2Port(DeprecatedPort):
200     port_flag_name = "gtk-wk2"
201
202     def build_webkit_command(self, build_style=None):
203         command = super(GtkWK2Port, self).build_webkit_command(build_style=build_style)
204         command.append("--gtk")
205         command.append("--update-gtk")
206         command.append(super(GtkWK2Port, self).makeArgs())
207         return command
208
209     def run_webkit_tests_command(self, build_style=None):
210         command = super(GtkWK2Port, self).run_webkit_tests_command(build_style)
211         command.append("--gtk")
212         return command
213
214
215 class WpePort(DeprecatedPort):
216     port_flag_name = "wpe"
217
218     def build_webkit_command(self, build_style=None):
219         command = super(WpePort, self).build_webkit_command(build_style=build_style)
220         command.append("--wpe")
221         command.append("--update-wpe")
222         command.append(super(WpePort, self).makeArgs())
223         return command
224
225     def run_webkit_tests_command(self, build_style=None):
226         command = super(WpePort, self).run_webkit_tests_command(build_style)
227         command.append("--wpe")
228         return command