25 parser = argparse.ArgumentParser(description='Creates FlutterEmbedder.framework for macOS')
26
27 parser.add_argument('--dst', type=str, required=True)
28 parser.add_argument('--arm64-out-dir', type=str, required=True)
29 parser.add_argument('--x64-out-dir', type=str, required=True)
30 parser.add_argument('--strip', action='store_true', default=False)
31 parser.add_argument('--dsym', action='store_true', default=False)
32
33 parser.add_argument('--zip', action='store_true', default=False)
34
35 args = parser.parse_args()
36
37 dst = (args.dst if os.path.isabs(args.dst) else os.path.join(buildroot_dir, args.dst))
38 arm64_out_dir = (
39 args.arm64_out_dir
40 if os.path.isabs(args.arm64_out_dir) else os.path.join(buildroot_dir, args.arm64_out_dir)
41 )
42 x64_out_dir = (
43 args.x64_out_dir
44 if os.path.isabs(args.x64_out_dir) else os.path.join(buildroot_dir, args.x64_out_dir)
45 )
46
47 fat_framework = os.path.join(dst, 'FlutterEmbedder.framework')
48 arm64_framework = os.path.join(arm64_out_dir, 'FlutterEmbedder.framework')
49 x64_framework = os.path.join(x64_out_dir, 'FlutterEmbedder.framework')
50
51 arm64_dylib = os.path.join(arm64_framework, 'FlutterEmbedder')
52 x64_dylib = os.path.join(x64_framework, 'FlutterEmbedder')
53
54 if not os.path.isdir(arm64_framework):
55 print(
'Cannot find macOS arm64 Framework at %s' % arm64_framework)
56 return 1
57
58 if not os.path.isdir(x64_framework):
59 print(
'Cannot find macOS x64 Framework at %s' % x64_framework)
60 return 1
61
62 if not os.path.isfile(arm64_dylib):
63 print(
'Cannot find macOS arm64 dylib at %s' % arm64_dylib)
64 return 1
65
66 if not os.path.isfile(x64_dylib):
67 print(
'Cannot find macOS x64 dylib at %s' % x64_dylib)
68 return 1
69
70 if not os.path.isfile(DSYMUTIL):
71 print(
'Cannot find dsymutil at %s' % DSYMUTIL)
72 return 1
73
74 shutil.rmtree(fat_framework, True)
75 shutil.copytree(arm64_framework, fat_framework, symlinks=True)
77
78 fat_framework_binary = os.path.join(fat_framework, 'Versions', 'A', 'FlutterEmbedder')
79
80
81 subprocess.check_call([
82 'lipo', arm64_dylib, x64_dylib, '-create', '-output', fat_framework_binary
83 ])
85
86 return 0
87
88
def regenerate_symlinks(fat_framework)
def process_framework(dst, args, fat_framework, fat_framework_binary)
def print(*args, **kwargs)