Skip to content

Commit f005986

Browse files
committed
Insert reportedVersion in list.json
1 parent 36ae93a commit f005986

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"devDependencies": {
1010
"ethereumjs-util": "^5.0.1",
11+
"solc": "^0.4.24",
1112
"standard": "^8.4.0",
1213
"swarmhash": "^0.1.0"
1314
},

update

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const path = require('path')
77
const semver = require('semver')
88
const ethUtil = require('ethereumjs-util')
99
const swarmhash = require('swarmhash')
10+
const solc = require('solc/wrapper')
1011

1112
// This script updates the index files list.js and list.txt in the bin directory,
1213
// as well as the soljson-latest.js files.
@@ -31,6 +32,10 @@ fs.readdir(path.join(__dirname, '/bin'), function (err, files) {
3132
return fs.readFileSync(path.join(__dirname, '/bin', file))
3233
}
3334

35+
function readBuiltinVersion (file) {
36+
return solc(require(path.join(__dirname, '/bin', file))).version()
37+
}
38+
3439
// ascending list (oldest version first)
3540
const parsedList = files
3641
.map(function (file) { return file.match(/^soljson-v([0-9.]*)(-([^+]*))?(\+(.*))?.js$/) })
@@ -40,6 +45,7 @@ fs.readdir(path.join(__dirname, '/bin'), function (err, files) {
4045
console.log('Processing ' + pars.path)
4146
const fileContent = readFile(pars.path)
4247
pars.longVersion = buildVersion(pars)
48+
pars.reportedVersion = readBuiltinVersion(pars.path)
4349
pars.keccak256 = '0x' + ethUtil.sha3(fileContent).toString('hex')
4450
pars.urls = [ 'bzzr://' + swarmhash(fileContent).toString('hex') ]
4551
return pars

0 commit comments

Comments
 (0)