blob: c53beb0da5f033f1b801859aead49bd6d6a264c0 [file] [log] [blame]
Craig Tiller0fe5ee72015-12-22 12:50:36 -08001#!/usr/bin/env python2.7
Craig Tiller6169d5f2016-03-31 07:46:18 -07002# Copyright 2015, Google Inc.
Craig Tiller0fe5ee72015-12-22 12:50:36 -08003# 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
Craig Tillerb0154c42016-02-09 12:20:43 -080036sys.dont_write_bytecode = True
37
Craig Tiller0fe5ee72015-12-22 12:50:36 -080038boring_ssl_root = os.path.abspath(os.path.join(
murgatroid99c36f6ea2016-10-03 09:24:09 -070039 os.path.dirname(sys.argv[0]),
Craig Tiller0fe5ee72015-12-22 12:50:36 -080040 '../../third_party/boringssl'))
41sys.path.append(os.path.join(boring_ssl_root, 'util'))
42
Abhishek Kumarf4ef7bc2016-01-04 15:06:40 -080043try:
44 import generate_build_files
45except ImportError:
46 print yaml.dump({})
47 sys.exit()
Craig Tiller0fe5ee72015-12-22 12:50:36 -080048
49def map_dir(filename):
50 if filename[0:4] == 'src/':
51 return 'third_party/boringssl/' + filename[4:]
52 else:
53 return 'src/boringssl/' + filename
54
55def map_testarg(arg):
56 if '/' in arg:
57 return 'third_party/boringssl/' + arg
58 else:
59 return arg
60
61class 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" Noble51b1aee2016-01-28 01:14:58 +010087 'defaults': 'boringssl',
Craig Tiller0fe5ee72015-12-22 12:50:36 -080088 },
89 {
90 'name': 'boringssl_test_util',
91 'build': 'private',
92 'language': 'c++',
93 'secure': 'no',
94 'boringssl': True,
Nicolas "Pixel" Noble51b1aee2016-01-28 01:14:58 +010095 'defaults': 'boringssl',
Craig Tiller0fe5ee72015-12-22 12:50:36 -080096 '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" Noble51b1aee2016-01-28 01:14:58 +0100110 'defaults': 'boringssl',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800111 '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" Noble51b1aee2016-01-28 01:14:58 +0100128 'defaults': 'boringssl',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800129 '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 Tillerbfd05532016-01-20 09:53:15 -0800146 'boringssl': True,
Nicolas "Pixel" Noble51b1aee2016-01-28 01:14:58 +0100147 'defaults': 'boringssl',
Craig Tillerbfd05532016-01-20 09:53:15 -0800148 'cpu_cost': 1.0
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800149 }
150 for test in files['tests']
151 ]
152 }
153
154
155os.chdir(os.path.dirname(sys.argv[0]))
156os.mkdir('src')
157try:
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
167finally:
168 shutil.rmtree('src')