( executor: CommandExecutor, )
| 152 | } |
| 153 | |
| 154 | export function createCleanExecutor( |
| 155 | executor: CommandExecutor, |
| 156 | ): NonStreamingExecutor<CleanParams, CleanResult> { |
| 157 | return async (params) => { |
| 158 | if (params.workspacePath && !params.scheme) { |
| 159 | const message = 'scheme is required when workspacePath is provided.'; |
| 160 | return createCleanResult( |
| 161 | params, |
| 162 | 'FAILED', |
| 163 | { |
| 164 | warnings: [], |
| 165 | errors: [{ message }], |
| 166 | }, |
| 167 | message, |
| 168 | ); |
| 169 | } |
| 170 | |
| 171 | const cleanPlatform = resolveCleanPlatform(params); |
| 172 | if (!cleanPlatform) { |
| 173 | const message = `Unsupported platform: "${params.platform ?? 'iOS'}".`; |
| 174 | return createCleanResult( |
| 175 | params, |
| 176 | 'FAILED', |
| 177 | { |
| 178 | warnings: [], |
| 179 | errors: [{ message }], |
| 180 | }, |
| 181 | message, |
| 182 | ); |
| 183 | } |
| 184 | |
| 185 | const configuration = params.configuration ?? 'Debug'; |
| 186 | const stderrChunks: string[] = []; |
| 187 | |
| 188 | try { |
| 189 | const response = await executeXcodeBuildCommand( |
| 190 | { |
| 191 | projectPath: params.projectPath, |
| 192 | workspacePath: params.workspacePath, |
| 193 | scheme: params.scheme ?? '', |
| 194 | configuration, |
| 195 | derivedDataPath: params.derivedDataPath, |
| 196 | extraArgs: params.extraArgs, |
| 197 | }, |
| 198 | { |
| 199 | platform: cleanPlatform, |
| 200 | logPrefix: 'Clean', |
| 201 | }, |
| 202 | params.preferXcodebuild ?? false, |
| 203 | 'clean', |
| 204 | executor, |
| 205 | { |
| 206 | onStderr: (chunk) => { |
| 207 | stderrChunks.push(chunk); |
| 208 | }, |
| 209 | }, |
| 210 | ); |
| 211 |
no test coverage detected