mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## 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`).
20 lines
695 B
JavaScript
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}`)
|