iOS EWS queue name should be consistent
[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 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": IOSPort,
68             "mac": MacPort,
69             "mac-wk2": MacWK2Port,
70             "win": WinPort,
71             "efl-wk2": EflWK2Port,
72         }
73         default_port = {
74             "Windows": WinPort,
75             "Darwin": MacPort,
76         }
77         # Do we really need MacPort as the ultimate default?
78         return ports.get(port_name, default_port.get(platform.system(), MacPort))()
79
80     def makeArgs(self):
81         # FIXME: This shouldn't use a static Executive().
82         args = '--makeargs="-j%s"' % Executive().cpu_count()
83         if os.environ.has_key('MAKEFLAGS'):
84             args = '--makeargs="%s"' % os.environ['MAKEFLAGS']
85         return args
86
87     def update_webkit_command(self, non_interactive=False):
88         return self.script_shell_command("update-webkit")
89
90     def check_webkit_style_command(self):
91         return self.script_shell_command("check-webkit-style")
92
93     def prepare_changelog_command(self):
94         return self.script_shell_command("prepare-ChangeLog")
95
96     def build_webkit_command(self, build_style=None):
97         command = self.script_shell_command("build-webkit")
98         if build_style == "debug":
99             command.append("--debug")
100         if build_style == "release":
101             command.append("--release")
102         return command
103
104     def run_javascriptcore_tests_command(self):
105         return self.script_shell_command("run-javascriptcore-tests")
106
107     def run_webkit_unit_tests_command(self):
108         return None
109
110     def run_webkit_tests_command(self):
111         return self.script_shell_command("run-webkit-tests")
112
113     def run_python_unittests_command(self):
114         return self.script_shell_command("test-webkitpy")
115
116     def run_perl_unittests_command(self):
117         return self.script_shell_command("test-webkitperl")
118
119     def run_bindings_tests_command(self):
120         return self.script_shell_command("run-bindings-tests")
121
122
123 class IOSPort(DeprecatedPort):
124     port_flag_name = "ios"
125
126     def build_webkit_command(self, build_style=None):
127         command = super(IOSPort, self).build_webkit_command(build_style=build_style)
128         command.append("--sdk=iphoneos")
129         return command
130
131
132 class MacPort(DeprecatedPort):
133     port_flag_name = "mac"
134
135
136 class MacWK2Port(DeprecatedPort):
137     port_flag_name = "mac-wk2"
138
139     def run_webkit_tests_command(self):
140         command = super(MacWK2Port, self).run_webkit_tests_command()
141         command.append("-2")
142         return command
143
144
145 class WinPort(DeprecatedPort):
146     port_flag_name = "win"
147
148     def run_bindings_tests_command(self):
149         return None
150
151
152 class GtkWK2Port(DeprecatedPort):
153     port_flag_name = "gtk-wk2"
154
155     def build_webkit_command(self, build_style=None):
156         command = super(GtkWK2Port, self).build_webkit_command(build_style=build_style)
157         command.append("--gtk")
158         command.append("--update-gtk")
159         command.append(super(GtkWK2Port, self).makeArgs())
160         return command
161
162     def run_webkit_tests_command(self):
163         command = super(GtkWK2Port, self).run_webkit_tests_command()
164         command.append("--gtk")
165         command.append("-2")
166         return command
167
168
169 class EflWK2Port(DeprecatedPort):
170     port_flag_name = "efl-wk2"
171
172     def build_webkit_command(self, build_style=None):
173         command = super(EflWK2Port, self).build_webkit_command(build_style=build_style)
174         command.append("--efl")
175         command.append("--update-efl")
176         command.append(super(EflWK2Port, self).makeArgs())
177         return command