def CopyToBucket(source, destination): source = os.path.join(_out_dir, source, 'flutter_jit_runner_far') CreateMetaPackage(source) pm_bin = GetPMBinPath() key_path = os.path.join(_script_dir, 'development.key') destination = os.path.join(_bucket_directory, destination) CreateFarPackage(pm_bin, source, key_path, destination)
def main(): parser = argparse.ArgumentParser() parser.add_argument('--pm-bin', dest='pm_bin', action='store', required=True) parser.add_argument('--package-dir', dest='package_dir', action='store', required=True) parser.add_argument('--signing-key', dest='signing_key', action='store', required=True) parser.add_argument('--manifest-file', dest='manifest_file', action='store', required=False) parser.add_argument('--far-name', dest='far_name', action='store', required=False) args = parser.parse_args() assert os.path.exists(args.pm_bin) assert os.path.exists(args.package_dir) assert os.path.exists(args.signing_key) pkg_dir = args.package_dir if not os.path.exists(os.path.join(pkg_dir, 'meta', 'package')): CreateMetaPackage(pkg_dir, args.far_name) manifest_file = None if args.manifest_file is not None: assert os.path.exists(args.manifest_file) manifest_file = args.manifest_file else: manifest_file = GenerateManifest(args.package_dir) pm_command_base = [ args.pm_bin, '-o', os.path.abspath(os.path.join(pkg_dir, os.pardir)), '-k', args.signing_key, '-m', manifest_file, ] # Build the package subprocess.check_call(pm_command_base + ['build']) # Archive the package subprocess.check_call(pm_command_base + ['archive']) return 0
def CopyToBucket(source, destination, product=False): runner_name = 'flutter_jit_runner' if product: runner_name = 'flutter_jit_product_runner' far_dir = '%s_far' % runner_name source_root = os.path.join(_out_dir, source) source = os.path.join(source_root, far_dir) CreateMetaPackage(source, runner_name) pm_bin = GetPMBinPath() key_path = os.path.join(_script_dir, 'development.key') destination = os.path.join(_bucket_directory, destination) CreateFarPackage(pm_bin, source, key_path, destination) patched_sdk_dir = os.path.join(source_root, 'flutter_runner_patched_sdk') dest_sdk_path = os.path.join(destination, 'flutter_runner_patched_sdk') CopyPath(patched_sdk_dir, dest_sdk_path)
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 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_dir = os.path.join(source_root, 'flutter_runner_patched_sdk') dest_sdk_path = os.path.join(destination, 'flutter_runner_patched_sdk') if not os.path.exists(dest_sdk_path): CopyPath(patched_sdk_dir, dest_sdk_path) CopyGenSnapshotIfExists(source_root, destination)
def main(): parser = argparse.ArgumentParser() parser.add_argument('--pm-bin', dest='pm_bin', action='store', required=True) parser.add_argument('--package-dir', dest='package_dir', action='store', required=True) parser.add_argument('--signing-key', dest='signing_key', action='store', required=True) parser.add_argument('--manifest-file', dest='manifest_file', action='store', required=False) parser.add_argument('--far-name', dest='far_name', action='store', required=False) args = parser.parse_args() assert os.path.exists(args.pm_bin) assert os.path.exists(args.package_dir) assert os.path.exists(args.signing_key) pkg_dir = args.package_dir if not os.path.exists(os.path.join(pkg_dir, 'meta', 'package')): CreateMetaPackage(pkg_dir, args.far_name) manifest_file = None if args.manifest_file is not None: assert os.path.exists(args.manifest_file) manifest_file = args.manifest_file else: manifest_file = GenerateManifest(args.package_dir) pm_command_base = [ args.pm_bin, '-o', os.path.abspath(os.path.join(pkg_dir, os.pardir)), '-k', args.signing_key, '-m', manifest_file, ] # Build and then archive the package # Use check_output so if anything goes wrong we get the output. try: subprocess.check_output(pm_command_base + ['build']) subprocess.check_output(pm_command_base + ['archive']) except subprocess.CalledProcessError as e: print( '==================== Manifest contents =========================================' ) with open(manifest_file, 'r') as manifest: print(manifest.read()) print( '==================== End manifest contents =====================================' ) raise return 0
def main(): parser = argparse.ArgumentParser() parser.add_argument('--pm-bin', dest='pm_bin', action='store', required=True) parser.add_argument('--package-dir', dest='package_dir', action='store', required=True) parser.add_argument('--manifest-file', dest='manifest_file', action='store', required=False) parser.add_argument('--manifest-json-file', dest='manifest_json_file', action='store', required=True) parser.add_argument('--far-name', dest='far_name', action='store', required=False) parser.add_argument('--api-level', dest='api_level', action='store', required=False) args = parser.parse_args() assert os.path.exists(args.pm_bin) assert os.path.exists(args.package_dir) pkg_dir = args.package_dir if not os.path.exists(os.path.join(pkg_dir, 'meta', 'package')): CreateMetaPackage(pkg_dir, args.far_name) output_dir = os.path.abspath(pkg_dir + '_out') if not os.path.exists(output_dir): os.makedirs(output_dir) manifest_file = None if args.manifest_file is not None: assert os.path.exists(args.manifest_file) manifest_file = args.manifest_file else: manifest_file = GenerateManifest(args.package_dir) pm_command_base = [ args.pm_bin, '-o', output_dir, '-n', args.far_name, '-m', manifest_file, ] # Build and then archive the package # Use check_output so if anything goes wrong we get the output. try: build_command = [ 'build', '--output-package-manifest', args.manifest_json_file ] if args.api_level is not None: build_command = ['--api-level', args.api_level] + build_command archive_command = [ 'archive', '--output=' + os.path.join(os.path.dirname(output_dir), args.far_name + "-0") ] pm_commands = [build_command, archive_command] for pm_command in pm_commands: subprocess.check_output(pm_command_base + pm_command) except subprocess.CalledProcessError as e: print( '==================== Manifest contents =========================================' ) with open(manifest_file, 'r') as manifest: sys.stdout.write(manifest.read()) print( '==================== End manifest contents =====================================' ) meta_contents_path = os.path.join(output_dir, 'meta', 'contents') if os.path.exists(meta_contents_path): print( '==================== meta/contents =============================================' ) with open(meta_contents_path, 'r') as meta_contents: sys.stdout.write(meta_contents.read()) print( '==================== End meta/contents =========================================' ) raise return 0
def main(): parser = argparse.ArgumentParser() parser.add_argument('--pm-bin', dest='pm_bin', action='store', required=True) parser.add_argument( '--package-dir', dest='package_dir', action='store', required=True) parser.add_argument( '--signing-key', dest='signing_key', action='store', required=True) parser.add_argument( '--manifest-file', dest='manifest_file', action='store', required=False) parser.add_argument( '--far-name', dest='far_name', action='store', required=False) args = parser.parse_args() assert os.path.exists(args.pm_bin) assert os.path.exists(args.package_dir) assert os.path.exists(args.signing_key) pkg_dir = args.package_dir if not os.path.exists(os.path.join(pkg_dir, 'meta', 'package')): CreateMetaPackage(pkg_dir, args.far_name) output_dir = os.path.abspath(pkg_dir + '_out') if not os.path.exists(output_dir): os.makedirs(output_dir) manifest_file = None if args.manifest_file is not None: assert os.path.exists(args.manifest_file) manifest_file = args.manifest_file else: manifest_file = GenerateManifest(args.package_dir) strace_out = os.path.join(output_dir, 'strace_out') pm_command_base = [ 'strace', '-f', '-o', strace_out, args.pm_bin, '-o', output_dir, '-k', args.signing_key, '-m', manifest_file, ] # Build and then archive the package # Use check_output so if anything goes wrong we get the output. try: pm_commands = [ ['build'], ['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 =========================================') with open(manifest_file, 'r') as manifest: sys.stdout.write(manifest.read()) print('==================== End manifest contents =====================================') meta_contents_path = os.path.join(output_dir, 'meta', 'contents') if os.path.exists(meta_contents_path): 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 =============================================') with open(strace_out, 'r') as strace: sys.stdout.write(strace.read()) print('==================== End strace output =========================================') raise return 0