mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Also generate optimized code.
This commit is contained in:
parent
bbe3557a2f
commit
5c3a80ab5b
@ -8,8 +8,12 @@ import json
|
||||
solc = sys.argv[1]
|
||||
report = open("report.txt", "w")
|
||||
|
||||
for optimize in [False, True]:
|
||||
for f in sorted(glob.glob("*.sol")):
|
||||
proc = subprocess.Popen([solc, '--combined-json', 'bin,metadata', f], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
args = [solc, '--combined-json', 'bin,metadata', f]
|
||||
if optimize:
|
||||
args += ['--optimize']
|
||||
proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
(out, err) = proc.communicate()
|
||||
try:
|
||||
result = json.loads(out.strip())
|
||||
|
@ -49,13 +49,15 @@ var fs = require('fs')
|
||||
|
||||
var compiler = require('solc/wrapper.js')(require('./soljson.js'))
|
||||
|
||||
for (var optimize of [false, true])
|
||||
{
|
||||
for (var filename of process.argv.slice(2))
|
||||
{
|
||||
if (filename !== undefined)
|
||||
{
|
||||
var inputs = {}
|
||||
inputs[filename] = fs.readFileSync(filename).toString()
|
||||
var result = compiler.compile({sources: inputs})
|
||||
var result = compiler.compile({sources: inputs}, optimize)
|
||||
if (!('contracts' in result) || Object.keys(result['contracts']).length === 0)
|
||||
{
|
||||
console.log(filename + ': ERROR')
|
||||
@ -70,6 +72,7 @@ for (var filename of process.argv.slice(2))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
chmod +x solc
|
||||
./solc *.sol > report.txt
|
||||
|
Loading…
Reference in New Issue
Block a user