Skip to content

Commit a8820e8

Browse files
authored
make stone objc outputs reproducible by stabilizing the output (#355)
* make stone objc outputs reproducible by stabilizing the output
1 parent 0470d6e commit a8820e8

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

stone/backends/obj_c_types.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class ObjCTypesBackend(ObjCBaseBackend):
8383

8484
cmdline_parser = _cmdline_parser
8585
obj_name_to_namespace = {} # type: typing.Dict[str, str]
86-
namespace_to_has_route_auth_list = {} # type: typing.Dict[typing.Any, typing.Set]
86+
namespace_to_has_route_auth_list = {} # type: typing.Dict[typing.Any, typing.List]
8787

8888
def generate(self, api):
8989
"""
@@ -134,18 +134,25 @@ def generate(self, api):
134134
ns_dict = {"name": ns_name, "children": [], }
135135
jazzy_cfg['custom_categories'].insert(idx, ns_dict)
136136

137+
namespace_to_has_route_auth_list = {}
138+
137139
for namespace in api.namespaces.values():
138-
self.namespace_to_has_route_auth_list[namespace] = set()
140+
namespace_to_has_route_auth_list[namespace] = set()
139141
if namespace.routes:
140142
for route in namespace.routes:
141143
auth_types = set(map(lambda x: x.strip(), route.attrs.get('auth').split(',')))
142144
if 'noauth' not in auth_types:
143-
self.namespace_to_has_route_auth_list[namespace].add(
145+
namespace_to_has_route_auth_list.setdefault(namespace, set()).add(
144146
route.attrs.get('auth'))
145147
else:
146-
self.namespace_to_has_route_auth_list[namespace].add(
148+
namespace_to_has_route_auth_list.setdefault(namespace, set()).add(
147149
'user')
148150

151+
self.namespace_to_has_route_auth_list = {
152+
k: sorted(v)
153+
for k, v in namespace_to_has_route_auth_list.items()
154+
}
155+
149156
with self.output_to_relative_path('DBSDKImportsGenerated.h'):
150157
self._generate_all_imports(api)
151158

0 commit comments

Comments
 (0)