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

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

Issue 556933002: Remove protobuf lite for java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase before submit Created 6 years, 3 months 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
« no previous file with comments | « third_party/protobuf/protobuf_lite_java_descriptor_proto.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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'.format(namespace)
32 id_path = '{0}id'.format(namespace)
33 plugin_path = \
34 '{0}build/{0}plugins/{0}plugin'.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 id_element = profile.find(id_path)
42 if (id_element is not None and id_element.text == 'lite'):
43 for plugin in profile.findall(plugin_path):
44 artifact_element = plugin.find(artifact_path)
45 if (artifact_element is not None and
46 artifact_element.text == 'maven-compiler-plugin'):
47 for include in plugin.findall(include_path):
48 includes.append(include.text)
49
50 # Print result to stdout, one item on each line.
51 print '\n'.join(includes)
52
53 def usage():
54 print(__doc__);
55
56 if __name__ == '__main__':
57 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « third_party/protobuf/protobuf_lite_java_descriptor_proto.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698