diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-02-15 06:03:12 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-02-16 02:13:06 +0800 |
commit | f62762bd0e5d3be443e412df1829c2d89ef4640e (patch) | |
tree | 170aba9754bb867c71ab06e6141bc4672f9aa85f /packages/deployer/src/compiler.ts | |
parent | 4b6735227876913aa70c22e1d57f547f97201a3a (diff) | |
download | dexon-sol-tools-f62762bd0e5d3be443e412df1829c2d89ef4640e.tar dexon-sol-tools-f62762bd0e5d3be443e412df1829c2d89ef4640e.tar.gz dexon-sol-tools-f62762bd0e5d3be443e412df1829c2d89ef4640e.tar.bz2 dexon-sol-tools-f62762bd0e5d3be443e412df1829c2d89ef4640e.tar.lz dexon-sol-tools-f62762bd0e5d3be443e412df1829c2d89ef4640e.tar.xz dexon-sol-tools-f62762bd0e5d3be443e412df1829c2d89ef4640e.tar.zst dexon-sol-tools-f62762bd0e5d3be443e412df1829c2d89ef4640e.zip |
Add contracts to compiler options
Diffstat (limited to 'packages/deployer/src/compiler.ts')
-rw-r--r-- | packages/deployer/src/compiler.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts index 63db6c865..4e5518d0e 100644 --- a/packages/deployer/src/compiler.ts +++ b/packages/deployer/src/compiler.ts @@ -17,6 +17,7 @@ import { import { utils } from './utils/utils'; const SOLIDITY_FILE_EXTENSION = '.sol'; +const ALL_CONTRACTS_IDENTIFIER = '*'; export class Compiler { private _contractsDir: string; @@ -25,6 +26,7 @@ export class Compiler { private _artifactsDir: string; private _contractSourcesIfExists?: ContractSources; private _solcErrors: Set<string>; + private _contractsToCompile: Set<string>; /** * Recursively retrieves Solidity source code from directory. * @param dirPath Directory to search. @@ -106,6 +108,7 @@ export class Compiler { this._optimizerEnabled = opts.optimizerEnabled; this._artifactsDir = opts.artifactsDir; this._solcErrors = new Set(); + this._contractsToCompile = opts.contractsToCompile; } /** * Compiles all Solidity files found in contractsDir and writes JSON artifacts to artifactsDir. @@ -150,9 +153,10 @@ export class Compiler { oldNetworks = currentArtifact.networks; const oldNetwork: ContractData = oldNetworks[this._networkId]; shouldCompile = - _.isUndefined(oldNetwork) || + (_.isUndefined(oldNetwork) || oldNetwork.keccak256 !== sourceHash || - oldNetwork.optimizer_enabled !== this._optimizerEnabled; + oldNetwork.optimizer_enabled !== this._optimizerEnabled) && + (this._contractsToCompile.has(ALL_CONTRACTS_IDENTIFIER) || this._contractsToCompile.has(contractName)); } catch (err) { shouldCompile = true; } |