Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Fix download compiler only once
Browse files Browse the repository at this point in the history
  • Loading branch information
daniyarchambylov committed Apr 11, 2019
1 parent 530034f commit d9fb142
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions compat/truffle-compile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,20 +339,16 @@ compile.with_dependencies = async function(options, callback, compileAll) {

filteredRequired = filteredRequired.filter(sourcePath => !sourcePath.endsWith('/Migrations.sol'))

let isSolcLoaded = false;
if (filteredRequired.length > 0) {
// Download solc compiler
const supplier = new CompilerSupplier(options.compilers.solc);
await supplier.load()
.catch(e => {
throw e;
})

}
Promise.all(filteredRequired.map(async (sourcePath) => {
if (!isSolcLoaded) {
const supplier = new CompilerSupplier(options.compilers.solc);
await supplier
.load()
.then(solc => {
// do nothing
})
.catch(e => {
throw e;
})
isSolcLoaded = true;
}
await new Promise((resolve, reject) => {
Profiler.imported_sources(
config.with({
Expand Down

0 comments on commit d9fb142

Please sign in to comment.