mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-02 00:25:34 +08:00
* Expand LLVM native output targets - Add owned helper and runtime-pack contracts for macOS x64, Linux glibc/musl, Windows x64, and WASI. - Generalize LLVM target selection, package validation, linker plans, and release/CI matrices. - Document linker boundaries and add focused native-output and runtime-pack coverage. * Pin Windows LLVM helper CI to VS 2022 The official LLVM archive needs the Visual Studio 2022 CMake generator, which is not guaranteed by windows-latest. * Align bootstrap cache with LLVM runtime-pack builds Use the same target-specific helper and linker identity before and after compiler loading so routed executable cache hits remain lightweight. * Install Windows LLVM CI tools with Chocolatey windows-2022 includes Visual Studio but not winget; use its available Chocolatey bootstrap for CMake and Ninja. * Prevent Zig version probes from leaving runtime-pack objects Run runtime-pack compiler version probes in a private temporary directory and remove the accidental tracked WASI a.o file. * Use 7-Zip for Windows LLVM setup Extract the official LLVM development archive with two-stage 7-Zip instead of Windows tar.exe, which timed out while materializing the toolchain tree. * Define ssize_t for the MSVC runtime pack Clang's MSVC target does not expose POSIX ssize_t through sys/types.h; define the pointer-sized runtime type without affecting MinGW. * Build the Windows runtime pack with Zig Use the MinGW-compatible Windows sysroot required by the runtime while retaining COFF helper output and installing Zig in the Windows native CI lane. * Give macOS LLVM differential shard time to finish Shard 1 passed its setup and focused contracts but was cancelled during its cold LLVM differential slice at the 20-minute job limit.
78 lines
3.3 KiB
JavaScript
78 lines
3.3 KiB
JavaScript
#!/usr/bin/env tsx
|
|
// Generates packages/compiler/surface-manifest.json — the machine-readable
|
|
// manifest of the language and stdlib surface the static tier compiles at
|
|
// this release, with stable per-entry ids so tooling can diff two releases
|
|
// mechanically. The schema and the projection sources are documented in
|
|
// packages/compiler/src/coverage/surface-manifest.ts; this script owns the
|
|
// version spine and the file lifecycle.
|
|
//
|
|
// The version spine: compilerVersion is the EXACT published release version
|
|
// — the version release.yml keys on (packages/cli/package.json, the
|
|
// `scriptc` package) — so an external version pin matches the manifest's
|
|
// string verbatim. All four published workspace packages must agree (the same
|
|
// check the release workflow runs); a drifted tree fails generation instead
|
|
// of stamping an ambiguous version.
|
|
//
|
|
// Usage:
|
|
// pnpm manifest regenerate packages/compiler/surface-manifest.json
|
|
// pnpm manifest --check verify the committed file matches a fresh
|
|
// generation (exit 1 on drift) without writing
|
|
//
|
|
// Runs under tsx (it imports the compiler's TypeScript sources directly, no
|
|
// build step) — `pnpm manifest` wires that up.
|
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { generateSurfaceManifest, renderSurfaceManifest } from "../packages/compiler/src/coverage/surface-manifest.ts";
|
|
|
|
const root = fileURLToPath(new URL("..", import.meta.url));
|
|
const readJson = (path) => JSON.parse(readFileSync(root + path, "utf8"));
|
|
|
|
const version = readJson("packages/cli/package.json").version;
|
|
for (const pkg of [
|
|
"runtime",
|
|
"runtime-darwin-arm64", "runtime-darwin-x64",
|
|
"runtime-linux-x64-gnu", "runtime-linux-arm64-gnu",
|
|
"runtime-linux-x64-musl", "runtime-linux-arm64-musl",
|
|
"runtime-win32-x64-msvc", "runtime-wasm32-wasi",
|
|
"llvm-darwin-arm64", "llvm-darwin-x64",
|
|
"llvm-linux-x64-gnu", "llvm-linux-arm64-gnu",
|
|
"llvm-linux-x64-musl", "llvm-linux-arm64-musl", "llvm-win32-x64-msvc",
|
|
"compiler",
|
|
]) {
|
|
const v = readJson(`packages/${pkg}/package.json`).version;
|
|
if (v !== version) {
|
|
console.error(
|
|
`version mismatch: packages/${pkg} is ${v}, packages/cli is ${version} — run 'node scripts/sync-versions.mjs' first`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
const outPath = root + "packages/compiler/surface-manifest.json";
|
|
const manifest = generateSurfaceManifest(version);
|
|
const rendered = renderSurfaceManifest(manifest);
|
|
|
|
const counts = new Map();
|
|
for (const e of manifest.entries) {
|
|
const key = `${e.kind}/${e.status}`;
|
|
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
}
|
|
|
|
if (process.argv.includes("--check")) {
|
|
let committed = null;
|
|
try {
|
|
committed = readFileSync(outPath, "utf8");
|
|
} catch {
|
|
// fall through to the drift report
|
|
}
|
|
if (committed !== rendered) {
|
|
console.error("surface-manifest.json is stale — run 'pnpm manifest' and commit the result");
|
|
process.exit(1);
|
|
}
|
|
console.log(`surface-manifest.json is current (${manifest.entries.length} entries, version ${version})`);
|
|
} else {
|
|
writeFileSync(outPath, rendered);
|
|
console.log(`wrote packages/compiler/surface-manifest.json (version ${version}, ${manifest.entries.length} entries)`);
|
|
for (const [key, n] of [...counts].sort()) console.log(` ${key}: ${n}`);
|
|
}
|