MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / collectSwiftFiles

Function collectSwiftFiles

src/utils/test-preflight.ts:237–274  ·  view source on GitHub ↗
(
  directoryPath: string,
  fileSystemExecutor: FileSystemExecutor,
)

Source from the content-addressed store, hash-verified

235}
236
237async function collectSwiftFiles(
238 directoryPath: string,
239 fileSystemExecutor: FileSystemExecutor,
240): Promise<string[]> {
241 const entries = await listDirectoryEntries(directoryPath, fileSystemExecutor);
242 if (entries.length === 0) {
243 return [];
244 }
245
246 const entryPaths = entries.map((entry) => path.join(directoryPath, entry));
247 const statResults = await Promise.all(
248 entryPaths.map(async (fullPath) => {
249 try {
250 const stats = await fileSystemExecutor.stat(fullPath);
251 return { fullPath, isDir: stats.isDirectory() };
252 } catch {
253 return null;
254 }
255 }),
256 );
257
258 const files: string[] = [];
259 const subdirPromises: Array<Promise<string[]>> = [];
260
261 for (const result of statResults) {
262 if (!result) {
263 continue;
264 }
265 if (result.isDir) {
266 subdirPromises.push(collectSwiftFiles(result.fullPath, fileSystemExecutor));
267 } else if (result.fullPath.endsWith('.swift')) {
268 files.push(result.fullPath);
269 }
270 }
271
272 const nestedFiles = await Promise.all(subdirPromises);
273 return files.concat(...nestedFiles);
274}
275
276async function resolveCandidateDirectories(
277 reference: ReferencedTestTarget,

Callers 1

resolveTestPreflightFunction · 0.85

Calls 4

listDirectoryEntriesFunction · 0.85
statMethod · 0.80
isDirectoryMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected