1# Copyright 2018 gRPC authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""Buldigen generate grpc_shadow_boringssl headers
15This script takes the list of symbols from
16src/objective-c/grpc_shadow_boringssl_symbols and populate them in
17settings.grpc_shadow_boringssl_symbols
18"""
19
20
21def mako_plugin(dictionary):
22    with open('src/objective-c/grpc_shadow_boringssl_symbol_list') as f:
23        symbols = f.readlines()
24    # Remove trailing '\n'
25    symbols = [s.strip() for s in symbols]
26    # Remove comments
27    symbols = [s for s in symbols if s[0] != '#']
28    # Remove the commit number
29    del symbols[0]
30
31    settings = dictionary['settings']
32    settings['grpc_shadow_boringssl_symbols'] = symbols
33