1#!/usr/bin/env python2.7 2# Copyright 2015 gRPC authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16import shutil 17import sys 18import os 19import yaml 20 21sys.dont_write_bytecode = True 22 23boring_ssl_root = os.path.abspath(os.path.join( 24 os.path.dirname(sys.argv[0]), 25 '../../third_party/boringssl')) 26sys.path.append(os.path.join(boring_ssl_root, 'util')) 27 28try: 29 import generate_build_files 30except ImportError: 31 print yaml.dump({}) 32 sys.exit() 33 34def map_dir(filename): 35 if filename[0:4] == 'src/': 36 return 'third_party/boringssl/' + filename[4:] 37 else: 38 return 'src/boringssl/' + filename 39 40def map_testarg(arg): 41 if '/' in arg: 42 return 'third_party/boringssl/' + arg 43 else: 44 return arg 45 46class Grpc(object): 47 48 yaml = None 49 50 def WriteFiles(self, files, asm_outputs): 51 52 self.yaml = { 53 '#': 'generated with tools/buildgen/gen_boring_ssl_build_yaml.py', 54 'raw_boringssl_build_output_for_debugging': { 55 'files': files, 56 'asm_outputs': asm_outputs, 57 }, 58 'libs': [ 59 { 60 'name': 'boringssl', 61 'build': 'private', 62 'language': 'c', 63 'secure': 'no', 64 'src': sorted( 65 map_dir(f) 66 for f in files['ssl'] + files['crypto'] 67 ), 68 'headers': sorted( 69 map_dir(f) 70 # We want to include files['fips_fragments'], but not build them as objects. 71 # See https://boringssl-review.googlesource.com/c/boringssl/+/16946 72 for f in files['ssl_headers'] + files['ssl_internal_headers'] + files['crypto_headers'] + files['crypto_internal_headers'] + files['fips_fragments'] 73 ), 74 'boringssl': True, 75 'defaults': 'boringssl', 76 }, 77 { 78 'name': 'boringssl_test_util', 79 'build': 'private', 80 'language': 'c++', 81 'secure': 'no', 82 'boringssl': True, 83 'defaults': 'boringssl', 84 'src': [ 85 map_dir(f) 86 for f in sorted(files['test_support']) 87 ], 88 } 89 ] + [ 90 { 91 'name': 'boringssl_%s_lib' % os.path.splitext(os.path.basename(test))[0], 92 'build': 'private', 93 'secure': 'no', 94 'language': 'c' if os.path.splitext(test)[1] == '.c' else 'c++', 95 'src': [map_dir(test)], 96 'vs_proj_dir': 'test/boringssl', 97 'boringssl': True, 98 'defaults': 'boringssl', 99 'deps': [ 100 'boringssl_test_util', 101 'boringssl', 102 ] 103 } 104 for test in list(sorted(set(files['ssl_test'] + files['crypto_test']))) 105 ], 106 'targets': [ 107 { 108 'name': 'boringssl_%s' % os.path.splitext(os.path.basename(test))[0], 109 'build': 'test', 110 'run': False, 111 'secure': 'no', 112 'language': 'c++', 113 'src': ["third_party/boringssl/crypto/test/gtest_main.cc"], 114 'vs_proj_dir': 'test/boringssl', 115 'boringssl': True, 116 'defaults': 'boringssl', 117 'deps': [ 118 'boringssl_%s_lib' % os.path.splitext(os.path.basename(test))[0], 119 'boringssl_test_util', 120 'boringssl', 121 ] 122 } 123 for test in list(sorted(set(files['ssl_test'] + files['crypto_test']))) 124 ], 125 'tests': [ 126 { 127 'name': 'boringssl_%s' % os.path.splitext(os.path.basename(test))[0], 128 'args': [], 129 'exclude_configs': ['asan', 'ubsan'], 130 'ci_platforms': ['linux', 'mac', 'posix', 'windows'], 131 'platforms': ['linux', 'mac', 'posix', 'windows'], 132 'flaky': False, 133 'gtest': True, 134 'language': 'c++', 135 'boringssl': True, 136 'defaults': 'boringssl', 137 'cpu_cost': 1.0 138 } 139 for test in list(sorted(set(files['ssl_test'] + files['crypto_test']))) 140 ] 141 142 } 143 144 145os.chdir(os.path.dirname(sys.argv[0])) 146os.mkdir('src') 147try: 148 for f in os.listdir(boring_ssl_root): 149 os.symlink(os.path.join(boring_ssl_root, f), 150 os.path.join('src', f)) 151 152 g = Grpc() 153 generate_build_files.main([g]) 154 155 print yaml.dump(g.yaml) 156 157finally: 158 shutil.rmtree('src') 159