2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Generate java DescriptorProto file.
9 protobuf_lite_java_descriptor_proto.py {protoc} {java_out} {include} {proto_files}
11 This is a helper file for the protobuf_lite_java_gen_descriptor_proto action in
14 It performs the following steps:
15 1. Recursively deletes old java_out directory.
16 2. Creates java_out directory.
17 3. Generates Java descriptor proto file using protoc.
30 protoc_path
, java_out
, include
= argv
[1:4]
31 proto_files
= argv
[4:]
33 # Delete all old sources
34 if os
.path
.exists(java_out
):
35 shutil
.rmtree(java_out
)
37 # Create source directory
40 # Generate Java files using protoc
41 return subprocess
.call(
42 [protoc_path
, '--java_out', java_out
, '-I' + include
]
48 if __name__
== '__main__':
49 sys
.exit(main(sys
.argv
))