Skip to content

Commit 5de8046

Browse files
committed
Insert reportedVersion in list.json
1 parent 1bbaefc commit 5de8046

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

package.json

+1
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

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env node
1+
#!/usr/bin/env node --expose-gc
22

33
'use strict'
44

@@ -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.
@@ -30,6 +31,15 @@ fs.readdir(path.join(__dirname, '/bin'), function (err, files) {
3031
function readFile (file) {
3132
return fs.readFileSync(path.join(__dirname, '/bin', file))
3233
}
34+
35+
function readBuiltinVersion (file) {
36+
var a = solc(require(path.join(__dirname, '/bin', file)))
37+
var b = a.version()
38+
a = undefined
39+
global.gc()
40+
console.log(b)
41+
return b
42+
}
3343

3444
// ascending list (oldest version first)
3545
const parsedList = files
@@ -39,6 +49,7 @@ fs.readdir(path.join(__dirname, '/bin'), function (err, files) {
3949
.map(function (pars) {
4050
const fileContent = readFile(pars.path)
4151
pars.longVersion = buildVersion(pars)
52+
pars.reportedVersion = readBuiltinVersion(pars.path)
4253
pars.keccak256 = '0x' + ethUtil.sha3(fileContent).toString('hex')
4354
pars.urls = [ 'bzzr://' + swarmhash(fileContent).toString('hex') ]
4455
return pars

0 commit comments

Comments
 (0)