Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: third_party/protobuf/protobuf_lite_java_parse_pom.py

Issue 11347026: Check in protobuf java code and generate lite jar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment about java.gypi variables Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
5
6 """Parses the Maven pom.xml file for which files to include in a lite build.
7
8 Usage:
9 protobuf_lite_java_parse_pom.py {path to pom.xml}
10
11 This is a helper file for the protobuf_lite_java target in protobuf.gyp.
12
13 It parses the pom.xml file, and looks for all the includes specified in the
14 'lite' profile. It does not return and test includes.
15
16 The result is printed as one line per entry.
17 """
18
19 import sys
20
21 from xml.etree import ElementTree
22
23 def main(argv):
24 if (len(argv) < 2):
25 usage()
26 return 1
27
28 # Setup all file and XML query paths.
29 pom_path = argv[1]
30 namespace = "{http://maven.apache.org/POM/4.0.0}"
31 profile_path = '{0}profiles/{0}profile/{0}id/..'.format(namespace)
32 id_path = '{}id'.format(namespace)
33 plugin_path = \
34 '{0}build/{0}plugins/{0}plugin/{0}artifactId/..'.format(namespace)
35 artifact_path = '{0}artifactId'.format(namespace)
36 include_path = '{0}configuration/{0}includes/{0}include'.format(namespace)
37
38 # Parse XML file and store result in includes list.
39 includes = []
40 for profile in ElementTree.parse(pom_path).getroot().findall(profile_path):
41 if profile.find(id_path).text == 'lite':
42 for plugin in profile.findall(plugin_path):
43 if plugin.find(artifact_path).text == 'maven-compiler-plugin':
44 for include in plugin.findall(include_path):
45 includes.append(include.text)
46
47 # Print result to stdout, one item on each line.
48 print '\n'.join(includes)
49
50 def usage():
51 print(__doc__);
52
53 if __name__ == '__main__':
54 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698