|
|
@ -8,6 +8,7 @@ var path = require('path'); |
|
|
|
var getInstrumentedVersion = require('./instrumentSolidity.js'); |
|
|
|
var getInstrumentedVersion = require('./instrumentSolidity.js'); |
|
|
|
var CoverageMap = require('./coverageMap.js'); |
|
|
|
var CoverageMap = require('./coverageMap.js'); |
|
|
|
var coverage = new CoverageMap(); |
|
|
|
var coverage = new CoverageMap(); |
|
|
|
|
|
|
|
var mkdirp = require('mkdirp'); |
|
|
|
|
|
|
|
|
|
|
|
var childprocess = require('child_process'); |
|
|
|
var childprocess = require('child_process'); |
|
|
|
|
|
|
|
|
|
|
@ -27,14 +28,15 @@ if (shell.test('-d','../originalContracts')){ |
|
|
|
shell.mv('./../contracts/', './../originalContracts/'); |
|
|
|
shell.mv('./../contracts/', './../originalContracts/'); |
|
|
|
shell.mkdir('./../contracts/'); |
|
|
|
shell.mkdir('./../contracts/'); |
|
|
|
//For each contract in originalContracts, get the instrumented version
|
|
|
|
//For each contract in originalContracts, get the instrumented version
|
|
|
|
shell.ls('./../originalContracts/*.sol').forEach(function(file) { |
|
|
|
shell.ls('./../originalContracts/**/*.sol').forEach(function(file) { |
|
|
|
if (file !== 'originalContracts/Migrations.sol') { |
|
|
|
if (file !== 'originalContracts/Migrations.sol') { |
|
|
|
console.log("instrumenting ", file); |
|
|
|
console.log("instrumenting ", file); |
|
|
|
var contract = fs.readFileSync("./" + file).toString(); |
|
|
|
var contract = fs.readFileSync("./" + file).toString(); |
|
|
|
var fileName = path.basename(file); |
|
|
|
var fileName = path.basename(file); |
|
|
|
var instrumentedContractInfo = getInstrumentedVersion(contract, fileName, true); |
|
|
|
var instrumentedContractInfo = getInstrumentedVersion(contract, file, true); |
|
|
|
fs.writeFileSync('./../contracts/' + path.basename(file), instrumentedContractInfo.contract); |
|
|
|
mkdirp.sync(path.dirname(file.replace('originalContracts', 'contracts'))); |
|
|
|
var canonicalContractPath = path.resolve('./../originalContracts/' + path.basename(file)); |
|
|
|
fs.writeFileSync(file.replace('originalContracts','contracts'), instrumentedContractInfo.contract); |
|
|
|
|
|
|
|
var canonicalContractPath = path.resolve(file); |
|
|
|
coverage.addContract(instrumentedContractInfo, canonicalContractPath); |
|
|
|
coverage.addContract(instrumentedContractInfo, canonicalContractPath); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|