| Index: third_party/grpc/tools/buildgen/plugins/expand_filegroups.py
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py b/third_party/grpc/tools/buildgen/plugins/expand_filegroups.py
|
| similarity index 55%
|
| copy from third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py
|
| copy to third_party/grpc/tools/buildgen/plugins/expand_filegroups.py
|
| index 429f58186e3fce43dc21e81e0f9d7e20c7e0bf70..156bdc44171cbc323f9382fd7dc762a463bfece3 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py
|
| +++ b/third_party/grpc/tools/buildgen/plugins/expand_filegroups.py
|
| @@ -1,4 +1,4 @@
|
| -# Copyright 2010, Google Inc.
|
| +# Copyright 2015, Google Inc.
|
| # All rights reserved.
|
| #
|
| # Redistribution and use in source and binary forms, with or without
|
| @@ -27,20 +27,48 @@
|
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| +"""Buildgen expand filegroups plugin.
|
|
|
| -from mod_pywebsocket import msgutil
|
| +This takes the list of libs from our yaml dictionary,
|
| +and expands any and all filegroup.
|
|
|
| +"""
|
|
|
| -_GOODBYE_MESSAGE = 'Goodbye'
|
|
|
| +def excluded(filename, exclude_res):
|
| + for r in exclude_res:
|
| + if r.search(filename):
|
| + return True
|
| + return False
|
|
|
| -def web_socket_do_extra_handshake(request):
|
| - pass # Always accept.
|
|
|
| +def mako_plugin(dictionary):
|
| + """The exported plugin code for expand_filegroups.
|
|
|
| -def web_socket_transfer_data(request):
|
| - while True:
|
| - line = msgutil.receive_message(request)
|
| - msgutil.send_message(request, line)
|
| - if line == _GOODBYE_MESSAGE:
|
| - return
|
| + The list of libs in the build.yaml file can contain "filegroups" tags.
|
| + These refer to the filegroups in the root object. We will expand and
|
| + merge filegroups on the src, headers and public_headers properties.
|
| +
|
| + """
|
| + libs = dictionary.get('libs')
|
| + filegroups_list = dictionary.get('filegroups')
|
| + filegroups = {}
|
| +
|
| + for fg in filegroups_list:
|
| + filegroups[fg['name']] = fg
|
| +
|
| + for lib in libs:
|
| + for fg_name in lib.get('filegroups', []):
|
| + fg = filegroups[fg_name]
|
| +
|
| + src = lib.get('src', [])
|
| + src.extend(fg.get('src', []))
|
| + lib['src'] = src
|
| +
|
| + headers = lib.get('headers', [])
|
| + headers.extend(fg.get('headers', []))
|
| + lib['headers'] = headers
|
| +
|
| + public_headers = lib.get('public_headers', [])
|
| + public_headers.extend(fg.get('public_headers', []))
|
| + lib['public_headers'] = public_headers
|
|
|