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