fix: wip bind live ancestor scopes and adopt 0.2.0
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env node
|
||||
// Verify actual Cargo resolution, not just version strings in workspace manifests.
|
||||
import assert from 'node:assert/strict';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const cwd = fileURLToPath(new URL('../', import.meta.url));
|
||||
const host = execFileSync('rustc', ['-vV'], { cwd, encoding: 'utf8' })
|
||||
.match(/^host: (.+)$/m)?.[1];
|
||||
assert.ok(host, 'rustc must report the validation host');
|
||||
const metadata = JSON.parse(execFileSync('cargo', [
|
||||
'metadata', '--locked', '--offline', '--format-version=1', '--filter-platform', host,
|
||||
], { cwd, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 }));
|
||||
const expected = ['wip-client', 'wip-http', 'wip-protocol', 'wip-text-view'];
|
||||
const source = 'registry+https://github.com/rust-lang/crates.io-index';
|
||||
const sdk = metadata.packages.filter(pkg => pkg.name.startsWith('wip-'));
|
||||
for (const pkg of sdk) {
|
||||
assert.equal(pkg.version, '0.2.0', `${pkg.name}: no old WIP version is permitted`);
|
||||
assert.equal(pkg.source, source, `${pkg.name}: must resolve from crates.io, not a path/Git substitute`);
|
||||
}
|
||||
for (const name of expected) {
|
||||
assert.equal(sdk.filter(pkg => pkg.name === name).length, 1, `${name}: expected one package source`);
|
||||
}
|
||||
console.log(`Verified ${expected.join(', ')} at crates.io 0.2.0; one Protocol source (${host})`);
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Verify the unmodified Cargo-vendored WIP source snapshot, including its tests.
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, resolve } from 'node:path';
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const packages = ['wip-client', 'wip-http', 'wip-protocol', 'wip-text-view'];
|
||||
let files = 0;
|
||||
for (const name of packages) {
|
||||
const directory = resolve(root, 'vendor/wip-rs', name);
|
||||
const checksum = JSON.parse(readFileSync(resolve(directory, '.cargo-checksum.json'), 'utf8'));
|
||||
for (const [file, expected] of Object.entries(checksum.files)) {
|
||||
const actual = createHash('sha256').update(readFileSync(resolve(directory, file))).digest('hex');
|
||||
if (actual !== expected) throw new Error(`Changed upstream source: ${name}/${file}`);
|
||||
files++;
|
||||
}
|
||||
}
|
||||
console.log(`Verified ${files} files in ${packages.length} packages from wip-rs 1cbe03b49e48dd7e0be28b76fbc3c932f8920a36`);
|
||||
Reference in New Issue
Block a user