diff options
author | Nicolas Noble <nicolasnoble@users.noreply.github.com> | 2015-01-18 13:02:05 -0800 |
---|---|---|
committer | Nicolas Noble <nicolasnoble@users.noreply.github.com> | 2015-01-18 13:02:05 -0800 |
commit | cf1d6eb4ae1b48958454259f7e26bee9140cbf65 (patch) | |
tree | 636d8d159f4aca965d183abf385e756554ff1c96 /tools | |
parent | cdc82fec662ae20e022db716e4f669474c8b0666 (diff) | |
parent | 7d7b6c768b7c7a83c9480ff88586abc3088fb379 (diff) |
Merge pull request #103 from ctiller/build-cleaner
Add a tool to cleanup build.json
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/buildgen/build-cleaner.py | 56 | ||||
-rw-r--r-- | tools/run_tests/tests.json | 148 |
2 files changed, 130 insertions, 74 deletions
diff --git a/tools/buildgen/build-cleaner.py b/tools/buildgen/build-cleaner.py new file mode 100755 index 0000000000..00821cc9cc --- /dev/null +++ b/tools/buildgen/build-cleaner.py @@ -0,0 +1,56 @@ +#!/usr/bin/python +# produces cleaner build.json files + +import collections +import json +import os +import sys + +_TOP_LEVEL_KEYS = ['settings', 'filegroups', 'libs', 'targets'] +_VERSION_KEYS = ['major', 'minor', 'micro', 'build'] +_ELEM_KEYS = [ + 'name', + 'build', + 'language', + 'public_headers', + 'headers', + 'src', + 'deps'] + +def rebuild_as_ordered_dict(indict, special_keys): + outdict = collections.OrderedDict() + for key in special_keys: + if key in indict: + outdict[key] = indict[key] + for key in sorted(indict.keys()): + if key in special_keys: continue + outdict[key] = indict[key] + return outdict + +def clean_elem(indict): + for name in ['public_headers', 'headers', 'src']: + if name not in indict: continue + inlist = indict[name] + protos = set(x for x in inlist if os.path.splitext(x)[1] == '.proto') + others = set(x for x in inlist if x not in protos) + indict[name] = sorted(protos) + sorted(others) + return rebuild_as_ordered_dict(indict, _ELEM_KEYS) + +for filename in sys.argv[1:]: + with open(filename) as f: + js = json.load(f) + js = rebuild_as_ordered_dict(js, _TOP_LEVEL_KEYS) + js['settings']['version'] = rebuild_as_ordered_dict( + js['settings']['version'], _VERSION_KEYS) + for grp in ['filegroups', 'libs', 'targets']: + if grp not in js: continue + js[grp] = sorted([clean_elem(x) for x in js[grp]], + key=lambda x: (x.get('language', '_'), x['name'])) + output = json.dumps(js, indent = 2) + # massage out trailing whitespace + lines = [] + for line in output.splitlines(): + lines.append(line.rstrip() + '\n') + with open(filename, 'w') as f: + f.write(''.join(lines)) + diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index cacab17494..a064a7259d 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -3,191 +3,187 @@ [ { "language": "c", - "name": "grpc_byte_buffer_reader_test" - }, - { - "language": "c", - "name": "gpr_cancellable_test" + "name": "alarm_heap_test" }, { "language": "c", - "name": "gpr_log_test" + "name": "alarm_list_test" }, { "language": "c", - "name": "gpr_useful_test" + "name": "alarm_test" }, { "language": "c", - "name": "gpr_cmdline_test" + "name": "alpn_test" }, { "language": "c", - "name": "gpr_histogram_test" + "name": "bin_encoder_test" }, { "language": "c", - "name": "gpr_host_port_test" + "name": "census_hash_table_test" }, { "language": "c", - "name": "gpr_slice_buffer_test" + "name": "census_statistics_multiple_writers_circular_buffer_test" }, { "language": "c", - "name": "gpr_slice_test" + "name": "census_statistics_multiple_writers_test" }, { "language": "c", - "name": "gpr_string_test" + "name": "census_statistics_performance_test" }, { "language": "c", - "name": "gpr_sync_test" + "name": "census_statistics_quick_test" }, { "language": "c", - "name": "gpr_thd_test" + "name": "census_statistics_small_log_test" }, { "language": "c", - "name": "gpr_time_test" + "name": "census_stub_test" }, { "language": "c", - "name": "murmur_hash_test" + "name": "census_window_stats_test" }, { - "language": "c", - "name": "grpc_stream_op_test" + "language": "c++", + "name": "channel_arguments_test" }, { "language": "c", - "name": "alpn_test" + "name": "chttp2_status_conversion_test" }, { "language": "c", - "name": "time_averaged_stats_test" + "name": "chttp2_stream_encoder_test" }, { "language": "c", - "name": "chttp2_stream_encoder_test" + "name": "chttp2_stream_map_test" }, { "language": "c", - "name": "hpack_table_test" + "name": "chttp2_transport_end2end_test" }, { - "language": "c", - "name": "chttp2_stream_map_test" + "language": "c++", + "name": "credentials_test" }, { "language": "c", - "name": "hpack_parser_test" + "name": "dualstack_socket_test" }, { "language": "c", - "name": "transport_metadata_test" + "name": "echo_test" }, { - "language": "c", - "name": "chttp2_status_conversion_test" + "language": "c++", + "name": "end2end_test" }, { "language": "c", - "name": "chttp2_transport_end2end_test" + "name": "fd_posix_test" }, { "language": "c", - "name": "tcp_posix_test" + "name": "fling_stream_test" }, { "language": "c", - "name": "dualstack_socket_test" + "name": "fling_test" }, { "language": "c", - "name": "no_server_test" + "name": "gpr_cancellable_test" }, { "language": "c", - "name": "resolve_address_test" + "name": "gpr_cmdline_test" }, { "language": "c", - "name": "sockaddr_utils_test" + "name": "gpr_histogram_test" }, { "language": "c", - "name": "tcp_server_posix_test" + "name": "gpr_host_port_test" }, { "language": "c", - "name": "tcp_client_posix_test" + "name": "gpr_log_test" }, { "language": "c", - "name": "grpc_channel_stack_test" + "name": "gpr_slice_buffer_test" }, { "language": "c", - "name": "metadata_buffer_test" + "name": "gpr_slice_test" }, { "language": "c", - "name": "grpc_completion_queue_test" + "name": "gpr_string_test" }, { "language": "c", - "name": "census_window_stats_test" + "name": "gpr_sync_test" }, { "language": "c", - "name": "census_statistics_quick_test" + "name": "gpr_thd_test" }, { "language": "c", - "name": "census_statistics_small_log_test" + "name": "gpr_time_test" }, { "language": "c", - "name": "census_statistics_performance_test" + "name": "gpr_useful_test" }, { "language": "c", - "name": "census_statistics_multiple_writers_test" + "name": "grpc_base64_test" }, { "language": "c", - "name": "census_statistics_multiple_writers_circular_buffer_test" + "name": "grpc_byte_buffer_reader_test" }, { "language": "c", - "name": "census_stub_test" + "name": "grpc_channel_stack_test" }, { "language": "c", - "name": "census_hash_table_test" + "name": "grpc_completion_queue_test" }, { "language": "c", - "name": "fling_test" + "name": "grpc_credentials_test" }, { "language": "c", - "name": "echo_test" + "name": "grpc_json_token_test" }, { "language": "c", - "name": "message_compress_test" + "name": "grpc_stream_op_test" }, { "language": "c", - "name": "bin_encoder_test" + "name": "hpack_parser_test" }, { "language": "c", - "name": "secure_endpoint_test" + "name": "hpack_table_test" }, { "language": "c", @@ -203,35 +199,39 @@ }, { "language": "c", - "name": "grpc_credentials_test" + "name": "lame_client_test" }, { "language": "c", - "name": "grpc_base64_test" + "name": "message_compress_test" }, { "language": "c", - "name": "grpc_json_token_test" + "name": "metadata_buffer_test" }, { "language": "c", - "name": "timeout_encoding_test" + "name": "murmur_hash_test" }, { "language": "c", - "name": "fd_posix_test" + "name": "no_server_test" }, { "language": "c", - "name": "fling_stream_test" + "name": "poll_kick_test" }, { "language": "c", - "name": "lame_client_test" + "name": "resolve_address_test" }, { - "language": "c++", - "name": "thread_pool_test" + "language": "c", + "name": "secure_endpoint_test" + }, + { + "language": "c", + "name": "sockaddr_utils_test" }, { "language": "c++", @@ -242,36 +242,36 @@ "name": "sync_client_async_server_test" }, { - "language": "c++", - "name": "end2end_test" + "language": "c", + "name": "tcp_client_posix_test" }, { - "language": "c++", - "name": "channel_arguments_test" + "language": "c", + "name": "tcp_posix_test" }, { - "language": "c++", - "name": "credentials_test" + "language": "c", + "name": "tcp_server_posix_test" }, { - "language": "c", - "name": "alarm_test" + "language": "c++", + "name": "thread_pool_test" }, { "language": "c", - "name": "alarm_list_test" + "name": "time_averaged_stats_test" }, { "language": "c", - "name": "alarm_heap_test" + "name": "time_test" }, { "language": "c", - "name": "time_test" + "name": "timeout_encoding_test" }, { "language": "c", - "name": "poll_kick_test" + "name": "transport_metadata_test" }, { "language": "c", |