23 parser = argparse.ArgumentParser(description='Creates Flutter.framework and Flutter.xcframework')
24
25 parser.add_argument('--dst', type=str, required=True)
26 parser.add_argument('--arm64-out-dir', type=str, required=True)
27 parser.add_argument('--armv7-out-dir', type=str, required=False)
28
29 parser.add_argument('--simulator-x64-out-dir', '--simulator-out-dir', type=str, required=True)
30 parser.add_argument('--simulator-arm64-out-dir', type=str, required=False)
31 parser.add_argument('--strip', action='store_true', default=False)
32 parser.add_argument('--dsym', action='store_true', default=False)
33
34 args = parser.parse_args()
35
36 framework = os.path.join(args.dst, 'Flutter.framework')
37 simulator_framework = os.path.join(args.dst, 'sim', 'Flutter.framework')
38 arm64_framework = os.path.join(args.arm64_out_dir, 'Flutter.framework')
39 simulator_x64_framework = os.path.join(args.simulator_x64_out_dir, 'Flutter.framework')
40 if args.simulator_arm64_out_dir is not None:
41 simulator_arm64_framework = os.path.join(args.simulator_arm64_out_dir, 'Flutter.framework')
42 simulator_arm64_dylib = os.path.join(simulator_arm64_framework, 'Flutter')
43
44 arm64_dylib = os.path.join(arm64_framework, 'Flutter')
45 simulator_x64_dylib = os.path.join(simulator_x64_framework, 'Flutter')
46
47 if not os.path.isdir(arm64_framework):
48 print(
'Cannot find iOS arm64 Framework at %s' % arm64_framework)
49 return 1
50
51 if not os.path.isdir(simulator_x64_framework):
52 print(
'Cannot find iOS x64 simulator Framework at %s' % simulator_framework)
53 return 1
54
55 if not os.path.isfile(arm64_dylib):
56 print(
'Cannot find iOS arm64 dylib at %s' % arm64_dylib)
57 return 1
58
59 if not os.path.isfile(simulator_x64_dylib):
60 print(
'Cannot find iOS simulator dylib at %s' % simulator_x64_dylib)
61 return 1
62
63 if not os.path.isfile(DSYMUTIL):
64 print(
'Cannot find dsymutil at %s' % DSYMUTIL)
65 return 1
66
67 shutil.rmtree(framework, True)
68 shutil.copytree(arm64_framework, framework)
69 framework_binary = os.path.join(framework, 'Flutter')
71
72 if args.simulator_arm64_out_dir is not None:
73 shutil.rmtree(simulator_framework, True)
74 shutil.copytree(simulator_arm64_framework, simulator_framework)
75
76 simulator_framework_binary = os.path.join(simulator_framework, 'Flutter')
77
78
79 subprocess.check_call([
80 'lipo', simulator_x64_dylib, simulator_arm64_dylib, '-create', '-output',
81 simulator_framework_binary
82 ])
84 else:
85 simulator_framework = simulator_x64_framework
86
87
88
89
90 xcframeworks = [simulator_framework, framework]
92
93
94 subprocess.check_call([
95 'lipo', arm64_dylib, simulator_x64_dylib, '-create', '-output', framework_binary
96 ])
97
99 return 0
100
101
def process_framework(args, framework, framework_binary)
def print(*args, **kwargs)