Read project config from data/ (decomp.json, compile.json, toolchain.lock.json)

This commit is contained in:
ragnarok-clanker 2026-10-27 15:41:06 +01:00
commit 91c799f7d3
13 changed files with 20 additions and 20 deletions

View file

@ -5,4 +5,4 @@ TC=/opt/toolchain/VC/Tools/MSVC/14.29.30133
SDK='/opt/toolchain/Program Files/Windows Kits/10/Include/10.0.19041.0'
export INCLUDE="Z:\\opt\\toolchain\\VC\\Tools\\MSVC\\14.29.30133\\include;Z:\\opt\\toolchain\\VC\\Tools\\MSVC\\14.29.30133\\atlmfc\\include;$(printf '%s' "$SDK" | sed 's|/|\\|g' | sed 's/^/Z:/')\\ucrt;$(printf '%s' "$SDK" | sed 's|/|\\|g' | sed 's/^/Z:/')\\shared;$(printf '%s' "$SDK" | sed 's|/|\\|g' | sed 's/^/Z:/')\\um"
cmake -S /data/repo -B /tmp/rodecomp-cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=/opt/td/cmake-toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
python3 /tools/export-compile.py /tmp/rodecomp-cmake/compile_commands.json /data/repo/compile.json --source /data/repo --compiler "$TC/bin/Hostx64/x86/cl.exe" --include "$INCLUDE"
python3 /tools/export-compile.py /tmp/rodecomp-cmake/compile_commands.json /data/repo/data/compile.json --source /data/repo --compiler "$TC/bin/Hostx64/x86/cl.exe" --include "$INCLUDE"

View file

@ -4,15 +4,15 @@ import { execFileSync } from 'node:child_process';
const repo = process.argv[2];
const compilerHash = process.argv[3];
if (!repo || !/^[a-f0-9]{64}$/.test(compilerHash ?? '')) throw new Error('usage: prepare-project.mjs <repo> <compiler-sha256>');
const file = `${repo}/decomp.json`;
const file = `${repo}/data/decomp.json`;
const p = JSON.parse(fs.readFileSync(file, 'utf8'));
p.name = 'rodecomp';
p.compileCommands = 'compile.json';
p.compileCommands = 'data/compile.json';
delete p.verification;
delete p.build;
p.matchPolicy = { autoMergeIdentical: true, approvals: 1, approvalsWithHeaderChanges: 2, maxCleanupCycles: 5, peerReviews: 3, peerMargin: 3, peerRejectMargin: 2 };
fs.writeFileSync(file, JSON.stringify(p, null, 2) + '\n');
fs.writeFileSync(`${repo}/toolchain.lock.json`, JSON.stringify({ragnarok:{family:'msvc',version:'19.29.30159',machine:'x86',image:'rodecomp/compiler:v142',clSha256:compilerHash,sdkVersion:'10.0.19041.0'}}, null, 2) + '\n');
execFileSync('git',['-c',`safe.directory=${repo}`,'add','decomp.json','compile.json','toolchain.lock.json'],{cwd:repo,stdio:'inherit'});
fs.writeFileSync(`${repo}/data/toolchain.lock.json`, JSON.stringify({ragnarok:{family:'msvc',version:'19.29.30159',machine:'x86',image:'rodecomp/compiler:v142',clSha256:compilerHash,sdkVersion:'10.0.19041.0'}}, null, 2) + '\n');
execFileSync('git',['-c',`safe.directory=${repo}`,'add','data/decomp.json','data/compile.json','data/toolchain.lock.json'],{cwd:repo,stdio:'inherit'});
execFileSync('git',['-c',`safe.directory=${repo}`,'-c','user.name=Clank Together','-c','user.email=bot@clank-together.invalid','commit','-m','Configure rodecomp v142 x86 contributor builds'],{cwd:repo,stdio:'inherit'});
console.log('Configured rodecomp with pinned compiler',compilerHash);

View file

@ -5,8 +5,8 @@ const cmake=repo+'/CMakeLists.txt';
const text=fs.readFileSync(cmake,'utf8');
if(!text.includes('add_subdirectory(Verification)'))throw Error('Expected Verification target');
fs.writeFileSync(cmake,text.replace(/^add_subdirectory\(Verification\)\r?\n?/m,''));
const file=repo+'/compile.json';const cfg=JSON.parse(fs.readFileSync(file,'utf8'));
const file=repo+'/data/compile.json';const cfg=JSON.parse(fs.readFileSync(file,'utf8'));
for(const unit of Object.keys(cfg.units))if(unit.startsWith('Verification/'))delete cfg.units[unit];
fs.writeFileSync(file,JSON.stringify(cfg,null,2)+'\n');
execFileSync('git',['-C',repo,'add','CMakeLists.txt','compile.json']);
execFileSync('git',['-C',repo,'add','CMakeLists.txt','data/compile.json']);
execFileSync('git',['-C',repo,'-c','user.name=Clank Together','-c','user.email=bot@clank-together.invalid','commit','-m','Remove build references to deleted verification sources'],{stdio:'inherit'});