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

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

Issue 2341903002: Building cronet targets multiple times now reports "no work to do" (Closed)
Patch Set: Created 4 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 | « components/cronet/tools/check_no_neon.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 import tempfile 10 import tempfile
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 help='Directory containing .java files.') 45 help='Directory containing .java files.')
46 parser.add_option('--src-jars', action="append", 46 parser.add_option('--src-jars', action="append",
47 help='A list of source jars to include in addition to source files.') 47 help='A list of source jars to include in addition to source files.')
48 parser.add_option('--jar-path', help='Jar output path.') 48 parser.add_option('--jar-path', help='Jar output path.')
49 parser.add_option('--stamp', help='Path to touch on success.') 49 parser.add_option('--stamp', help='Path to touch on success.')
50 50
51 options, _ = parser.parse_args() 51 options, _ = parser.parse_args()
52 52
53 # A temporary directory to put the output of jar files. 53 # A temporary directory to put the output of jar files.
54 unzipped_jar_path = None 54 unzipped_jar_path = None
55 generated_src_dirs = []
55 if options.src_jars: 56 if options.src_jars:
56 unzipped_jar_path = tempfile.mkdtemp(dir=os.path.dirname(options.jar_path)) 57 unzipped_jar_path = tempfile.mkdtemp(dir=os.path.dirname(options.jar_path))
58 generated_src_dirs.append(unzipped_jar_path)
57 jar_list = [] 59 jar_list = []
58 for gn_list in options.src_jars: 60 for gn_list in options.src_jars:
59 jar_list.extend(build_utils.ParseGnList(gn_list)) 61 jar_list.extend(build_utils.ParseGnList(gn_list))
60 62
61 for jar in jar_list: 63 for jar in jar_list:
62 UnzipSourceJar(jar, unzipped_jar_path) 64 UnzipSourceJar(jar, unzipped_jar_path)
63 65
64 src_dirs = [] 66 src_dirs = []
65 for src_dir in options.src_dir: 67 for src_dir in options.src_dir:
66 src_dirs.extend(build_utils.ParseGnList(src_dir)) 68 src_dirs.extend(build_utils.ParseGnList(src_dir))
67 if unzipped_jar_path:
68 src_dirs += [unzipped_jar_path]
69 69
70 for src_dir in src_dirs: 70 for src_dir in src_dirs + generated_src_dirs:
71 JarSources(src_dir, options.jar_path) 71 JarSources(src_dir, options.jar_path)
72 72
73 if options.depfile: 73 if options.depfile:
74 deps = [] 74 deps = []
75 for src_dir in src_dirs: 75 for src_dir in src_dirs:
76 for root, _, filenames in os.walk(src_dir): 76 for root, _, filenames in os.walk(src_dir):
77 deps.extend(os.path.join(root, f) for f in filenames) 77 deps.extend(os.path.join(root, f) for f in filenames)
78 # Srcjar deps already captured in GN rules (no need to list them here).
xunjieli 2016/09/14 19:43:42 Srcjar deps aren't explicitly listed in the GN rul
agrieve 2016/09/14 19:59:40 This change marks the srcjar_deps as inputs to the
xunjieli 2016/09/14 20:02:16 If the dependency is added, can we get rid of line
agrieve 2016/09/14 20:33:03 The dependency in GN is only for generated files.
xunjieli 2016/09/14 20:34:50 Acknowledged. I see.
78 build_utils.WriteDepfile(options.depfile, options.jar_path, deps) 79 build_utils.WriteDepfile(options.depfile, options.jar_path, deps)
79 80
80 # Clean up temporary output directory. 81 # Clean up temporary output directory.
81 if unzipped_jar_path: 82 if unzipped_jar_path:
82 build_utils.DeleteDirectory(unzipped_jar_path) 83 build_utils.DeleteDirectory(unzipped_jar_path)
83 84
84 if options.stamp: 85 if options.stamp:
85 build_utils.Touch(options.stamp) 86 build_utils.Touch(options.stamp)
86 87
87 if __name__ == '__main__': 88 if __name__ == '__main__':
88 sys.exit(main()) 89 sys.exit(main())
89 90
OLDNEW
« no previous file with comments | « components/cronet/tools/check_no_neon.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698