| # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| """Generate java source files from protobufs |
| protoc_java.py {protoc} {proto_path} {java_out} {stamp_file} {proto_files} |
| This is a helper file for the genproto_java action in protoc_java.gypi. |
| It performs the following steps: |
| 1. Deletes all old sources (ensures deleted classes are not part of new jars). |
| 2. Creates source directory. |
| 3. Generates Java files using protoc. |
| 4. Creates a new stamp file. |
| protoc_path, proto_path, java_out, stamp_file = argv[1:5] |
| if os.path.exists(java_out): |
| # Create source directory |
| # Generate Java files using protoc |
| [protoc_path, '--proto_path', proto_path, '--java_out', java_out] |
| # Create a new stamp file |
| with file(stamp_file, 'a'): |
| os.utime(stamp_file, None) |
| if __name__ == '__main__': |