MCPcopy Create free account
hub / github.com/garrytan/gstack / computeCacheKey

Function computeCacheKey

ios-qa/scripts/gen-accessors.ts:152–167  ·  view source on GitHub ↗
(inputs: {
  swiftFiles: string[];
  swiftVersion: string;
  toolGitRev: string;
  platformTriple: string;
})

Source from the content-addressed store, hash-verified

150}
151
152export function computeCacheKey(inputs: {
153 swiftFiles: string[];
154 swiftVersion: string;
155 toolGitRev: string;
156 platformTriple: string;
157}): string {
158 const h = createHash('sha256');
159 h.update(`swift=${inputs.swiftVersion}|tool=${inputs.toolGitRev}|platform=${inputs.platformTriple}|`);
160 for (const f of inputs.swiftFiles) {
161 const content = readFileSync(f);
162 h.update(`${f}:${content.length}:`);
163 h.update(content);
164 h.update('|');
165 }
166 return h.digest('hex');
167}
168
169export function render(specs: AccessorSpec[], buildId: string, accessorHash: string): string {
170 let out = '// AUTO-GENERATED — DO NOT EDIT. Regenerate with /ios-sync.\n';

Callers 2

generateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected