From 5de8046bd1ff2dcb930f39a2e91f70a1f0871826 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 27 Jun 2018 13:25:41 +0200 Subject: [PATCH] Insert reportedVersion in list.json --- package.json | 1 + update | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c9d543a556..51de80009b 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "devDependencies": { "ethereumjs-util": "^5.0.1", + "solc": "^0.4.24", "standard": "^8.4.0", "swarmhash": "^0.1.0" }, diff --git a/update b/update index 6a5cfd9900..8687ad7272 100755 --- a/update +++ b/update @@ -1,4 +1,4 @@ -#!/usr/bin/env node +#!/usr/bin/env node --expose-gc 'use strict' @@ -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. @@ -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 @@ -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