Files
next.js/scripts/rust-fingerprint.js
T
Matt MastracciandGitHub 4b62ff78c0 Add rust-fingerprint task and SCCACHE passthrough env (#92167)
## What

Replace duplicated Rust input globs across every turbo task with a
single rust-fingerprint task that computes a TURBO_HASH stamp file. All
Rust build/check tasks now depend on this stamp instead of repeating the
full glob list.

Also add `SCCACHE_*` to `globalPassThroughEnv` so `sccache` env vars are
available to turbo tasks.

## Why

`SCCACHE_*` and `RUSTC_WRAPPER` env vars are required to build under
sccache, but do not affect the build in a material way.

This simplifies the repeated constructs that are unfortunately difficult
to factor out, but is provably the same as listing all the files each
time (the rust-fingerprint file's content is its `TURBO_HASH`).
2026-03-31 14:15:50 -06:00

20 lines
695 B
JavaScript

#!/usr/bin/env node
// Write the turbo-computed TURBO_HASH to a stamp file.
// This is used as a turbo task whose only purpose is to compute
// a fingerprint of all Rust inputs. Other scripts (native-cache.js)
// read this stamp to get a cache key without re-hashing everything.
const fs = require('fs')
const path = require('path')
const stamp = path.resolve(__dirname, '..', 'target', '.rust-fingerprint')
if (!process.env.TURBO_HASH) {
console.log('rust-fingerprint: skipping (not running under turbo)')
process.exit(0)
}
fs.mkdirSync(path.dirname(stamp), { recursive: true })
fs.writeFileSync(stamp, process.env.TURBO_HASH)
console.log(`rust-fingerprint: ${process.env.TURBO_HASH}`)