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

Side by Side Diff: components/cronet/tools/jar_src.py

Issue 2234113002: Include generated EffectiveConnectionType.java in cronet api jar and JavaDoc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 4 years, 4 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 | « components/cronet/tools/generate_javadoc.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
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2014 The Chromium Authors. All rights reserved. 3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import optparse 7 import optparse
8 import os 8 import os
9 import sys 9 import sys
10 10
(...skipping 10 matching lines...) Expand all
21 # options.src_dir so the .java file paths in the jar are correct. 21 # options.src_dir so the .java file paths in the jar are correct.
22 jar_cwd = src_dir 22 jar_cwd = src_dir
23 jar_path = os.path.abspath(jar_path) 23 jar_path = os.path.abspath(jar_path)
24 if os.path.exists(jar_path): 24 if os.path.exists(jar_path):
25 jar_cmd = ['jar', 'uf', jar_path, '.'] 25 jar_cmd = ['jar', 'uf', jar_path, '.']
26 else: 26 else:
27 jar_cmd = ['jar', 'cf', jar_path, '.'] 27 jar_cmd = ['jar', 'cf', jar_path, '.']
28 28
29 build_utils.CheckOutput(jar_cmd, cwd=jar_cwd) 29 build_utils.CheckOutput(jar_cmd, cwd=jar_cwd)
30 30
31 # Uncompress source jars so that they can be combined with other sources
32 def UnzipSourceJar(jar, unzipped_jar_path):
33 if os.path.exists(jar):
34 jar_cmd = ['jar', 'xf', '../../' + jar]
35 build_utils.CheckOutput(jar_cmd, cwd=unzipped_jar_path)
36 else:
37 raise Exception
kapishnikov 2016/08/11 17:59:22 It would be good to add the file name that does no
xunjieli 2016/08/11 20:20:21 Done.
38
31 39
32 def main(): 40 def main():
33 parser = optparse.OptionParser() 41 parser = optparse.OptionParser()
34 build_utils.AddDepfileOption(parser) 42 build_utils.AddDepfileOption(parser)
35 parser.add_option('--src-dir', action="append", 43 parser.add_option('--src-dir', action="append",
36 help='Directory containing .java files.') 44 help='Directory containing .java files.')
45 parser.add_option('--src-jars', action="append",
46 help='A list of source jars to include in addition to source files.')
37 parser.add_option('--jar-path', help='Jar output path.') 47 parser.add_option('--jar-path', help='Jar output path.')
38 parser.add_option('--stamp', help='Path to touch on success.') 48 parser.add_option('--stamp', help='Path to touch on success.')
39 49
40 options, _ = parser.parse_args() 50 options, _ = parser.parse_args()
41 51
52 # A temporary directory to put the output of jar files.
53 unzipped_jar_path = None
54 if options.src_jars:
55 unzipped_jar_path = os.path.join(os.path.dirname(options.jar_path), 'tmp')
56 build_utils.MakeDirectory(unzipped_jar_path)
57 jar_list = []
58 for gyp_list in options.src_jars:
59 jar_list.extend(build_utils.ParseGypList(gyp_list))
60
61 for jar in jar_list:
62 UnzipSourceJar(jar, unzipped_jar_path)
63
42 src_dirs = [] 64 src_dirs = []
43 for src_dir in options.src_dir: 65 for src_dir in options.src_dir:
44 src_dirs.extend(build_utils.ParseGypList(src_dir)) 66 src_dirs.extend(build_utils.ParseGypList(src_dir))
67 if unzipped_jar_path:
68 src_dirs += [unzipped_jar_path]
45 69
46 for src_dir in src_dirs: 70 for src_dir in src_dirs:
47 JarSources(src_dir, options.jar_path) 71 JarSources(src_dir, options.jar_path)
48 72
49 if options.depfile: 73 if options.depfile:
50 input_paths = [] 74 input_paths = []
51 for src_dir in src_dirs: 75 for src_dir in src_dirs:
52 for root, _, filenames in os.walk(src_dir): 76 for root, _, filenames in os.walk(src_dir):
53 input_paths.extend(os.path.join(root, f) for f in filenames) 77 input_paths.extend(os.path.join(root, f) for f in filenames)
54 build_utils.WriteDepfile(options.depfile, 78 build_utils.WriteDepfile(options.depfile,
55 input_paths + build_utils.GetPythonDependencies()) 79 input_paths + build_utils.GetPythonDependencies())
80 # Clean up temporary output directory.
81 if unzipped_jar_path:
82 build_utils.DeleteDirectory(unzipped_jar_path)
56 83
57 if options.stamp: 84 if options.stamp:
58 build_utils.Touch(options.stamp) 85 build_utils.Touch(options.stamp)
59 86
60 if __name__ == '__main__': 87 if __name__ == '__main__':
61 sys.exit(main()) 88 sys.exit(main())
62 89
OLDNEW
« no previous file with comments | « components/cronet/tools/generate_javadoc.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698