Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2238893

Browse files
authored
Revert "Ignore armv7 in ios framework script (#32638)"
This reverts commit c6dc1b3.
1 parent c6dc1b3 commit 2238893

1 file changed

Lines changed: 43 additions & 21 deletions

File tree

sky/tools/create_ios_framework.py

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,27 @@ def main():
3030

3131
args = parser.parse_args()
3232

33-
framework = os.path.join(args.dst, 'Flutter.framework')
34-
simulator_framework = os.path.join(args.dst, 'sim', 'Flutter.framework')
33+
fat_framework = os.path.join(args.dst, 'Flutter.framework')
34+
fat_simulator_framework = os.path.join(args.dst, 'sim', 'Flutter.framework')
3535
arm64_framework = os.path.join(args.arm64_out_dir, 'Flutter.framework')
36+
armv7_framework = os.path.join(args.armv7_out_dir, 'Flutter.framework')
3637
simulator_x64_framework = os.path.join(args.simulator_x64_out_dir, 'Flutter.framework')
3738
if args.simulator_arm64_out_dir is not None:
3839
simulator_arm64_framework = os.path.join(args.simulator_arm64_out_dir, 'Flutter.framework')
3940
simulator_arm64_dylib = os.path.join(simulator_arm64_framework, 'Flutter')
4041

4142
arm64_dylib = os.path.join(arm64_framework, 'Flutter')
43+
armv7_dylib = os.path.join(armv7_framework, 'Flutter')
4244
simulator_x64_dylib = os.path.join(simulator_x64_framework, 'Flutter')
4345

4446
if not os.path.isdir(arm64_framework):
4547
print('Cannot find iOS arm64 Framework at %s' % arm64_framework)
4648
return 1
4749

50+
if not os.path.isdir(armv7_framework):
51+
print('Cannot find iOS armv7 Framework at %s' % armv7_framework)
52+
return 1
53+
4854
if not os.path.isdir(simulator_x64_framework):
4955
print('Cannot find iOS x64 simulator Framework at %s' % simulator_framework)
5056
return 1
@@ -53,6 +59,10 @@ def main():
5359
print('Cannot find iOS arm64 dylib at %s' % arm64_dylib)
5460
return 1
5561

62+
if not os.path.isfile(armv7_dylib):
63+
print('Cannot find iOS armv7 dylib at %s' % armv7_dylib)
64+
return 1
65+
5666
if not os.path.isfile(simulator_x64_dylib):
5767
print('Cannot find iOS simulator dylib at %s' % simulator_dylib)
5868
return 1
@@ -61,16 +71,27 @@ def main():
6171
print('Cannot find dsymutil at %s' % DSYMUTIL)
6272
return 1
6373

64-
shutil.rmtree(framework, True)
65-
shutil.copytree(arm64_framework, framework)
66-
framework_binary = os.path.join(framework, 'Flutter')
67-
process_framework(args, framework, framework_binary)
74+
shutil.rmtree(fat_framework, True)
75+
shutil.copytree(arm64_framework, fat_framework)
76+
77+
fat_framework_binary = os.path.join(fat_framework, 'Flutter')
78+
79+
# Create the arm-only fat framework.
80+
subprocess.check_call([
81+
'lipo',
82+
arm64_dylib,
83+
armv7_dylib,
84+
'-create',
85+
'-output',
86+
fat_framework_binary
87+
])
88+
process_framework(args, fat_framework, fat_framework_binary)
6889

6990
if args.simulator_arm64_out_dir is not None:
70-
shutil.rmtree(simulator_framework, True)
71-
shutil.copytree(simulator_arm64_framework, simulator_framework)
91+
shutil.rmtree(fat_simulator_framework, True)
92+
shutil.copytree(simulator_arm64_framework, fat_simulator_framework)
7293

73-
simulator_framework_binary = os.path.join(simulator_framework, 'Flutter')
94+
fat_simulator_framework_binary = os.path.join(fat_simulator_framework, 'Flutter')
7495

7596
# Create the arm64/x64 simulator fat framework.
7697
subprocess.check_call([
@@ -79,45 +100,46 @@ def main():
79100
simulator_arm64_dylib,
80101
'-create',
81102
'-output',
82-
simulator_framework_binary
103+
fat_simulator_framework_binary
83104
])
84-
process_framework(args, simulator_framework, simulator_framework_binary)
85-
simulator_framework = simulator_framework
105+
process_framework(args, fat_simulator_framework, fat_simulator_framework_binary)
106+
simulator_framework = fat_simulator_framework
86107
else:
87108
simulator_framework = simulator_x64_framework
88109

89110
# Create XCFramework from the arm-only fat framework and the arm64/x64 simulator frameworks, or just the
90111
# x64 simulator framework if only that one exists.
91-
xcframeworks = [simulator_framework, framework]
112+
xcframeworks = [simulator_framework, fat_framework]
92113
create_xcframework(location=args.dst, name='Flutter', frameworks=xcframeworks)
93114

94115
# Add the x64 simulator into the fat framework
95116
subprocess.check_call([
96117
'lipo',
97118
arm64_dylib,
119+
armv7_dylib,
98120
simulator_x64_dylib,
99121
'-create',
100122
'-output',
101-
framework_binary
123+
fat_framework_binary
102124
])
103125

104-
process_framework(args, framework, framework_binary)
126+
process_framework(args, fat_framework, fat_framework_binary)
105127

106128

107-
def process_framework(args, framework, framework_binary):
129+
def process_framework(args, fat_framework, fat_framework_binary):
108130
if args.strip_bitcode:
109-
subprocess.check_call(['xcrun', 'bitcode_strip', '-r', framework_binary, '-o', framework_binary])
131+
subprocess.check_call(['xcrun', 'bitcode_strip', '-r', fat_framework_binary, '-o', fat_framework_binary])
110132

111133
if args.dsym:
112-
dsym_out = os.path.splitext(framework)[0] + '.dSYM'
113-
subprocess.check_call([DSYMUTIL, '-o', dsym_out, framework_binary])
134+
dsym_out = os.path.splitext(fat_framework)[0] + '.dSYM'
135+
subprocess.check_call([DSYMUTIL, '-o', dsym_out, fat_framework_binary])
114136

115137
if args.strip:
116138
# copy unstripped
117139
unstripped_out = os.path.join(args.dst, 'Flutter.unstripped')
118-
shutil.copyfile(framework_binary, unstripped_out)
140+
shutil.copyfile(fat_framework_binary, unstripped_out)
119141

120-
subprocess.check_call(["strip", "-x", "-S", framework_binary])
142+
subprocess.check_call(["strip", "-x", "-S", fat_framework_binary])
121143

122144

123145
if __name__ == '__main__':

0 commit comments

Comments
 (0)