MCPcopy
hub / github.com/ampproject/amphtml / GenValidatorProtoGeneratedJs

Function GenValidatorProtoGeneratedJs

validator/build.py:179–212  ·  view source on GitHub ↗

Calls validator_gen_js to generate validator-proto-generated.js. Args: out_dir: directory name of the output directory. Must not have slashes, dots, etc.

(out_dir)

Source from the content-addressed store, hash-verified

177
178
179def GenValidatorProtoGeneratedJs(out_dir):
180 """Calls validator_gen_js to generate validator-proto-generated.js.
181
182 Args:
183 out_dir: directory name of the output directory. Must not have slashes,
184 dots, etc.
185 """
186 logging.info('entering ...')
187 assert re.match(r'^[a-zA-Z_\-0-9]+$', out_dir), 'bad out_dir: %s' % out_dir
188
189 # These imports happen late, within this method because they don't necessarily
190 # exist when the module starts running, and the ones that probably do
191 # are checked by CheckPrereqs.
192 # pylint: disable=g-import-not-at-top
193 from google.protobuf import text_format
194 from google.protobuf import descriptor
195 from dist import validator_pb2
196 import validator_gen_js
197 # pylint: enable=g-import-not-at-top
198 out = []
199 validator_gen_js.GenerateValidatorGeneratedJs(
200 specfile=None,
201 validator_pb2=validator_pb2,
202 generate_proto_only=True,
203 generate_spec_only=False,
204 text_format=text_format,
205 html_format=None,
206 descriptor=descriptor,
207 out=out)
208 out.append('')
209 f = open('%s/validator-proto-generated.js' % out_dir, 'w')
210 f.write('\n'.join(out))
211 f.close()
212 logging.info('... done')
213
214
215def GenValidatorGeneratedJs(out_dir):

Callers 1

MainFunction · 0.85

Calls 5

openFunction · 0.85
infoMethod · 0.80
appendMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected