@@ -65,76 +65,91 @@ describe('stripFrameworkBinary', () => {
6565 ) ;
6666 } ) ;
6767
68- it ( 'strips binary from ios-arm64 slice' , ( ) => {
69- const xcframeworkPath = createMockXcframework ( tempDir , 'TestFramework' , [
70- 'ios-arm64' ,
71- ] ) ;
72- const binaryPath = path . join (
73- xcframeworkPath ,
74- 'ios-arm64' ,
75- 'TestFramework.framework' ,
76- 'TestFramework'
77- ) ;
78- const originalContent = fs . readFileSync ( binaryPath , 'utf-8' ) ;
79-
80- stripFrameworkBinary ( xcframeworkPath ) ;
81-
82- const newContent = fs . readFileSync ( binaryPath ) ;
83- expect ( newContent . toString ( ) ) . not . toBe ( originalContent ) ;
84- expect ( fs . existsSync ( binaryPath ) ) . toBe ( true ) ;
85- expect ( mockLoggerSuccess ) . toHaveBeenCalledWith (
86- 'TestFramework.xcframework is now interface-only'
87- ) ;
88- } ) ;
89-
90- it ( 'strips binary from simulator slice with fat binary' , ( ) => {
91- const xcframeworkPath = createMockXcframework ( tempDir , 'TestFramework' , [
92- 'ios-arm64_x86_64-simulator' ,
93- ] ) ;
94- const binaryPath = path . join (
95- xcframeworkPath ,
96- 'ios-arm64_x86_64-simulator' ,
97- 'TestFramework.framework' ,
98- 'TestFramework'
99- ) ;
100- const originalContent = fs . readFileSync ( binaryPath , 'utf-8' ) ;
101-
102- stripFrameworkBinary ( xcframeworkPath ) ;
103-
104- const newContent = fs . readFileSync ( binaryPath ) ;
105- expect ( newContent . toString ( ) ) . not . toBe ( originalContent ) ;
68+ describe . skipIf ( process . platform !== 'darwin' ) ( 'with Xcode toolchain' , ( ) => {
69+ it ( 'strips binary from ios-arm64 slice' , ( ) => {
70+ const xcframeworkPath = createMockXcframework ( tempDir , 'TestFramework' , [
71+ 'ios-arm64' ,
72+ ] ) ;
73+ const binaryPath = path . join (
74+ xcframeworkPath ,
75+ 'ios-arm64' ,
76+ 'TestFramework.framework' ,
77+ 'TestFramework'
78+ ) ;
79+ const originalContent = fs . readFileSync ( binaryPath , 'utf-8' ) ;
80+
81+ stripFrameworkBinary ( xcframeworkPath ) ;
82+
83+ const newContent = fs . readFileSync ( binaryPath ) ;
84+ expect ( newContent . toString ( ) ) . not . toBe ( originalContent ) ;
85+ expect ( fs . existsSync ( binaryPath ) ) . toBe ( true ) ;
86+ expect ( mockLoggerSuccess ) . toHaveBeenCalledWith (
87+ 'TestFramework.xcframework is now interface-only'
88+ ) ;
89+ } ) ;
10690
107- const archInfo = execSync ( `xcrun lipo -info "${ binaryPath } "` , {
108- encoding : 'utf-8' ,
91+ it ( 'strips binary from simulator slice with fat binary' , ( ) => {
92+ const xcframeworkPath = createMockXcframework ( tempDir , 'TestFramework' , [
93+ 'ios-arm64_x86_64-simulator' ,
94+ ] ) ;
95+ const binaryPath = path . join (
96+ xcframeworkPath ,
97+ 'ios-arm64_x86_64-simulator' ,
98+ 'TestFramework.framework' ,
99+ 'TestFramework'
100+ ) ;
101+ const originalContent = fs . readFileSync ( binaryPath , 'utf-8' ) ;
102+
103+ stripFrameworkBinary ( xcframeworkPath ) ;
104+
105+ const newContent = fs . readFileSync ( binaryPath ) ;
106+ expect ( newContent . toString ( ) ) . not . toBe ( originalContent ) ;
107+
108+ const archInfo = execSync ( `xcrun lipo -info "${ binaryPath } "` , {
109+ encoding : 'utf-8' ,
110+ } ) ;
111+ expect ( archInfo ) . toContain ( 'arm64' ) ;
112+ expect ( archInfo ) . toContain ( 'x86_64' ) ;
109113 } ) ;
110- expect ( archInfo ) . toContain ( 'arm64' ) ;
111- expect ( archInfo ) . toContain ( 'x86_64' ) ;
112- } ) ;
113114
114- it ( 'handles multiple slices' , ( ) => {
115- const xcframeworkPath = createMockXcframework ( tempDir , 'TestFramework' , [
116- 'ios-arm64' ,
117- 'ios-arm64_x86_64-simulator' ,
118- ] ) ;
115+ it ( 'handles multiple slices' , ( ) => {
116+ const xcframeworkPath = createMockXcframework ( tempDir , 'TestFramework' , [
117+ 'ios-arm64' ,
118+ 'ios-arm64_x86_64-simulator' ,
119+ ] ) ;
120+
121+ stripFrameworkBinary ( xcframeworkPath ) ;
122+
123+ const deviceBinary = path . join (
124+ xcframeworkPath ,
125+ 'ios-arm64' ,
126+ 'TestFramework.framework' ,
127+ 'TestFramework'
128+ ) ;
129+ const simBinary = path . join (
130+ xcframeworkPath ,
131+ 'ios-arm64_x86_64-simulator' ,
132+ 'TestFramework.framework' ,
133+ 'TestFramework'
134+ ) ;
135+
136+ expect ( fs . existsSync ( deviceBinary ) ) . toBe ( true ) ;
137+ expect ( fs . existsSync ( simBinary ) ) . toBe ( true ) ;
138+ expect ( mockLoggerSuccess ) . toHaveBeenCalledOnce ( ) ;
139+ } ) ;
119140
120- stripFrameworkBinary ( xcframeworkPath ) ;
141+ it ( 'ignores non-ios directories' , ( ) => {
142+ const xcframeworkPath = createMockXcframework ( tempDir , 'TestFramework' , [
143+ 'ios-arm64' ,
144+ ] ) ;
145+ fs . mkdirSync ( path . join ( xcframeworkPath , 'macos-arm64' ) , {
146+ recursive : true ,
147+ } ) ;
121148
122- const deviceBinary = path . join (
123- xcframeworkPath ,
124- 'ios-arm64' ,
125- 'TestFramework.framework' ,
126- 'TestFramework'
127- ) ;
128- const simBinary = path . join (
129- xcframeworkPath ,
130- 'ios-arm64_x86_64-simulator' ,
131- 'TestFramework.framework' ,
132- 'TestFramework'
133- ) ;
149+ stripFrameworkBinary ( xcframeworkPath ) ;
134150
135- expect ( fs . existsSync ( deviceBinary ) ) . toBe ( true ) ;
136- expect ( fs . existsSync ( simBinary ) ) . toBe ( true ) ;
137- expect ( mockLoggerSuccess ) . toHaveBeenCalledOnce ( ) ;
151+ expect ( mockLoggerSuccess ) . toHaveBeenCalledOnce ( ) ;
152+ } ) ;
138153 } ) ;
139154
140155 it ( 'warns and skips unknown slice types' , ( ) => {
@@ -164,17 +179,4 @@ describe('stripFrameworkBinary', () => {
164179 expect . stringContaining ( 'No binary found at' )
165180 ) ;
166181 } ) ;
167-
168- it ( 'ignores non-ios directories' , ( ) => {
169- const xcframeworkPath = createMockXcframework ( tempDir , 'TestFramework' , [
170- 'ios-arm64' ,
171- ] ) ;
172- fs . mkdirSync ( path . join ( xcframeworkPath , 'macos-arm64' ) , {
173- recursive : true ,
174- } ) ;
175-
176- stripFrameworkBinary ( xcframeworkPath ) ;
177-
178- expect ( mockLoggerSuccess ) . toHaveBeenCalledOnce ( ) ;
179- } ) ;
180182} ) ;
0 commit comments