Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
create_macos_gen_snapshots Namespace Reference

Functions

 main ()
 
 embed_codesign_configuration (config_path, contents)
 
 zip_archive (dst)
 
 generate_gen_snapshot (directory, destination)
 

Variables

 buildroot_dir = os.path.abspath(os.path.join(os.path.realpath(__file__), '..', '..', '..', '..'))
 

Function Documentation

◆ embed_codesign_configuration()

create_macos_gen_snapshots.embed_codesign_configuration (   config_path,
  contents 
)

Definition at line 63 of file create_macos_gen_snapshots.py.

63def embed_codesign_configuration(config_path, contents):
64 with open(config_path, 'w') as file:
65 file.write('\n'.join(contents) + '\n')
66
67

◆ generate_gen_snapshot()

create_macos_gen_snapshots.generate_gen_snapshot (   directory,
  destination 
)

Definition at line 81 of file create_macos_gen_snapshots.py.

81def generate_gen_snapshot(directory, destination):
82 gen_snapshot_dir = os.path.join(directory, 'gen_snapshot')
83 if not os.path.isfile(gen_snapshot_dir):
84 print('Cannot find gen_snapshot at %s' % gen_snapshot_dir)
85 sys.exit(1)
86
87 subprocess.check_call(['xcrun', 'bitcode_strip', '-r', gen_snapshot_dir, '-o', destination])
88
89
void print(void *str)
Definition bridge.cpp:126

◆ main()

create_macos_gen_snapshots.main ( )

Definition at line 15 of file create_macos_gen_snapshots.py.

15def main():
16 parser = argparse.ArgumentParser(
17 description='Copies architecture-dependent gen_snapshot binaries to output dir'
18 )
19
20 parser.add_argument('--dst', type=str, required=True)
21 parser.add_argument('--clang-dir', type=str, default='clang_x64')
22 parser.add_argument('--x64-out-dir', type=str)
23 parser.add_argument('--arm64-out-dir', type=str)
24 parser.add_argument('--armv7-out-dir', type=str)
25 parser.add_argument('--zip', action='store_true', default=False)
26
27 args = parser.parse_args()
28
29 dst = (args.dst if os.path.isabs(args.dst) else os.path.join(buildroot_dir, args.dst))
30
31 # if dst folder does not exist create it.
32 if not os.path.exists(dst):
33 os.makedirs(dst)
34
35 if args.x64_out_dir:
36 x64_out_dir = (
37 args.x64_out_dir
38 if os.path.isabs(args.x64_out_dir) else os.path.join(buildroot_dir, args.x64_out_dir)
39 )
40 generate_gen_snapshot(x64_out_dir, os.path.join(dst, 'gen_snapshot_x64'))
41
42 if args.arm64_out_dir:
43 arm64_out_dir = (
44 args.arm64_out_dir
45 if os.path.isabs(args.arm64_out_dir) else os.path.join(buildroot_dir, args.arm64_out_dir)
46 )
47 generate_gen_snapshot(
48 os.path.join(arm64_out_dir, args.clang_dir), os.path.join(dst, 'gen_snapshot_arm64')
49 )
50
51 if args.armv7_out_dir:
52 armv7_out_dir = (
53 args.armv7_out_dir
54 if os.path.isabs(args.armv7_out_dir) else os.path.join(buildroot_dir, args.armv7_out_dir)
55 )
56 generate_gen_snapshot(
57 os.path.join(armv7_out_dir, args.clang_dir), os.path.join(dst, 'gen_snapshot_armv7')
58 )
59 if args.zip:
60 zip_archive(dst)
61
62
Definition main.py:1

◆ zip_archive()

create_macos_gen_snapshots.zip_archive (   dst)

Definition at line 68 of file create_macos_gen_snapshots.py.

68def zip_archive(dst):
69 snapshot_filepath = ['gen_snapshot_arm64', 'gen_snapshot_x64']
70
71 embed_codesign_configuration(os.path.join(dst, 'entitlements.txt'), snapshot_filepath)
72
73 subprocess.check_call([
74 'zip',
75 '-r',
76 'gen_snapshot.zip',
77 '.',
78 ], cwd=dst)
79
80

Variable Documentation

◆ buildroot_dir

create_macos_gen_snapshots.buildroot_dir = os.path.abspath(os.path.join(os.path.realpath(__file__), '..', '..', '..', '..'))

Definition at line 12 of file create_macos_gen_snapshots.py.