14from create_xcframework
import create_xcframework
16ARCH_SUBPATH =
'mac-arm64' if platform.processor() ==
'arm' else 'mac-x64'
17DSYMUTIL = os.path.join(
18 os.path.dirname(__file__),
'..',
'..',
'buildtools', ARCH_SUBPATH,
'clang',
'bin',
'dsymutil'
23 parser = argparse.ArgumentParser(description=
'Creates Flutter.framework and Flutter.xcframework')
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)
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)
34 args = parser.parse_args()
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')
44 arm64_dylib = os.path.join(arm64_framework,
'Flutter')
45 simulator_x64_dylib = os.path.join(simulator_x64_framework,
'Flutter')
47 if not os.path.isdir(arm64_framework):
48 print(
'Cannot find iOS arm64 Framework at %s' % arm64_framework)
51 if not os.path.isdir(simulator_x64_framework):
52 print(
'Cannot find iOS x64 simulator Framework at %s' % simulator_framework)
55 if not os.path.isfile(arm64_dylib):
56 print(
'Cannot find iOS arm64 dylib at %s' % arm64_dylib)
59 if not os.path.isfile(simulator_x64_dylib):
60 print(
'Cannot find iOS simulator dylib at %s' % simulator_x64_dylib)
63 if not os.path.isfile(DSYMUTIL):
64 print(
'Cannot find dsymutil at %s' % DSYMUTIL)
67 shutil.rmtree(framework,
True)
68 shutil.copytree(arm64_framework, framework)
69 framework_binary = os.path.join(framework,
'Flutter')
72 if args.simulator_arm64_out_dir
is not None:
73 shutil.rmtree(simulator_framework,
True)
74 shutil.copytree(simulator_arm64_framework, simulator_framework)
76 simulator_framework_binary = os.path.join(simulator_framework,
'Flutter')
79 subprocess.check_call([
80 'lipo', simulator_x64_dylib, simulator_arm64_dylib,
'-create',
'-output',
81 simulator_framework_binary
85 simulator_framework = simulator_x64_framework
90 xcframeworks = [simulator_framework, framework]
94 subprocess.check_call([
95 'lipo', arm64_dylib, simulator_x64_dylib,
'-create',
'-output', framework_binary
104 dsym_out = os.path.splitext(framework)[0] +
'.dSYM'
105 subprocess.check_call([DSYMUTIL,
'-o', dsym_out, framework_binary])
109 unstripped_out = os.path.join(args.dst,
'Flutter.unstripped')
110 shutil.copyfile(framework_binary, unstripped_out)
112 subprocess.check_call([
'strip',
'-x',
'-S', framework_binary])
115if __name__ ==
'__main__':
def process_framework(args, framework, framework_binary)
def print(*args, **kwargs)