Siddharth Shukla | 8e64d90 | 2017-03-12 19:50:18 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 2 | # Copyright 2016, Google Inc. |
| 3 | # 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 | """Definition of targets to build artifacts.""" |
| 32 | |
Masood Malekghassemi | 0e12875 | 2016-07-15 14:36:54 -0700 | [diff] [blame] | 33 | import os.path |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 34 | import random |
| 35 | import string |
Masood Malekghassemi | 0e12875 | 2016-07-15 14:36:54 -0700 | [diff] [blame] | 36 | import sys |
| 37 | |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 38 | sys.path.insert(0, os.path.abspath('..')) |
| 39 | import python_utils.jobset as jobset |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 40 | |
| 41 | |
| 42 | def create_docker_jobspec(name, dockerfile_dir, shell_command, environ={}, |
Ken Payson | 626fb45 | 2017-02-17 22:52:27 -0800 | [diff] [blame] | 43 | flake_retries=0, timeout_retries=0, timeout_seconds=30*60, |
| 44 | docker_base_image=None): |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 45 | """Creates jobspec for a task running under docker.""" |
| 46 | environ = environ.copy() |
| 47 | environ['RUN_COMMAND'] = shell_command |
| 48 | |
| 49 | docker_args=[] |
siddharthshukla | 0589e53 | 2016-07-07 16:08:01 +0200 | [diff] [blame] | 50 | for k,v in environ.items(): |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 51 | docker_args += ['-e', '%s=%s' % (k, v)] |
| 52 | docker_env = {'DOCKERFILE_DIR': dockerfile_dir, |
Jan Tattermusch | 9835d4b | 2016-04-29 15:05:05 -0700 | [diff] [blame] | 53 | 'DOCKER_RUN_SCRIPT': 'tools/run_tests/dockerize/docker_run.sh', |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 54 | 'OUTPUT_DIR': 'artifacts'} |
Ken Payson | 626fb45 | 2017-02-17 22:52:27 -0800 | [diff] [blame] | 55 | |
| 56 | if docker_base_image is not None: |
| 57 | docker_env['DOCKER_BASE_IMAGE'] = docker_base_image |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 58 | jobspec = jobset.JobSpec( |
Jan Tattermusch | 9835d4b | 2016-04-29 15:05:05 -0700 | [diff] [blame] | 59 | cmdline=['tools/run_tests/dockerize/build_and_run_docker.sh'] + docker_args, |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 60 | environ=docker_env, |
| 61 | shortname='build_artifact.%s' % (name), |
Masood Malekghassemi | 027835f | 2016-07-15 22:31:50 -0700 | [diff] [blame] | 62 | timeout_seconds=timeout_seconds, |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 63 | flake_retries=flake_retries, |
| 64 | timeout_retries=timeout_retries) |
| 65 | return jobspec |
| 66 | |
| 67 | |
| 68 | def create_jobspec(name, cmdline, environ=None, shell=False, |
Masood Malekghassemi | 027835f | 2016-07-15 22:31:50 -0700 | [diff] [blame] | 69 | flake_retries=0, timeout_retries=0, timeout_seconds=30*60): |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 70 | """Creates jobspec.""" |
| 71 | jobspec = jobset.JobSpec( |
| 72 | cmdline=cmdline, |
| 73 | environ=environ, |
| 74 | shortname='build_artifact.%s' % (name), |
Masood Malekghassemi | 027835f | 2016-07-15 22:31:50 -0700 | [diff] [blame] | 75 | timeout_seconds=timeout_seconds, |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 76 | flake_retries=flake_retries, |
| 77 | timeout_retries=timeout_retries, |
| 78 | shell=shell) |
| 79 | return jobspec |
| 80 | |
| 81 | |
Jan Tattermusch | e046f71 | 2016-02-18 16:06:10 -0800 | [diff] [blame] | 82 | _MACOS_COMPAT_FLAG = '-mmacosx-version-min=10.7' |
| 83 | |
| 84 | _ARCH_FLAG_MAP = { |
| 85 | 'x86': '-m32', |
| 86 | 'x64': '-m64' |
| 87 | } |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 88 | |
Nicolas "Pixel" Noble | 6a4e473 | 2016-02-20 01:30:57 +0100 | [diff] [blame] | 89 | |
Jan Tattermusch | 8640f92 | 2016-02-01 18:58:46 -0800 | [diff] [blame] | 90 | class PythonArtifact: |
| 91 | """Builds Python artifacts.""" |
| 92 | |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 93 | def __init__(self, platform, arch, py_version): |
| 94 | self.name = 'python_%s_%s_%s' % (platform, arch, py_version) |
Jan Tattermusch | 8640f92 | 2016-02-01 18:58:46 -0800 | [diff] [blame] | 95 | self.platform = platform |
| 96 | self.arch = arch |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 97 | self.labels = ['artifact', 'python', platform, arch, py_version] |
| 98 | self.py_version = py_version |
Jan Tattermusch | 8640f92 | 2016-02-01 18:58:46 -0800 | [diff] [blame] | 99 | |
| 100 | def pre_build_jobspecs(self): |
Masood Malekghassemi | 0e12875 | 2016-07-15 14:36:54 -0700 | [diff] [blame] | 101 | return [] |
Jan Tattermusch | 8640f92 | 2016-02-01 18:58:46 -0800 | [diff] [blame] | 102 | |
| 103 | def build_jobspec(self): |
Nicolas "Pixel" Noble | de808bb | 2016-02-18 01:13:14 +0100 | [diff] [blame] | 104 | environ = {} |
| 105 | if self.platform == 'linux': |
| 106 | if self.arch == 'x86': |
| 107 | environ['SETARCH_CMD'] = 'linux32' |
Masood Malekghassemi | 010eb48 | 2016-05-03 15:59:40 -0700 | [diff] [blame] | 108 | # Inside the manylinux container, the python installations are located in |
| 109 | # special places... |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 110 | environ['PYTHON'] = '/opt/python/{}/bin/python'.format(self.py_version) |
| 111 | environ['PIP'] = '/opt/python/{}/bin/pip'.format(self.py_version) |
Masood Malekghassemi | 010eb48 | 2016-05-03 15:59:40 -0700 | [diff] [blame] | 112 | # Platform autodetection for the manylinux1 image breaks so we set the |
| 113 | # defines ourselves. |
| 114 | # TODO(atash) get better platform-detection support in core so we don't |
| 115 | # need to do this manually... |
Masood Malekghassemi | f4c70ca | 2016-05-05 19:14:05 -0700 | [diff] [blame] | 116 | environ['CFLAGS'] = '-DGPR_MANYLINUX1=1' |
Masood Malekghassemi | aff6936 | 2016-09-21 15:10:36 -0700 | [diff] [blame] | 117 | environ['GRPC_BUILD_GRPCIO_TOOLS_DEPENDENTS'] = 'TRUE' |
| 118 | environ['GRPC_BUILD_MANYLINUX_WHEEL'] = 'TRUE' |
Nicolas "Pixel" Noble | de808bb | 2016-02-18 01:13:14 +0100 | [diff] [blame] | 119 | return create_docker_jobspec(self.name, |
Masood Malekghassemi | 010eb48 | 2016-05-03 15:59:40 -0700 | [diff] [blame] | 120 | 'tools/dockerfile/grpc_artifact_python_manylinux_%s' % self.arch, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 121 | 'tools/run_tests/artifacts/build_artifact_python.sh', |
Masood Malekghassemi | 027835f | 2016-07-15 22:31:50 -0700 | [diff] [blame] | 122 | environ=environ, |
Ken Payson | 626fb45 | 2017-02-17 22:52:27 -0800 | [diff] [blame] | 123 | timeout_seconds=60*60, |
| 124 | docker_base_image='quay.io/pypa/manylinux1_i686' if self.arch == 'x86' else 'quay.io/pypa/manylinux1_x86_64') |
Nicolas "Pixel" Noble | de808bb | 2016-02-18 01:13:14 +0100 | [diff] [blame] | 125 | elif self.platform == 'windows': |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 126 | if 'Python27' in self.py_version or 'Python34' in self.py_version: |
| 127 | environ['EXT_COMPILER'] = 'mingw32' |
| 128 | else: |
| 129 | environ['EXT_COMPILER'] = 'msvc' |
| 130 | # For some reason, the batch script %random% always runs with the same |
| 131 | # seed. We create a random temp-dir here |
| 132 | dir = ''.join(random.choice(string.ascii_uppercase) for _ in range(10)) |
Nicolas "Pixel" Noble | de808bb | 2016-02-18 01:13:14 +0100 | [diff] [blame] | 133 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 134 | ['tools\\run_tests\\artifacts\\build_artifact_python.bat', |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 135 | self.py_version, |
| 136 | '32' if self.arch == 'x86' else '64', |
| 137 | dir |
Nicolas "Pixel" Noble | 6a4e473 | 2016-02-20 01:30:57 +0100 | [diff] [blame] | 138 | ], |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 139 | environ=environ, |
Nicolas "Pixel" Noble | de808bb | 2016-02-18 01:13:14 +0100 | [diff] [blame] | 140 | shell=True) |
Jan Tattermusch | 8640f92 | 2016-02-01 18:58:46 -0800 | [diff] [blame] | 141 | else: |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 142 | environ['PYTHON'] = self.py_version |
| 143 | environ['SKIP_PIP_INSTALL'] = 'TRUE' |
Nicolas "Pixel" Noble | de808bb | 2016-02-18 01:13:14 +0100 | [diff] [blame] | 144 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 145 | ['tools/run_tests/artifacts/build_artifact_python.sh'], |
Nicolas "Pixel" Noble | de808bb | 2016-02-18 01:13:14 +0100 | [diff] [blame] | 146 | environ=environ) |
Jan Tattermusch | 8640f92 | 2016-02-01 18:58:46 -0800 | [diff] [blame] | 147 | |
| 148 | def __str__(self): |
| 149 | return self.name |
| 150 | |
| 151 | |
Jan Tattermusch | 4437213 | 2016-02-01 16:20:03 -0800 | [diff] [blame] | 152 | class RubyArtifact: |
| 153 | """Builds ruby native gem.""" |
| 154 | |
| 155 | def __init__(self, platform, arch): |
| 156 | self.name = 'ruby_native_gem_%s_%s' % (platform, arch) |
| 157 | self.platform = platform |
| 158 | self.arch = arch |
| 159 | self.labels = ['artifact', 'ruby', platform, arch] |
| 160 | |
| 161 | def pre_build_jobspecs(self): |
| 162 | return [] |
| 163 | |
| 164 | def build_jobspec(self): |
| 165 | if self.platform == 'windows': |
| 166 | raise Exception("Not supported yet") |
| 167 | else: |
| 168 | if self.platform == 'linux': |
| 169 | environ = {} |
| 170 | if self.arch == 'x86': |
Jan Tattermusch | 7cf8bf4 | 2016-02-03 13:41:07 -0800 | [diff] [blame] | 171 | environ['SETARCH_CMD'] = 'linux32' |
Jan Tattermusch | 4437213 | 2016-02-01 16:20:03 -0800 | [diff] [blame] | 172 | return create_docker_jobspec(self.name, |
| 173 | 'tools/dockerfile/grpc_artifact_linux_%s' % self.arch, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 174 | 'tools/run_tests/artifacts/build_artifact_ruby.sh', |
Jan Tattermusch | 4437213 | 2016-02-01 16:20:03 -0800 | [diff] [blame] | 175 | environ=environ) |
| 176 | else: |
| 177 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 178 | ['tools/run_tests/artifacts/build_artifact_ruby.sh']) |
Jan Tattermusch | 4437213 | 2016-02-01 16:20:03 -0800 | [diff] [blame] | 179 | |
| 180 | |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 181 | class CSharpExtArtifact: |
| 182 | """Builds C# native extension library""" |
| 183 | |
| 184 | def __init__(self, platform, arch): |
| 185 | self.name = 'csharp_ext_%s_%s' % (platform, arch) |
| 186 | self.platform = platform |
| 187 | self.arch = arch |
| 188 | self.labels = ['artifact', 'csharp', platform, arch] |
| 189 | |
| 190 | def pre_build_jobspecs(self): |
Jan Tattermusch | 6dce2f5 | 2017-02-09 17:03:03 -0800 | [diff] [blame] | 191 | return [] |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 192 | |
| 193 | def build_jobspec(self): |
| 194 | if self.platform == 'windows': |
Jan Tattermusch | 6dce2f5 | 2017-02-09 17:03:03 -0800 | [diff] [blame] | 195 | cmake_arch_option = 'Win32' if self.arch == 'x86' else self.arch |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 196 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 197 | ['tools\\run_tests\\artifacts\\build_artifact_csharp.bat', |
Jan Tattermusch | 6dce2f5 | 2017-02-09 17:03:03 -0800 | [diff] [blame] | 198 | cmake_arch_option], |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 199 | shell=True) |
| 200 | else: |
| 201 | environ = {'CONFIG': 'opt', |
| 202 | 'EMBED_OPENSSL': 'true', |
Craig Tiller | 71ea4a1 | 2016-02-04 15:06:41 -0800 | [diff] [blame] | 203 | 'EMBED_ZLIB': 'true', |
Jan Tattermusch | 60cbec7 | 2016-02-26 13:47:16 -0800 | [diff] [blame] | 204 | 'CFLAGS': '-DGPR_BACKWARDS_COMPATIBILITY_MODE', |
Jan Tattermusch | 1d00ccc | 2017-05-09 16:28:38 +0200 | [diff] [blame] | 205 | 'CXXFLAGS': '-DGPR_BACKWARDS_COMPATIBILITY_MODE', |
Jan Tattermusch | 60cbec7 | 2016-02-26 13:47:16 -0800 | [diff] [blame] | 206 | 'LDFLAGS': ''} |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 207 | if self.platform == 'linux': |
| 208 | return create_docker_jobspec(self.name, |
| 209 | 'tools/dockerfile/grpc_artifact_linux_%s' % self.arch, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 210 | 'tools/run_tests/artifacts/build_artifact_csharp.sh', |
Jan Tattermusch | 60cbec7 | 2016-02-26 13:47:16 -0800 | [diff] [blame] | 211 | environ=environ) |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 212 | else: |
Jan Tattermusch | 60cbec7 | 2016-02-26 13:47:16 -0800 | [diff] [blame] | 213 | archflag = _ARCH_FLAG_MAP[self.arch] |
| 214 | environ['CFLAGS'] += ' %s %s' % (archflag, _MACOS_COMPAT_FLAG) |
Jan Tattermusch | 1d00ccc | 2017-05-09 16:28:38 +0200 | [diff] [blame] | 215 | environ['CXXFLAGS'] += ' %s %s' % (archflag, _MACOS_COMPAT_FLAG) |
Jan Tattermusch | 60cbec7 | 2016-02-26 13:47:16 -0800 | [diff] [blame] | 216 | environ['LDFLAGS'] += ' %s' % archflag |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 217 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 218 | ['tools/run_tests/artifacts/build_artifact_csharp.sh'], |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 219 | environ=environ) |
| 220 | |
| 221 | def __str__(self): |
| 222 | return self.name |
| 223 | |
Jan Tattermusch | e046f71 | 2016-02-18 16:06:10 -0800 | [diff] [blame] | 224 | |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 225 | node_gyp_arch_map = { |
| 226 | 'x86': 'ia32', |
| 227 | 'x64': 'x64' |
| 228 | } |
| 229 | |
| 230 | class NodeExtArtifact: |
| 231 | """Builds Node native extension""" |
| 232 | |
| 233 | def __init__(self, platform, arch): |
| 234 | self.name = 'node_ext_{0}_{1}'.format(platform, arch) |
| 235 | self.platform = platform |
| 236 | self.arch = arch |
| 237 | self.gyp_arch = node_gyp_arch_map[arch] |
| 238 | self.labels = ['artifact', 'node', platform, arch] |
| 239 | |
| 240 | def pre_build_jobspecs(self): |
| 241 | return [] |
| 242 | |
| 243 | def build_jobspec(self): |
| 244 | if self.platform == 'windows': |
| 245 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 246 | ['tools\\run_tests\\artifacts\\build_artifact_node.bat', |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 247 | self.gyp_arch], |
| 248 | shell=True) |
| 249 | else: |
| 250 | if self.platform == 'linux': |
| 251 | return create_docker_jobspec( |
| 252 | self.name, |
| 253 | 'tools/dockerfile/grpc_artifact_linux_{}'.format(self.arch), |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 254 | 'tools/run_tests/artifacts/build_artifact_node.sh {}'.format(self.gyp_arch)) |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 255 | else: |
| 256 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 257 | ['tools/run_tests/artifacts/build_artifact_node.sh', |
murgatroid99 | 673f65b | 2016-02-01 11:19:07 -0800 | [diff] [blame] | 258 | self.gyp_arch]) |
| 259 | |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 260 | class PHPArtifact: |
| 261 | """Builds PHP PECL package""" |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 262 | |
| 263 | def __init__(self, platform, arch): |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 264 | self.name = 'php_pecl_package_{0}_{1}'.format(platform, arch) |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 265 | self.platform = platform |
| 266 | self.arch = arch |
| 267 | self.labels = ['artifact', 'php', platform, arch] |
| 268 | |
| 269 | def pre_build_jobspecs(self): |
| 270 | return [] |
| 271 | |
| 272 | def build_jobspec(self): |
Stanley Cheung | 80db5be | 2016-02-24 21:35:56 -0800 | [diff] [blame] | 273 | if self.platform == 'linux': |
| 274 | return create_docker_jobspec( |
| 275 | self.name, |
| 276 | 'tools/dockerfile/grpc_artifact_linux_{}'.format(self.arch), |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 277 | 'tools/run_tests/artifacts/build_artifact_php.sh') |
Stanley Cheung | 80db5be | 2016-02-24 21:35:56 -0800 | [diff] [blame] | 278 | else: |
| 279 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 280 | ['tools/run_tests/artifacts/build_artifact_php.sh']) |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 281 | |
Jan Tattermusch | e046f71 | 2016-02-18 16:06:10 -0800 | [diff] [blame] | 282 | class ProtocArtifact: |
| 283 | """Builds protoc and protoc-plugin artifacts""" |
| 284 | |
| 285 | def __init__(self, platform, arch): |
| 286 | self.name = 'protoc_%s_%s' % (platform, arch) |
| 287 | self.platform = platform |
| 288 | self.arch = arch |
| 289 | self.labels = ['artifact', 'protoc', platform, arch] |
| 290 | |
| 291 | def pre_build_jobspecs(self): |
| 292 | return [] |
| 293 | |
| 294 | def build_jobspec(self): |
| 295 | if self.platform != 'windows': |
| 296 | cxxflags = '-DNDEBUG %s' % _ARCH_FLAG_MAP[self.arch] |
Jan Tattermusch | e7b7d86 | 2016-02-19 09:49:35 -0800 | [diff] [blame] | 297 | ldflags = '%s' % _ARCH_FLAG_MAP[self.arch] |
| 298 | if self.platform != 'macos': |
Jan Tattermusch | 07591a5 | 2016-02-19 10:28:24 -0800 | [diff] [blame] | 299 | ldflags += ' -static-libgcc -static-libstdc++ -s' |
Jan Tattermusch | e046f71 | 2016-02-18 16:06:10 -0800 | [diff] [blame] | 300 | environ={'CONFIG': 'opt', |
| 301 | 'CXXFLAGS': cxxflags, |
| 302 | 'LDFLAGS': ldflags, |
| 303 | 'PROTOBUF_LDFLAGS_EXTRA': ldflags} |
| 304 | if self.platform == 'linux': |
| 305 | return create_docker_jobspec(self.name, |
| 306 | 'tools/dockerfile/grpc_artifact_protoc', |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 307 | 'tools/run_tests/artifacts/build_artifact_protoc.sh', |
Jan Tattermusch | e046f71 | 2016-02-18 16:06:10 -0800 | [diff] [blame] | 308 | environ=environ) |
| 309 | else: |
Jan Tattermusch | e7b7d86 | 2016-02-19 09:49:35 -0800 | [diff] [blame] | 310 | environ['CXXFLAGS'] += ' -std=c++11 -stdlib=libc++ %s' % _MACOS_COMPAT_FLAG |
Jan Tattermusch | e046f71 | 2016-02-18 16:06:10 -0800 | [diff] [blame] | 311 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 312 | ['tools/run_tests/artifacts/build_artifact_protoc.sh'], |
Jan Tattermusch | e046f71 | 2016-02-18 16:06:10 -0800 | [diff] [blame] | 313 | environ=environ) |
| 314 | else: |
Jan Tattermusch | 6d15982 | 2016-02-19 16:03:22 -0800 | [diff] [blame] | 315 | generator = 'Visual Studio 12 Win64' if self.arch == 'x64' else 'Visual Studio 12' |
| 316 | vcplatform = 'x64' if self.arch == 'x64' else 'Win32' |
| 317 | return create_jobspec(self.name, |
Jan Tattermusch | 5c79a31 | 2016-12-20 11:02:50 +0100 | [diff] [blame] | 318 | ['tools\\run_tests\\artifacts\\build_artifact_protoc.bat'], |
Jan Tattermusch | 6d15982 | 2016-02-19 16:03:22 -0800 | [diff] [blame] | 319 | environ={'generator': generator, |
| 320 | 'Platform': vcplatform}) |
Jan Tattermusch | e046f71 | 2016-02-18 16:06:10 -0800 | [diff] [blame] | 321 | |
| 322 | def __str__(self): |
| 323 | return self.name |
| 324 | |
| 325 | |
Jan Tattermusch | be538a1 | 2016-01-28 14:58:15 -0800 | [diff] [blame] | 326 | def targets(): |
| 327 | """Gets list of supported targets""" |
murgatroid99 | 41a9e83 | 2016-02-03 09:47:35 -0800 | [diff] [blame] | 328 | return ([Cls(platform, arch) |
Jan Tattermusch | 6d15982 | 2016-02-19 16:03:22 -0800 | [diff] [blame] | 329 | for Cls in (CSharpExtArtifact, NodeExtArtifact, ProtocArtifact) |
murgatroid99 | 41a9e83 | 2016-02-03 09:47:35 -0800 | [diff] [blame] | 330 | for platform in ('linux', 'macos', 'windows') |
| 331 | for arch in ('x86', 'x64')] + |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 332 | [PythonArtifact('linux', 'x86', 'cp27-cp27m'), |
| 333 | PythonArtifact('linux', 'x86', 'cp27-cp27mu'), |
| 334 | PythonArtifact('linux', 'x86', 'cp34-cp34m'), |
| 335 | PythonArtifact('linux', 'x86', 'cp35-cp35m'), |
Ken Payson | 626fb45 | 2017-02-17 22:52:27 -0800 | [diff] [blame] | 336 | PythonArtifact('linux', 'x86', 'cp36-cp36m'), |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 337 | PythonArtifact('linux', 'x64', 'cp27-cp27m'), |
| 338 | PythonArtifact('linux', 'x64', 'cp27-cp27mu'), |
| 339 | PythonArtifact('linux', 'x64', 'cp34-cp34m'), |
| 340 | PythonArtifact('linux', 'x64', 'cp35-cp35m'), |
Ken Payson | 626fb45 | 2017-02-17 22:52:27 -0800 | [diff] [blame] | 341 | PythonArtifact('linux', 'x64', 'cp36-cp36m'), |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 342 | PythonArtifact('macos', 'x64', 'python2.7'), |
| 343 | PythonArtifact('macos', 'x64', 'python3.4'), |
| 344 | PythonArtifact('macos', 'x64', 'python3.5'), |
Ken Payson | 626fb45 | 2017-02-17 22:52:27 -0800 | [diff] [blame] | 345 | PythonArtifact('macos', 'x64', 'python3.6'), |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 346 | PythonArtifact('windows', 'x86', 'Python27_32bits'), |
| 347 | PythonArtifact('windows', 'x86', 'Python34_32bits'), |
| 348 | PythonArtifact('windows', 'x86', 'Python35_32bits'), |
Ken Payson | 626fb45 | 2017-02-17 22:52:27 -0800 | [diff] [blame] | 349 | PythonArtifact('windows', 'x86', 'Python36_32bits'), |
Ken Payson | 5998cd7 | 2016-08-10 15:39:43 -0700 | [diff] [blame] | 350 | PythonArtifact('windows', 'x64', 'Python27'), |
| 351 | PythonArtifact('windows', 'x64', 'Python34'), |
| 352 | PythonArtifact('windows', 'x64', 'Python35'), |
Ken Payson | 626fb45 | 2017-02-17 22:52:27 -0800 | [diff] [blame] | 353 | PythonArtifact('windows', 'x64', 'Python36'), |
murgatroid99 | 41a9e83 | 2016-02-03 09:47:35 -0800 | [diff] [blame] | 354 | RubyArtifact('linux', 'x86'), |
murgatroid99 | 33c808b | 2016-02-03 15:27:41 -0800 | [diff] [blame] | 355 | RubyArtifact('linux', 'x64'), |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 356 | RubyArtifact('macos', 'x64'), |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 357 | PHPArtifact('linux', 'x64'), |
| 358 | PHPArtifact('macos', 'x64')]) |