@@ -6,8 +6,6 @@ import cp from "node:child_process";
66// Using xmldom here because this is what @expo /plist uses internally and we might as well re-use it here.
77// Types come from packages/host/types/xmldom.d.ts (path mapping in tsconfig.node.json) to avoid pulling in lib "dom".
88import { DOMParser } from "@xmldom/xmldom" ;
9- import xcode from "@bacons/xcode" ;
10- import * as zod from "zod" ;
119
1210export type XcodeWorkspace = {
1311 version : string ;
@@ -90,49 +88,3 @@ export async function findXcodeProject(fromPath: string) {
9088 throw new Error ( `Unexpected scheme: ${ scheme } ` ) ;
9189 }
9290}
93-
94- const BuildSettingsSchema = zod . array (
95- zod . object ( {
96- target : zod . string ( ) ,
97- buildSettings : zod . partialRecord ( zod . string ( ) , zod . string ( ) ) ,
98- } ) ,
99- ) ;
100-
101- export function getBuildSettings (
102- xcodeProjectPath : string ,
103- mainTarget : xcode . PBXNativeTarget ,
104- ) {
105- const result = cp . spawnSync (
106- "xcodebuild" ,
107- [
108- "-showBuildSettings" ,
109- "-project" ,
110- xcodeProjectPath ,
111- "-target" ,
112- mainTarget . getDisplayName ( ) ,
113- "-json" ,
114- ] ,
115- {
116- cwd : xcodeProjectPath ,
117- encoding : "utf-8" ,
118- } ,
119- ) ;
120- assert . equal (
121- result . status ,
122- 0 ,
123- `Failed to run xcodebuild -showBuildSettings: ${ result . stderr } ` ,
124- ) ;
125- return BuildSettingsSchema . parse ( JSON . parse ( result . stdout ) ) ;
126- }
127-
128- export function getBuildDirPath (
129- xcodeProjectPath : string ,
130- mainTarget : xcode . PBXNativeTarget ,
131- ) {
132- const buildSettings = getBuildSettings ( xcodeProjectPath , mainTarget ) ;
133- assert ( buildSettings . length === 1 , "Expected exactly one build setting" ) ;
134- const [ targetBuildSettings ] = buildSettings ;
135- const { BUILD_DIR : buildDirPath } = targetBuildSettings . buildSettings ;
136- assert ( buildDirPath , "Expected a build directory" ) ;
137- return buildDirPath ;
138- }
0 commit comments