Bring build scripts to AMBuild 2.2

This commit is contained in:
Kenzzer
2023-02-18 23:39:16 +01:00
parent 0c6274058e
commit 2824a307e4
8 changed files with 789 additions and 640 deletions
+35 -37
View File
@@ -1,41 +1,39 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
import urllib.request
from ambuild.command import Command
from ambuild.command import ShellCommand
import os, sys
class IterateDebugInfoCommand(Command):
def run(self, master, job):
pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'rt')
for debug_info in pdblog:
debug_info = os.path.join(AMBuild.outputFolder, debug_info.strip())
job.AddCommand(SymbolCommand(debug_info, symbolServer))
pdblog.close()
class SymbolCommand(ShellCommand):
def __init__(self, debugFile, symbolServer):
self.serverResponse = None
self.symbolServer = symbolServer
if AMBuild.target['platform'] == 'linux':
cmdstring = "dump_syms {0} {1}".format(debugFile, os.path.dirname(debugFile))
elif AMBuild.target['platform'] == 'darwin':
cmdstring = "dump_syms {0}".format(debugFile)
elif AMBuild.target['platform'] == 'windows':
cmdstring = "dump_syms.exe {0}".format(debugFile)
ShellCommand.__init__(self, cmdstring)
def run(self, master, job):
ShellCommand.run(self, master, job)
if self.stdout != None and len(self.stdout) > 0:
request = urllib.request.Request(symbolServer, self.stdout.encode('utf-8'))
request.add_header("Content-Type", "text/plain")
self.serverResponse = urllib.request.urlopen(request).read().decode('utf-8')
def spew(self, runner):
if self.stderr != None and len(self.stderr) > 0:
runner.PrintOut(self.stderr)
if self.serverResponse != None and len(self.serverResponse) > 0:
runner.PrintOut(self.serverResponse)
UPLOAD_SCRIPT = os.path.join(Extension.sm_root, 'tools', 'buildbot', 'upload_symbols.py')
if 'BREAKPAD_SYMBOL_SERVER' in os.environ:
symbolServer = os.environ['BREAKPAD_SYMBOL_SERVER']
job = AMBuild.AddJob('breakpad-symbols')
job.AddCommand(IterateDebugInfoCommand())
symbolServer = os.environ['BREAKPAD_SYMBOL_SERVER']
builder.SetBuildFolder('breakpad-symbols')
for cxx_task in Extension.extensions:
if cxx_task.target.platform in ['windows']:
debug_entry = cxx_task.debug
else:
debug_entry = cxx_task.binary
debug_file = os.path.join(builder.buildPath, debug_entry.path)
if cxx_task.target.platform == 'linux':
argv = ['dump_syms', debug_file, os.path.dirname(debug_file)]
elif cxx_task.target.platform == 'mac':
# Required once dump_syms is updated on the slaves.
#argv = ['dump_syms', '-g', debug_file + '.dSYM', debug_file]
argv = ['dump_syms', debug_file + '.dSYM']
elif cxx_task.target.platform == 'windows':
argv = ['dump_syms.exe', debug_file]
plat_dir = os.path.dirname(debug_file)
bin_dir = os.path.split(plat_dir)[0]
symbol_file = '{}-{}-{}.breakpad'.format(
os.path.split(bin_dir)[1],
cxx_task.target.platform,
cxx_task.target.arch)
argv = [sys.executable, UPLOAD_SCRIPT, symbol_file] + argv
builder.AddCommand(
inputs = [UPLOAD_SCRIPT, debug_entry],
argv = argv,
outputs = [symbol_file]
)