(params: {
source: string;
cacheName: string;
timeoutMs?: number;
})
| 51 | } |
| 52 | |
| 53 | export async function compileSwiftSourceText(params: { |
| 54 | source: string; |
| 55 | cacheName: string; |
| 56 | timeoutMs?: number; |
| 57 | }): Promise<string> { |
| 58 | const cacheName = sanitizeCacheName(params.cacheName); |
| 59 | const key = hashParts([SWIFT_CACHE_VERSION, process.platform, process.arch, params.source]); |
| 60 | const sourcePath = path.join(getSwiftCacheRoot(), 'sources', `${cacheName}-${key}.swift`); |
| 61 | const executablePath = path.join(getSwiftCacheRoot(), 'bin', `${cacheName}-${key}`); |
| 62 | |
| 63 | await ensureSwiftExecutable({ |
| 64 | sourcePath, |
| 65 | executablePath, |
| 66 | sourceText: params.source, |
| 67 | timeoutMs: params.timeoutMs, |
| 68 | }); |
| 69 | return executablePath; |
| 70 | } |
| 71 | |
| 72 | function getSwiftCacheRoot(): string { |
| 73 | const configured = process.env.AGENT_DEVICE_SWIFT_CACHE_DIR?.trim(); |
no test coverage detected