xcode-archive
Automate Xcode project archiving by specifying project path, scheme, and archive path. Export IPA files with defined export options for streamlined iOS app deployment and management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| archivePath | Yes | 아카이브 파일(.xcarchive) 저장 경로 | |
| configuration | No | 빌드 구성 (예: Release) | |
| exportOptionsPlist | No | 익스포트 옵션 plist 파일 경로 | |
| exportPath | No | 익스포트 경로 (IPA 파일 등) | |
| projectPath | Yes | Xcode 프로젝트 또는 워크스페이스 경로 | |
| scheme | Yes | 아카이브할 스킴 |
Implementation Reference
- src/index.ts:309-367 (handler)The handler function for the 'xcode-archive' tool. It constructs and executes an 'xcodebuild archive' command to create an .xcarchive file, and optionally performs an export using 'xcodebuild -exportArchive' if exportPath and exportOptionsPlist are provided. Uses executeCommand utility to run the shell commands.async ({ projectPath, scheme, configuration = "Release", archivePath, exportPath, exportOptionsPlist }) => { try { console.error(`Xcode 아카이브 생성: ${projectPath}, Scheme: ${scheme}`); let archiveCommand = `xcodebuild`; // 워크스페이스인지 프로젝트인지 확인 if (projectPath.endsWith(".xcworkspace")) { archiveCommand += ` -workspace "${projectPath}"`; } else { archiveCommand += ` -project "${projectPath}"`; } archiveCommand += ` -scheme "${scheme}" -configuration "${configuration}" archive -archivePath "${archivePath}"`; console.error(`실행할 아카이브 명령어: ${archiveCommand}`); // 아카이브 명령어 실행 try { const { stdout: archiveStdout, stderr: archiveStderr } = await executeCommand(archiveCommand); let resultText = "아카이브 결과:\n"; if (archiveStdout) resultText += `${archiveStdout}\n`; if (archiveStderr) resultText += `STDERR:\n${archiveStderr}\n`; // 익스포트 실행 (옵션이 제공된 경우) if (exportPath && exportOptionsPlist) { console.error(`Xcode 아카이브 익스포트: ${archivePath} -> ${exportPath}`); let exportCommand = `xcodebuild -exportArchive -archivePath "${archivePath}" -exportPath "${exportPath}" -exportOptionsPlist "${exportOptionsPlist}"`; console.error(`실행할 익스포트 명령어: ${exportCommand}`); // 익스포트 명령어 실행 const { stdout: exportStdout, stderr: exportStderr } = await executeCommand(exportCommand); resultText += "\n익스포트 결과:\n"; if (exportStdout) resultText += `${exportStdout}\n`; if (exportStderr) resultText += `STDERR:\n${exportStderr}\n`; } return { content: [{ type: "text", text: resultText }] }; } catch (error: any) { throw error; } } catch (error: any) { console.error(`Xcode 아카이브/익스포트 오류: ${error.message}`); return { content: [{ type: "text", text: `Xcode 아카이브/익스포트 중 오류가 발생했습니다:\n${error.message}\n${error.stderr || ''}` }], isError: true }; } }
- src/index.ts:301-307 (schema)Zod schema defining the input parameters for the xcode-archive tool, including project path, scheme, configuration, archive path, and optional export options.{ projectPath: z.string().describe("Xcode 프로젝트 또는 워크스페이스 경로"), scheme: z.string().describe("아카이브할 스킴"), configuration: z.string().optional().describe("빌드 구성 (예: Release)"), archivePath: z.string().describe("아카이브 파일(.xcarchive) 저장 경로"), exportPath: z.string().optional().describe("익스포트 경로 (IPA 파일 등)"), exportOptionsPlist: z.string().optional().describe("익스포트 옵션 plist 파일 경로")
- src/index.ts:299-368 (registration)Registration of the 'xcode-archive' tool on the MCP server using server.tool(), including schema and handler.server.tool( "xcode-archive", { projectPath: z.string().describe("Xcode 프로젝트 또는 워크스페이스 경로"), scheme: z.string().describe("아카이브할 스킴"), configuration: z.string().optional().describe("빌드 구성 (예: Release)"), archivePath: z.string().describe("아카이브 파일(.xcarchive) 저장 경로"), exportPath: z.string().optional().describe("익스포트 경로 (IPA 파일 등)"), exportOptionsPlist: z.string().optional().describe("익스포트 옵션 plist 파일 경로") }, async ({ projectPath, scheme, configuration = "Release", archivePath, exportPath, exportOptionsPlist }) => { try { console.error(`Xcode 아카이브 생성: ${projectPath}, Scheme: ${scheme}`); let archiveCommand = `xcodebuild`; // 워크스페이스인지 프로젝트인지 확인 if (projectPath.endsWith(".xcworkspace")) { archiveCommand += ` -workspace "${projectPath}"`; } else { archiveCommand += ` -project "${projectPath}"`; } archiveCommand += ` -scheme "${scheme}" -configuration "${configuration}" archive -archivePath "${archivePath}"`; console.error(`실행할 아카이브 명령어: ${archiveCommand}`); // 아카이브 명령어 실행 try { const { stdout: archiveStdout, stderr: archiveStderr } = await executeCommand(archiveCommand); let resultText = "아카이브 결과:\n"; if (archiveStdout) resultText += `${archiveStdout}\n`; if (archiveStderr) resultText += `STDERR:\n${archiveStderr}\n`; // 익스포트 실행 (옵션이 제공된 경우) if (exportPath && exportOptionsPlist) { console.error(`Xcode 아카이브 익스포트: ${archivePath} -> ${exportPath}`); let exportCommand = `xcodebuild -exportArchive -archivePath "${archivePath}" -exportPath "${exportPath}" -exportOptionsPlist "${exportOptionsPlist}"`; console.error(`실행할 익스포트 명령어: ${exportCommand}`); // 익스포트 명령어 실행 const { stdout: exportStdout, stderr: exportStderr } = await executeCommand(exportCommand); resultText += "\n익스포트 결과:\n"; if (exportStdout) resultText += `${exportStdout}\n`; if (exportStderr) resultText += `STDERR:\n${exportStderr}\n`; } return { content: [{ type: "text", text: resultText }] }; } catch (error: any) { throw error; } } catch (error: any) { console.error(`Xcode 아카이브/익스포트 오류: ${error.message}`); return { content: [{ type: "text", text: `Xcode 아카이브/익스포트 중 오류가 발생했습니다:\n${error.message}\n${error.stderr || ''}` }], isError: true }; } } );