mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[flutter_runner] Don't build far files twice (flutter/engine#13397)
This commit is contained in:
parent
caca719e6c
commit
be943c8fc2
@ -16,7 +16,6 @@ import sys
|
||||
import tempfile
|
||||
|
||||
from gather_flutter_runner_artifacts import CreateMetaPackage, CopyPath
|
||||
from gen_package import CreateFarPackage
|
||||
|
||||
_script_dir = os.path.abspath(os.path.join(os.path.realpath(__file__), '..'))
|
||||
_src_root_dir = os.path.join(_script_dir, '..', '..', '..')
|
||||
@ -122,18 +121,15 @@ def CopyToBucketWithMode(source, destination, aot, product, runner_type):
|
||||
mode = 'aot' if aot else 'jit'
|
||||
product_suff = '_product' if product else ''
|
||||
runner_name = '%s_%s%s_runner' % (runner_type, mode, product_suff)
|
||||
far_dir_name = '%s_far' % runner_name
|
||||
far_name = runner_name + '-0.far'
|
||||
source_root = os.path.join(_out_dir, source)
|
||||
far_base = os.path.join(source_root, far_dir_name)
|
||||
CreateMetaPackage(far_base, runner_name)
|
||||
pm_bin = GetPMBinPath()
|
||||
key_path = os.path.join(_script_dir, 'development.key')
|
||||
|
||||
destination = os.path.join(_bucket_directory, destination, mode)
|
||||
CreateFarPackage(pm_bin, far_base, key_path, destination)
|
||||
patched_sdk_dirname = '%s_runner_patched_sdk' % runner_type
|
||||
patched_sdk_dir = os.path.join(source_root, patched_sdk_dirname)
|
||||
dest_sdk_path = os.path.join(destination, patched_sdk_dirname)
|
||||
CopyPath(
|
||||
os.path.join(source_root, far_name), os.path.join(destination, far_name))
|
||||
if not os.path.exists(dest_sdk_path):
|
||||
CopyPath(patched_sdk_dir, dest_sdk_path)
|
||||
CopyGenSnapshotIfExists(source_root, destination)
|
||||
|
||||
@ -24,7 +24,8 @@ def GenerateManifest(package_dir):
|
||||
common_prefix = os.path.commonprefix([root, package_dir])
|
||||
rel_path = os.path.relpath(os.path.join(root, f), common_prefix)
|
||||
from_package = os.path.abspath(os.path.join(package_dir, rel_path))
|
||||
assert from_package, 'Failed to create from_package for %s' % os.path.join(root, f)
|
||||
assert from_package, 'Failed to create from_package for %s' % os.path.join(
|
||||
root, f)
|
||||
full_paths.append('%s=%s' % (rel_path, from_package))
|
||||
parent_dir = os.path.abspath(os.path.join(package_dir, os.pardir))
|
||||
manifest_file_name = os.path.basename(package_dir) + '.manifest'
|
||||
@ -35,22 +36,6 @@ def GenerateManifest(package_dir):
|
||||
return manifest_path
|
||||
|
||||
|
||||
def CreateFarPackage(pm_bin, package_dir, signing_key, dst_dir):
|
||||
manifest_path = GenerateManifest(package_dir)
|
||||
|
||||
pm_command_base = [
|
||||
pm_bin, '-m', manifest_path, '-k', signing_key, '-o', dst_dir
|
||||
]
|
||||
|
||||
# Build the package
|
||||
subprocess.check_output(pm_command_base + ['build'])
|
||||
|
||||
# Archive the package
|
||||
subprocess.check_output(pm_command_base + ['archive'])
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
@ -106,27 +91,42 @@ def main():
|
||||
try:
|
||||
pm_commands = [
|
||||
['build'],
|
||||
['archive', '--output='+ os.path.join(os.path.dirname(output_dir), args.far_name + "-0")],
|
||||
[
|
||||
'archive', '--output=' +
|
||||
os.path.join(os.path.dirname(output_dir), args.far_name + "-0")
|
||||
],
|
||||
]
|
||||
for pm_command in pm_commands:
|
||||
pm_command_args = pm_command_base + pm_command
|
||||
sys.stderr.write("===== Running %s\n" % pm_command_args)
|
||||
subprocess.check_output(pm_command_args)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print('==================== Manifest contents =========================================')
|
||||
print(
|
||||
'==================== Manifest contents ========================================='
|
||||
)
|
||||
with open(manifest_file, 'r') as manifest:
|
||||
sys.stdout.write(manifest.read())
|
||||
print('==================== End manifest contents =====================================')
|
||||
print(
|
||||
'==================== End manifest contents ====================================='
|
||||
)
|
||||
meta_contents_path = os.path.join(output_dir, 'meta', 'contents')
|
||||
if os.path.exists(meta_contents_path):
|
||||
print('==================== meta/contents =============================================')
|
||||
print(
|
||||
'==================== meta/contents ============================================='
|
||||
)
|
||||
with open(meta_contents_path, 'r') as meta_contents:
|
||||
sys.stdout.write(meta_contents.read())
|
||||
print('==================== End meta/contents =========================================')
|
||||
print('==================== Strace output =============================================')
|
||||
print(
|
||||
'==================== End meta/contents ========================================='
|
||||
)
|
||||
print(
|
||||
'==================== Strace output ============================================='
|
||||
)
|
||||
with open(strace_out, 'r') as strace:
|
||||
sys.stdout.write(strace.read())
|
||||
print('==================== End strace output =========================================')
|
||||
print(
|
||||
'==================== End strace output ========================================='
|
||||
)
|
||||
raise
|
||||
|
||||
return 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user