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

Commit

Permalink
Merge pull request #175 from ConsenSys/download-compiler
Browse files Browse the repository at this point in the history
Fix download compiler only once
  • Loading branch information
nbanmp committed Apr 12, 2019
2 parents 530034f + d9fb142 commit d9a0ee7
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 d9a0ee7

Please sign in to comment.