Set the default ASan options for executables built with ASan on Linux.
[chromium-blink-merge.git] / third_party / protobuf / protobuf_lite_java_descriptor_proto.py
blob2967ce92ac40126dae61ed5d6f456bcdaba1319a
1 #!/usr/bin/env python
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.
8 Usage:
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
12 protobuf.gyp.
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.
18 """
20 import os
21 import shutil
22 import subprocess
23 import sys
25 def main(argv):
26 if len(argv) < 4:
27 usage()
28 return 1
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
38 os.makedirs(java_out)
40 # Generate Java files using protoc
41 return subprocess.call(
42 [protoc_path, '--java_out', java_out, '-I' + include]
43 + proto_files)
45 def usage():
46 print(__doc__);
48 if __name__ == '__main__':
49 sys.exit(main(sys.argv))