Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1 | #!/usr/bin/env python2.7 |
Craig Tiller | 6169d5f | 2016-03-31 07:46:18 -0700 | [diff] [blame] | 2 | # Copyright 2015, Google Inc. |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 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 | import shutil |
| 32 | import sys |
| 33 | import os |
| 34 | import yaml |
| 35 | |
Craig Tiller | b0154c4 | 2016-02-09 12:20:43 -0800 | [diff] [blame] | 36 | sys.dont_write_bytecode = True |
| 37 | |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 38 | boring_ssl_root = os.path.abspath(os.path.join( |
murgatroid99 | c36f6ea | 2016-10-03 09:24:09 -0700 | [diff] [blame] | 39 | os.path.dirname(sys.argv[0]), |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 40 | '../../third_party/boringssl')) |
| 41 | sys.path.append(os.path.join(boring_ssl_root, 'util')) |
| 42 | |
Abhishek Kumar | f4ef7bc | 2016-01-04 15:06:40 -0800 | [diff] [blame] | 43 | try: |
| 44 | import generate_build_files |
| 45 | except ImportError: |
| 46 | print yaml.dump({}) |
| 47 | sys.exit() |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 48 | |
| 49 | def map_dir(filename): |
| 50 | if filename[0:4] == 'src/': |
| 51 | return 'third_party/boringssl/' + filename[4:] |
| 52 | else: |
| 53 | return 'src/boringssl/' + filename |
| 54 | |
| 55 | def map_testarg(arg): |
| 56 | if '/' in arg: |
| 57 | return 'third_party/boringssl/' + arg |
| 58 | else: |
| 59 | return arg |
| 60 | |
| 61 | class Grpc(object): |
| 62 | |
| 63 | yaml = None |
| 64 | |
| 65 | def WriteFiles(self, files, asm_outputs): |
| 66 | self.yaml = { |
| 67 | '#': 'generated with tools/buildgen/gen_boring_ssl_build_yaml.py', |
| 68 | 'raw_boringssl_build_output_for_debugging': { |
| 69 | 'files': files, |
| 70 | 'asm_outputs': asm_outputs, |
| 71 | }, |
| 72 | 'libs': [ |
| 73 | { |
| 74 | 'name': 'boringssl', |
| 75 | 'build': 'private', |
| 76 | 'language': 'c', |
| 77 | 'secure': 'no', |
| 78 | 'src': sorted( |
| 79 | map_dir(f) |
| 80 | for f in files['ssl'] + files['crypto'] |
| 81 | ), |
| 82 | 'headers': sorted( |
| 83 | map_dir(f) |
| 84 | for f in files['ssl_headers'] + files['ssl_internal_headers'] + files['crypto_headers'] + files['crypto_internal_headers'] |
| 85 | ), |
| 86 | 'boringssl': True, |
Nicolas "Pixel" Noble | 51b1aee | 2016-01-28 01:14:58 +0100 | [diff] [blame] | 87 | 'defaults': 'boringssl', |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 88 | }, |
| 89 | { |
| 90 | 'name': 'boringssl_test_util', |
| 91 | 'build': 'private', |
| 92 | 'language': 'c++', |
| 93 | 'secure': 'no', |
| 94 | 'boringssl': True, |
Nicolas "Pixel" Noble | 51b1aee | 2016-01-28 01:14:58 +0100 | [diff] [blame] | 95 | 'defaults': 'boringssl', |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 96 | 'src': [ |
| 97 | map_dir(f) |
| 98 | for f in sorted(files['test_support']) |
| 99 | ], |
| 100 | } |
| 101 | ] + [ |
| 102 | { |
| 103 | 'name': 'boringssl_%s_lib' % os.path.splitext(os.path.basename(test))[0], |
| 104 | 'build': 'private', |
| 105 | 'secure': 'no', |
| 106 | 'language': 'c' if os.path.splitext(test)[1] == '.c' else 'c++', |
| 107 | 'src': [map_dir(test)], |
| 108 | 'vs_proj_dir': 'test/boringssl', |
| 109 | 'boringssl': True, |
Nicolas "Pixel" Noble | 51b1aee | 2016-01-28 01:14:58 +0100 | [diff] [blame] | 110 | 'defaults': 'boringssl', |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 111 | 'deps': [ |
| 112 | 'boringssl_test_util', |
| 113 | 'boringssl', |
| 114 | ] |
| 115 | } |
| 116 | for test in sorted(files['test']) |
| 117 | ], |
| 118 | 'targets': [ |
| 119 | { |
| 120 | 'name': 'boringssl_%s' % os.path.splitext(os.path.basename(test))[0], |
| 121 | 'build': 'test', |
| 122 | 'run': False, |
| 123 | 'secure': 'no', |
| 124 | 'language': 'c++', |
| 125 | 'src': [], |
| 126 | 'vs_proj_dir': 'test/boringssl', |
| 127 | 'boringssl': True, |
Nicolas "Pixel" Noble | 51b1aee | 2016-01-28 01:14:58 +0100 | [diff] [blame] | 128 | 'defaults': 'boringssl', |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 129 | 'deps': [ |
| 130 | 'boringssl_%s_lib' % os.path.splitext(os.path.basename(test))[0], |
| 131 | 'boringssl_test_util', |
| 132 | 'boringssl', |
| 133 | ] |
| 134 | } |
| 135 | for test in sorted(files['test']) |
| 136 | ], |
| 137 | 'tests': [ |
| 138 | { |
| 139 | 'name': 'boringssl_%s' % os.path.basename(test[0]), |
| 140 | 'args': [map_testarg(arg) for arg in test[1:]], |
| 141 | 'exclude_configs': ['asan'], |
| 142 | 'ci_platforms': ['linux', 'mac', 'posix', 'windows'], |
| 143 | 'platforms': ['linux', 'mac', 'posix', 'windows'], |
| 144 | 'flaky': False, |
| 145 | 'language': 'c++', |
Craig Tiller | bfd0553 | 2016-01-20 09:53:15 -0800 | [diff] [blame] | 146 | 'boringssl': True, |
Nicolas "Pixel" Noble | 51b1aee | 2016-01-28 01:14:58 +0100 | [diff] [blame] | 147 | 'defaults': 'boringssl', |
Craig Tiller | bfd0553 | 2016-01-20 09:53:15 -0800 | [diff] [blame] | 148 | 'cpu_cost': 1.0 |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 149 | } |
| 150 | for test in files['tests'] |
| 151 | ] |
| 152 | } |
| 153 | |
| 154 | |
| 155 | os.chdir(os.path.dirname(sys.argv[0])) |
| 156 | os.mkdir('src') |
| 157 | try: |
| 158 | for f in os.listdir(boring_ssl_root): |
| 159 | os.symlink(os.path.join(boring_ssl_root, f), |
| 160 | os.path.join('src', f)) |
| 161 | |
| 162 | g = Grpc() |
| 163 | generate_build_files.main([g]) |
| 164 | |
| 165 | print yaml.dump(g.yaml) |
| 166 | |
| 167 | finally: |
| 168 | shutil.rmtree('src') |