Skip to content

Commit

Permalink
Insert reportedVersion in list.json
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Jun 27, 2018
1 parent 1bbaefc commit 5de8046
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"devDependencies": {
"ethereumjs-util": "^5.0.1",
"solc": "^0.4.24",
"standard": "^8.4.0",
"swarmhash": "^0.1.0"
},
Expand Down
13 changes: 12 additions & 1 deletion update
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
#!/usr/bin/env node --expose-gc

'use strict'

Expand All @@ -7,6 +7,7 @@ const path = require('path')
const semver = require('semver')
const ethUtil = require('ethereumjs-util')
const swarmhash = require('swarmhash')
const solc = require('solc/wrapper')

// This script updates the index files list.js and list.txt in the bin directory,
// as well as the soljson-latest.js files.
Expand All @@ -30,6 +31,15 @@ fs.readdir(path.join(__dirname, '/bin'), function (err, files) {
function readFile (file) {
return fs.readFileSync(path.join(__dirname, '/bin', file))
}

function readBuiltinVersion (file) {
var a = solc(require(path.join(__dirname, '/bin', file)))
var b = a.version()
a = undefined
global.gc()
console.log(b)
return b
}

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

0 comments on commit 5de8046

Please sign in to comment.