diff --git a/mobile/rpc-foundation/access-inventory.json b/mobile/rpc-foundation/access-inventory.json index 466e0c1c90b..8dbdb5c56cf 100644 --- a/mobile/rpc-foundation/access-inventory.json +++ b/mobile/rpc-foundation/access-inventory.json @@ -1,9 +1,6 @@ { "schemaVersion": 2, - "scope": [ - "mobile/src", - "mobile/app" - ], + "scope": ["mobile/src", "mobile/app"], "summary": { "callSites": 431, "literalMethod": 387, diff --git a/mobile/scripts/rpc-access-inventory.mts b/mobile/scripts/rpc-access-inventory.mts index 3bc6bef19a6..fe1acf3c415 100644 --- a/mobile/scripts/rpc-access-inventory.mts +++ b/mobile/scripts/rpc-access-inventory.mts @@ -78,7 +78,7 @@ calls.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line || a.column const rows = calls.map( (call) => `${call.file}:${call.line}:${call.column} ${call.kind} ${call.method}` ) -emit('access-inventory', { +await emit('access-inventory', { schemaVersion: 2, scope: ['mobile/src', 'mobile/app'], summary: { diff --git a/mobile/scripts/rpc-artifact-io.mts b/mobile/scripts/rpc-artifact-io.mts index 8562a09f17a..5a4f5c841f1 100644 --- a/mobile/scripts/rpc-artifact-io.mts +++ b/mobile/scripts/rpc-artifact-io.mts @@ -26,16 +26,25 @@ export async function git(...args: string[]): Promise { } return result.stdout.trimEnd() } -export function emit(name: string, value: unknown): void { +export async function emit(name: string, value: unknown): Promise { const path = resolve(root, option('output', `mobile/rpc-foundation/${name}.json`)) if (process.argv.includes('--check')) { if (!isDeepStrictEqual(JSON.parse(readFileSync(path, 'utf8')), value)) { throw new Error(`Stale artifact: ${path}`) } console.log(`${name}: current`) - } else { - mkdirSync(dirname(path), { recursive: true }) - writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`) - console.log(`${name}: ${path}`) + return } + mkdirSync(dirname(path), { recursive: true }) + writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`) + // Committed artifacts are checked by `format:check`; format here so regeneration cannot leave CI red. + const formatted = await runProcess({ + program: resolve(root, 'node_modules/.bin/oxfmt'), + args: ['--write', path], + cwd: root + }) + if (formatted.code !== 0) { + throw new Error(`oxfmt --write ${path}: ${formatted.stderr}`) + } + console.log(`${name}: ${path}`) } diff --git a/mobile/scripts/rpc-native-inventory.mts b/mobile/scripts/rpc-native-inventory.mts index 9ee669faf53..e4c2a55c24e 100644 --- a/mobile/scripts/rpc-native-inventory.mts +++ b/mobile/scripts/rpc-native-inventory.mts @@ -26,7 +26,7 @@ const entries = sources.map((file) => { rpcCandidates } }) -emit('native-rpc-inventory', { +await emit('native-rpc-inventory', { schemaVersion: 1, scope: ['mobile/packages', 'mobile/plugins'], extensions: ['swift', 'kt', 'm', 'mm', 'h', 'java'], diff --git a/mobile/scripts/rpc-reference-regressions.mts b/mobile/scripts/rpc-reference-regressions.mts index 60721668af0..df86557d64b 100644 --- a/mobile/scripts/rpc-reference-regressions.mts +++ b/mobile/scripts/rpc-reference-regressions.mts @@ -119,7 +119,7 @@ results.push({ for (const result of results) { assert.equal(result.killed, true, `${result.id}: reference no longer exhibits the known defect`) } -emit('reference-regressions', { +await emit('reference-regressions', { revision, sources, supportingFunctions: ['rankSuggestions', 'buildGithubPrParams', 'githubPrRepoSlugParam'],