aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src/compiler.ts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-02-18 09:51:19 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-02-21 05:19:12 +0800
commit6685cb3fba85d5052c67b19ad3fd33c4ccfe5b67 (patch)
tree856d74570d7be0c0852a3cf280b230a8397a2699 /packages/deployer/src/compiler.ts
parentd770e462082e9bd62c1bb1fda5be1b0799026081 (diff)
downloaddexon-sol-tools-6685cb3fba85d5052c67b19ad3fd33c4ccfe5b67.tar
dexon-sol-tools-6685cb3fba85d5052c67b19ad3fd33c4ccfe5b67.tar.gz
dexon-sol-tools-6685cb3fba85d5052c67b19ad3fd33c4ccfe5b67.tar.bz2
dexon-sol-tools-6685cb3fba85d5052c67b19ad3fd33c4ccfe5b67.tar.lz
dexon-sol-tools-6685cb3fba85d5052c67b19ad3fd33c4ccfe5b67.tar.xz
dexon-sol-tools-6685cb3fba85d5052c67b19ad3fd33c4ccfe5b67.tar.zst
dexon-sol-tools-6685cb3fba85d5052c67b19ad3fd33c4ccfe5b67.zip
Fix race condition
Diffstat (limited to 'packages/deployer/src/compiler.ts')
-rw-r--r--packages/deployer/src/compiler.ts19
1 files changed, 11 insertions, 8 deletions
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index 6eca4b57f..5004d4bb4 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -168,7 +168,6 @@ export class Compiler {
: Array.from(this._specifiedContracts.values());
await Promise.all(_.map(fileNames, async fileName => this._setCompileActionAsync(fileName)));
await Promise.all(_.map(fileNames, async fileName => this._compileContractAsync(fileName)));
-
this._solcErrors.forEach(errMsg => {
utils.consoleLog(errMsg);
});
@@ -185,10 +184,6 @@ export class Compiler {
if (!contractSpecificSourceData.shouldCompile) {
return;
}
- const source = this._contractSourcesIfExists[fileName];
- const input = {
- [fileName]: source,
- };
const fullSolcVersion = binPaths[contractSpecificSourceData.solc_version];
const solcBinPath = `./solc/solc_bin/${fullSolcVersion}`;
@@ -196,6 +191,10 @@ export class Compiler {
const solcInstance = solc.setupMethods(solcBin);
utils.consoleLog(`Compiling ${fileName}...`);
+ const source = this._contractSourcesIfExists[fileName];
+ const input = {
+ [fileName]: source,
+ };
const sourcesToCompile = {
sources: input,
};
@@ -271,10 +270,14 @@ export class Compiler {
contractNetworkData.solc_version !== contractSpecificSourceData.solc_version;
}
}
- _.forEach(contractSpecificSourceData.dependencies, async dependency => {
- await this._setCompileActionAsync(dependency);
+ await Promise.all(
+ _.map(contractSpecificSourceData.dependencies, async dependency => this._setCompileActionAsync(dependency)),
+ );
+ _.forEach(contractSpecificSourceData.dependencies, dependency => {
contractSpecificSourceData.shouldCompile =
- contractSpecificSourceData.shouldCompile || this._contractSourceData[dependency].shouldCompile;
+ contractSpecificSourceData.shouldCompile ||
+ (this._contractSourceData[dependency].shouldCompile &&
+ (this._specifiedContracts.has('*') || this._specifiedContracts.has(dependency)));
});
}
/**