clank-together/tools/rodecomp/remove-verification.mjs

12 lines
882 B
JavaScript

import fs from 'node:fs';
import {execFileSync} from 'node:child_process';
const repo='/data/repo';
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+'/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','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'});