7""" Merges the debug symbols and uploads them to cipd.
24BUILD_ROOT_DIR = os.path.abspath(os.path.join(os.path.realpath(__file__),
'..',
'..',
'..',
'..'))
28 return platform.system() ==
'Linux'
34 return os.path.abspath(out_dir)
38 dir_name = os.path.basename(os.path.normpath(out_dir))
40package: flutter/fuchsia-debug-symbols-%s
41description: Flutter and Dart runner debug symbols for Fuchsia. Target architecture %s.
44""" % (target_arch, target_arch)
45 for symbol_dir
in symbol_dirs:
46 symbol_dir_name = os.path.basename(os.path.normpath(symbol_dir))
47 data =
'\n - dir: %s' % (symbol_dir_name)
48 pkg_def = pkg_def + data
55 yaml_file = os.path.join(_packaging_dir,
'debug_symbols.cipd.yaml')
56 with open(yaml_file,
'w')
as f:
63 '''Check to see if the current package/tag combo has been published'''
71 stdout = subprocess.check_output(command)
72 stdout = stdout
if isinstance(stdout, str)
else stdout.decode(
'UTF-8')
73 match = re.search(
r'No matching instances\.', stdout)
82 tag =
'git_revision:%s' % engine_version
83 package_name =
'flutter/fuchsia-debug-symbols-%s' % target_arch
86 print(
'CIPD package %s tag %s already exists!' % (package_name, tag))
88 if upload
and IsLinux()
and not already_exists:
98 '-verification-timeout',
103 'cipd',
'pkg-build',
'-pkg-def', cipd_yaml,
'-out',
104 os.path.join(_packaging_dir,
'fuchsia-debug-symbols-%s.cipd' % target_arch)
111 for tries
in range(num_tries):
113 subprocess.check_call(command, cwd=_packaging_dir)
115 except subprocess.CalledProcessError
as error:
116 print(
'Failed %s times.\nError was: %s' % (tries + 1, error))
117 if tries == num_tries - 1:
124 internal_symbol_dirs = []
125 for src_dir, _, filenames
in os.walk(dirA):
126 for filename
in filenames:
131 if 'dbg_success' in filename:
133 src = os.path.join(src_dir, filename)
134 dest_dir = os.path.join(dirB, os.path.relpath(src_dir, dirA))
136 os.makedirs(dest_dir)
137 internal_symbol_dirs.append(dest_dir)
140 dest = os.path.join(dest_dir, filename)
141 if os.path.exists(dest):
143 tokens = os.path.split(dest)
144 name = os.path.join(tokens[-2], tokens[-1])
145 print(
'%s already exists in destination; skipping linking' % name)
148 return internal_symbol_dirs
153 for directory
in dirs:
154 if os.path.isabs(directory):
155 results.append(directory)
157 results.append(os.path.join(BUILD_ROOT_DIR, directory))
162 parser = argparse.ArgumentParser()
168 help=
'Space separated list of directories that contain the debug symbols.'
174 default=tempfile.mkdtemp(),
176 'Output directory where the executables will be placed defaults to an '
177 'empty temp directory'
180 parser.add_argument(
'--target-arch', type=str, choices=[
'x64',
'arm64'], required=
True)
181 parser.add_argument(
'--engine-version', required=
True, help=
'Specifies the flutter engine SHA.')
183 parser.add_argument(
'--upload', default=
False, action=
'store_true')
185 args = parser.parse_args()
188 for symbol_dir
in symbol_dirs:
189 assert os.path.exists(symbol_dir)
and os.path.isdir(symbol_dir)
191 out_dir = args.out_dir
193 if os.path.exists(out_dir):
194 print(
'Directory: %s is not empty, deleting it.' % out_dir)
195 shutil.rmtree(out_dir)
198 internal_symbol_dirs = []
199 for symbol_dir
in symbol_dirs:
203 internal_symbol_dirs = list(
set(internal_symbol_dirs))
205 arch = args.target_arch
211 should_upload = args.upload
212 engine_version = args.engine_version
213 if not engine_version:
214 engine_version =
'HEAD'
215 should_upload =
False
221if __name__ ==
'__main__':
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
def HardlinkContents(dirA, dirB)
def WriteCIPDDefinition(target_arch, out_dir, symbol_dirs)
def ProcessCIPDPackage(upload, cipd_yaml, engine_version, out_dir, target_arch)
def CreateCIPDDefinition(target_arch, out_dir, symbol_dirs)
def CheckCIPDPackageExists(package_name, tag)
def CalculateAbsoluteDirs(dirs)
def GetPackagingDir(out_dir)
def print(*args, **kwargs)