From af333b1838628fa0f8d393b19818224c15427106 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 14 Feb 2018 13:54:04 -0800 Subject: Fix checks, add contract list to compile script in package.json --- packages/deployer/src/cli.ts | 2 +- packages/deployer/src/compiler.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'packages/deployer/src') diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts index 5e0f2145b..bc1ec8421 100644 --- a/packages/deployer/src/cli.ts +++ b/packages/deployer/src/cli.ts @@ -100,7 +100,7 @@ async function onDeployCommand(argv: CliOptions): Promise { function generateContractsToCompileSet(contracts: string): Set { const contractsToCompile = new Set(); const contractsArray = contracts.split(','); - _.forEach(contracts, contractName => { + _.forEach(contractsArray, contractName => { contractsToCompile.add(contractName); }); return contractsToCompile; diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts index 4e5518d0e..beeda1260 100644 --- a/packages/deployer/src/compiler.ts +++ b/packages/deployer/src/compiler.ts @@ -139,6 +139,7 @@ export class Compiler { const contractName = path.basename(contractBaseName, SOLIDITY_FILE_EXTENSION); const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`; const sourceHash = `0x${ethUtil.sha3(source).toString('hex')}`; + const isContractSpecified = this._contractsToCompile.has(ALL_CONTRACTS_IDENTIFIER) || this._contractsToCompile.has(contractName); let currentArtifactString: string; let currentArtifact: ContractArtifact; @@ -156,9 +157,9 @@ export class Compiler { (_.isUndefined(oldNetwork) || oldNetwork.keccak256 !== sourceHash || oldNetwork.optimizer_enabled !== this._optimizerEnabled) && - (this._contractsToCompile.has(ALL_CONTRACTS_IDENTIFIER) || this._contractsToCompile.has(contractName)); + isContractSpecified; } catch (err) { - shouldCompile = true; + shouldCompile = isContractSpecified; } if (!shouldCompile) { -- cgit