blob: 27c0c776c0de482f57b0a0a1fa997cd8dde0b8cc [file] [log] [blame]
Craig Tiller0fe5ee72015-12-22 12:50:36 -08001#!/usr/bin/env python2.7
Jan Tattermusch7897ae92017-06-07 22:57:36 +02002# Copyright 2015 gRPC authors.
Craig Tiller0fe5ee72015-12-22 12:50:36 -08003#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02004# 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
Craig Tiller0fe5ee72015-12-22 12:50:36 -08007#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02008# http://www.apache.org/licenses/LICENSE-2.0
Craig Tiller0fe5ee72015-12-22 12:50:36 -08009#
Jan Tattermusch7897ae92017-06-07 22:57:36 +020010# 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.
Craig Tiller0fe5ee72015-12-22 12:50:36 -080015
16import shutil
17import sys
18import os
19import yaml
20
Craig Tillerb0154c42016-02-09 12:20:43 -080021sys.dont_write_bytecode = True
22
Craig Tiller0fe5ee72015-12-22 12:50:36 -080023boring_ssl_root = os.path.abspath(os.path.join(
murgatroid99c36f6ea2016-10-03 09:24:09 -070024 os.path.dirname(sys.argv[0]),
Craig Tiller0fe5ee72015-12-22 12:50:36 -080025 '../../third_party/boringssl'))
26sys.path.append(os.path.join(boring_ssl_root, 'util'))
27
Abhishek Kumarf4ef7bc2016-01-04 15:06:40 -080028try:
29 import generate_build_files
30except ImportError:
31 print yaml.dump({})
32 sys.exit()
Craig Tiller0fe5ee72015-12-22 12:50:36 -080033
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 self.yaml = {
52 '#': 'generated with tools/buildgen/gen_boring_ssl_build_yaml.py',
53 'raw_boringssl_build_output_for_debugging': {
54 'files': files,
55 'asm_outputs': asm_outputs,
56 },
57 'libs': [
58 {
59 'name': 'boringssl',
60 'build': 'private',
61 'language': 'c',
62 'secure': 'no',
63 'src': sorted(
64 map_dir(f)
65 for f in files['ssl'] + files['crypto']
66 ),
67 'headers': sorted(
68 map_dir(f)
69 for f in files['ssl_headers'] + files['ssl_internal_headers'] + files['crypto_headers'] + files['crypto_internal_headers']
70 ),
71 'boringssl': True,
Nicolas "Pixel" Noble51b1aee2016-01-28 01:14:58 +010072 'defaults': 'boringssl',
Craig Tiller0fe5ee72015-12-22 12:50:36 -080073 },
74 {
75 'name': 'boringssl_test_util',
76 'build': 'private',
77 'language': 'c++',
78 'secure': 'no',
79 'boringssl': True,
Nicolas "Pixel" Noble51b1aee2016-01-28 01:14:58 +010080 'defaults': 'boringssl',
Craig Tiller0fe5ee72015-12-22 12:50:36 -080081 'src': [
82 map_dir(f)
83 for f in sorted(files['test_support'])
84 ],
85 }
86 ] + [
87 {
88 'name': 'boringssl_%s_lib' % os.path.splitext(os.path.basename(test))[0],
89 'build': 'private',
90 'secure': 'no',
91 'language': 'c' if os.path.splitext(test)[1] == '.c' else 'c++',
92 'src': [map_dir(test)],
93 'vs_proj_dir': 'test/boringssl',
94 'boringssl': True,
Nicolas "Pixel" Noble51b1aee2016-01-28 01:14:58 +010095 'defaults': 'boringssl',
Craig Tiller0fe5ee72015-12-22 12:50:36 -080096 'deps': [
97 'boringssl_test_util',
98 'boringssl',
99 ]
100 }
101 for test in sorted(files['test'])
102 ],
103 'targets': [
104 {
105 'name': 'boringssl_%s' % os.path.splitext(os.path.basename(test))[0],
106 'build': 'test',
107 'run': False,
108 'secure': 'no',
109 'language': 'c++',
110 'src': [],
111 'vs_proj_dir': 'test/boringssl',
112 'boringssl': True,
Nicolas "Pixel" Noble51b1aee2016-01-28 01:14:58 +0100113 'defaults': 'boringssl',
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800114 'deps': [
115 'boringssl_%s_lib' % os.path.splitext(os.path.basename(test))[0],
116 'boringssl_test_util',
117 'boringssl',
118 ]
119 }
120 for test in sorted(files['test'])
121 ],
122 'tests': [
123 {
124 'name': 'boringssl_%s' % os.path.basename(test[0]),
125 'args': [map_testarg(arg) for arg in test[1:]],
Craig Tiller1b84e032017-05-10 07:56:42 -0700126 'exclude_configs': ['asan', 'ubsan'],
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800127 'ci_platforms': ['linux', 'mac', 'posix', 'windows'],
128 'platforms': ['linux', 'mac', 'posix', 'windows'],
129 'flaky': False,
130 'language': 'c++',
Craig Tillerbfd05532016-01-20 09:53:15 -0800131 'boringssl': True,
Nicolas "Pixel" Noble51b1aee2016-01-28 01:14:58 +0100132 'defaults': 'boringssl',
Craig Tillerbfd05532016-01-20 09:53:15 -0800133 'cpu_cost': 1.0
Craig Tiller0fe5ee72015-12-22 12:50:36 -0800134 }
135 for test in files['tests']
136 ]
137 }
138
139
140os.chdir(os.path.dirname(sys.argv[0]))
141os.mkdir('src')
142try:
143 for f in os.listdir(boring_ssl_root):
144 os.symlink(os.path.join(boring_ssl_root, f),
145 os.path.join('src', f))
146
147 g = Grpc()
148 generate_build_files.main([g])
149
150 print yaml.dump(g.yaml)
151
152finally:
153 shutil.rmtree('src')