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

Side by Side Diff: chrome/tools/build/mac/tweak_info_plist

Issue 8824003: Breakpad: Compile Breakpad into Chromium by default on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Swap around Gyp options; use mac_breakpad_compiled_in Created 9 years 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 | « chrome/chrome_exe.gypi ('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 (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 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 # 7 #
8 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work 8 # Xcode supports build variable substitutions and CPP; sadly, that doesn't work
9 # because: 9 # because:
10 # 10 #
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 # No PDF entry exists. If one needs to be added, do so now. 167 # No PDF entry exists. If one needs to be added, do so now.
168 if add_keys: 168 if add_keys:
169 pdf_entry = {} 169 pdf_entry = {}
170 __AddPDFKeys(pdf_entry) 170 __AddPDFKeys(pdf_entry)
171 extensions.append(pdf_entry) 171 extensions.append(pdf_entry)
172 172
173 173
174 def _AddBreakpadKeys(plist, branding): 174 def _AddBreakpadKeys(plist, branding):
175 """Adds the Breakpad keys. This must be called AFTER _AddVersionKeys() and 175 """Adds the Breakpad keys. This must be called AFTER _AddVersionKeys() and
176 also requires the |branding| argument.""" 176 also requires the |branding| argument."""
177 plist['BreakpadURL'] = 'https://clients2.google.com/cr/report'
178 plist['BreakpadReportInterval'] = '3600' # Deliberately a string. 177 plist['BreakpadReportInterval'] = '3600' # Deliberately a string.
179 plist['BreakpadProduct'] = '%s_Mac' % branding 178 plist['BreakpadProduct'] = '%s_Mac' % branding
180 plist['BreakpadProductDisplay'] = branding 179 plist['BreakpadProductDisplay'] = branding
181 plist['BreakpadVersion'] = plist['CFBundleShortVersionString'] 180 plist['BreakpadVersion'] = plist['CFBundleShortVersionString']
182 # These are both deliberately strings and not boolean. 181 # These are both deliberately strings and not boolean.
183 plist['BreakpadSendAndExit'] = 'YES' 182 plist['BreakpadSendAndExit'] = 'YES'
184 plist['BreakpadSkipConfirm'] = 'YES' 183 plist['BreakpadSkipConfirm'] = 'YES'
185 184
186 185
187 def _RemoveBreakpadKeys(plist): 186 def _RemoveBreakpadKeys(plist):
(...skipping 19 matching lines...) Expand all
207 def _RemoveKeystoneKeys(plist): 206 def _RemoveKeystoneKeys(plist):
208 """Removes any set Keystone keys.""" 207 """Removes any set Keystone keys."""
209 _RemoveKeys(plist, 208 _RemoveKeys(plist,
210 'KSVersion', 209 'KSVersion',
211 'KSProductID', 210 'KSProductID',
212 'KSUpdateURL') 211 'KSUpdateURL')
213 212
214 213
215 def Main(argv): 214 def Main(argv):
216 parser = optparse.OptionParser('%prog [options] branding bundle-id') 215 parser = optparse.OptionParser('%prog [options] branding bundle-id')
217 parser.add_option('-b', dest='use_breakpad', action='store', type='int', 216 parser.add_option('--breakpad', dest='use_breakpad', action='store',
218 default=False, help='Enable Breakpad [1 or 0]') 217 type='int', default=False, help='Enable Breakpad [1 or 0]')
218 parser.add_option('--breakpad_uploads', dest='breakpad_uploads',
219 action='store', type='int', default=False,
220 help='Enable Breakpad\'s uploading of crash dumps [1 or 0]')
219 parser.add_option('-k', dest='use_keystone', action='store', type='int', 221 parser.add_option('-k', dest='use_keystone', action='store', type='int',
220 default=False, help='Enable Keystone [1 or 0]') 222 default=False, help='Enable Keystone [1 or 0]')
221 parser.add_option('-s', dest='add_svn_info', action='store', type='int', 223 parser.add_option('-s', dest='add_svn_info', action='store', type='int',
222 default=True, help='Add SVN metadata [1 or 0]') 224 default=True, help='Add SVN metadata [1 or 0]')
223 parser.add_option('-p', dest='add_pdf_support', action='store', type='int', 225 parser.add_option('-p', dest='add_pdf_support', action='store', type='int',
224 default=False, help='Add PDF file handler support [1 or 0]') 226 default=False, help='Add PDF file handler support [1 or 0]')
225 (options, args) = parser.parse_args(argv) 227 (options, args) = parser.parse_args(argv)
226 228
227 if len(args) < 2: 229 if len(args) < 2:
228 print >>sys.stderr, parser.get_usage() 230 print >>sys.stderr, parser.get_usage()
229 return 1 231 return 1
230 232
231 # Extract remaining arguments. 233 # Extract remaining arguments.
232 branding = args[0] 234 branding = args[0]
233 bundle_identifier = args[1] 235 bundle_identifier = args[1]
234 236
235 # Read the plist into its parsed format. 237 # Read the plist into its parsed format.
236 DEST_INFO_PLIST = os.path.join(env['TARGET_BUILD_DIR'], env['INFOPLIST_PATH']) 238 DEST_INFO_PLIST = os.path.join(env['TARGET_BUILD_DIR'], env['INFOPLIST_PATH'])
237 plist = plistlib.readPlist(DEST_INFO_PLIST) 239 plist = plistlib.readPlist(DEST_INFO_PLIST)
238 240
239 # Insert the product version. 241 # Insert the product version.
240 if not _AddVersionKeys(plist): 242 if not _AddVersionKeys(plist):
241 return 2 243 return 2
242 244
243 # Add Breakpad if configured to do so. 245 # Add Breakpad if configured to do so.
244 if options.use_breakpad: 246 if options.use_breakpad:
245 _AddBreakpadKeys(plist, branding) 247 _AddBreakpadKeys(plist, branding)
248 if options.breakpad_uploads:
249 plist['BreakpadURL'] = 'https://clients2.google.com/cr/report'
250 else:
251 # This allows crash dumping to a file without uploading the
252 # dump, for testing purposes. Breakpad does not recognise
253 # "none" as a special value, but this does stop crash dump
254 # uploading from happening. We need to specify something
255 # because if "BreakpadURL" is not present, Breakpad will not
256 # register its crash handler and no crash dumping will occur.
257 plist['BreakpadURL'] = 'none'
246 else: 258 else:
247 _RemoveBreakpadKeys(plist) 259 _RemoveBreakpadKeys(plist)
248 260
249 # Only add Keystone in Release builds. 261 # Only add Keystone in Release builds.
250 if options.use_keystone and env['CONFIGURATION'] == 'Release': 262 if options.use_keystone and env['CONFIGURATION'] == 'Release':
251 _AddKeystoneKeys(plist, bundle_identifier) 263 _AddKeystoneKeys(plist, bundle_identifier)
252 else: 264 else:
253 _RemoveKeystoneKeys(plist) 265 _RemoveKeystoneKeys(plist)
254 266
255 # Adds or removes any SVN keys. 267 # Adds or removes any SVN keys.
256 _DoSVNKeys(plist, options.add_svn_info) 268 _DoSVNKeys(plist, options.add_svn_info)
257 269
258 # Adds or removes the PDF file handler entry. 270 # Adds or removes the PDF file handler entry.
259 _DoPDFKeys(plist, options.add_pdf_support) 271 _DoPDFKeys(plist, options.add_pdf_support)
260 272
261 # Now that all keys have been mutated, rewrite the file. 273 # Now that all keys have been mutated, rewrite the file.
262 temp_info_plist = tempfile.NamedTemporaryFile() 274 temp_info_plist = tempfile.NamedTemporaryFile()
263 plistlib.writePlist(plist, temp_info_plist.name) 275 plistlib.writePlist(plist, temp_info_plist.name)
264 276
265 # Info.plist will work perfectly well in any plist format, but traditionally 277 # Info.plist will work perfectly well in any plist format, but traditionally
266 # applications use xml1 for this, so convert it to ensure that it's valid. 278 # applications use xml1 for this, so convert it to ensure that it's valid.
267 proc = subprocess.Popen(['plutil', '-convert', 'xml1', '-o', DEST_INFO_PLIST, 279 proc = subprocess.Popen(['plutil', '-convert', 'xml1', '-o', DEST_INFO_PLIST,
268 temp_info_plist.name]) 280 temp_info_plist.name])
269 proc.wait() 281 proc.wait()
270 return proc.returncode 282 return proc.returncode
271 283
272 284
273 if __name__ == '__main__': 285 if __name__ == '__main__':
274 sys.exit(Main(sys.argv[1:])) 286 sys.exit(Main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « chrome/chrome_exe.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698