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

Side by Side Diff: build/android/gyp/jar_toc.py

Issue 269943005: Add android_library template (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « base/BUILD.gn ('k') | build/android/gyp/javac.py » ('j') | 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 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 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 """Creates a TOC file from a Java jar. 7 """Creates a TOC file from a Java jar.
8 8
9 The TOC file contains the non-package API of the jar. This includes all 9 The TOC file contains the non-package API of the jar. This includes all
10 public/protected/package classes/functions/members and the values of static 10 public/protected/package classes/functions/members and the values of static
11 final variables (members with package access are kept because in some cases we 11 final variables (members with package access are kept because in some cases we
12 have multiple libraries with the same package, particularly test+non-test). Some 12 have multiple libraries with the same package, particularly test+non-test). Some
13 other information (major/minor javac version) is also included. 13 other information (major/minor javac version) is also included.
14 14
15 This TOC file then can be used to determine if a dependent library should be 15 This TOC file then can be used to determine if a dependent library should be
16 rebuilt when this jar changes. I.e. any change to the jar that would require a 16 rebuilt when this jar changes. I.e. any change to the jar that would require a
17 rebuild, will have a corresponding change in the TOC file. 17 rebuild, will have a corresponding change in the TOC file.
18 """ 18 """
19 19
20 import optparse 20 import optparse
21 import os
21 import re 22 import re
22 import sys 23 import sys
23 import zipfile 24 import zipfile
24 25
25 from util import build_utils 26 from util import build_utils
26 from util import md5_check 27 from util import md5_check
27 28
28 29
29 def GetClassesInZipFile(zip_file): 30 def GetClassesInZipFile(zip_file):
30 classes = [] 31 classes = []
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 81
81 def DoJarToc(options): 82 def DoJarToc(options):
82 jar_path = options.jar_path 83 jar_path = options.jar_path
83 toc_path = options.toc_path 84 toc_path = options.toc_path
84 record_path = '%s.md5.stamp' % toc_path 85 record_path = '%s.md5.stamp' % toc_path
85 md5_check.CallAndRecordIfStale( 86 md5_check.CallAndRecordIfStale(
86 lambda: UpdateToc(jar_path, toc_path), 87 lambda: UpdateToc(jar_path, toc_path),
87 record_path=record_path, 88 record_path=record_path,
88 input_paths=[jar_path], 89 input_paths=[jar_path],
90 force=not os.path.exists(toc_path),
89 ) 91 )
90 build_utils.Touch(toc_path) 92 build_utils.Touch(toc_path, fail_if_missing=True)
91 93
92 94
93 def main(): 95 def main():
94 parser = optparse.OptionParser() 96 parser = optparse.OptionParser()
95 build_utils.AddDepfileOption(parser) 97 build_utils.AddDepfileOption(parser)
96 98
97 parser.add_option('--jar-path', help='Input .jar path.') 99 parser.add_option('--jar-path', help='Input .jar path.')
98 parser.add_option('--toc-path', help='Output .jar.TOC path.') 100 parser.add_option('--toc-path', help='Output .jar.TOC path.')
99 parser.add_option('--stamp', help='Path to touch on success.') 101 parser.add_option('--stamp', help='Path to touch on success.')
100 102
101 options, _ = parser.parse_args() 103 options, _ = parser.parse_args()
102 104
103 DoJarToc(options) 105 DoJarToc(options)
104 106
105 if options.depfile: 107 if options.depfile:
106 build_utils.WriteDepfile( 108 build_utils.WriteDepfile(
107 options.depfile, 109 options.depfile,
108 build_utils.GetPythonDependencies()) 110 build_utils.GetPythonDependencies())
109 111
110 if options.stamp: 112 if options.stamp:
111 build_utils.Touch(options.stamp) 113 build_utils.Touch(options.stamp)
112 114
113 115
114 if __name__ == '__main__': 116 if __name__ == '__main__':
115 sys.exit(main()) 117 sys.exit(main())
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | build/android/gyp/javac.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698