diff options
author | Fabio Berger <me@fabioberger.com> | 2018-02-16 11:09:53 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-02-16 11:09:53 +0800 |
commit | e2b51c5dc46b30b21e0561689de1f9a3d0127554 (patch) | |
tree | c8f93b5700961a46b16e49e52d159c989c11102d /packages/deployer/src/compiler.ts | |
parent | b610b7c1923dcc56883c5167393122ceaed26708 (diff) | |
parent | b75fdd6b66a30196d53331827733b863bed770f0 (diff) | |
download | dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.gz dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.bz2 dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.lz dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.xz dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.tar.zst dexon-sol-tools-e2b51c5dc46b30b21e0561689de1f9a3d0127554.zip |
Merge branch 'development' of github.com:0xProject/0x.js into development
* 'development' of github.com:0xProject/0x.js: (24 commits)
Rename variables
Update CHANGELOG
Add npm config for contracts list
Run prettier
Fix checks, add contract list to compile script in package.json
Add contracts to compiler options
Add missing public types from connect docs
Change imports order
Change default page params in connect to page 1 and perPage 100
Add docs staging to 0x.js package
Fix a typo
Add an assertion
Add PR numbers
Fix entry points
Add tests for dev-utils package
Move subproviders from dev-utils to subproviders
Add missing CHANGELOG entry
Add support for intersection types in docs
Add stagedocs script to connect package
web3 typings fix - web3.net.peerCount returns number
...
Diffstat (limited to 'packages/deployer/src/compiler.ts')
-rw-r--r-- | packages/deployer/src/compiler.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts index 63db6c865..2b0b81c44 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 _specifiedContracts: 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._specifiedContracts = opts.specifiedContracts; } /** * Compiles all Solidity files found in contractsDir and writes JSON artifacts to artifactsDir. @@ -136,6 +139,8 @@ 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._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER) || this._specifiedContracts.has(contractName); let currentArtifactString: string; let currentArtifact: ContractArtifact; @@ -150,11 +155,12 @@ export class Compiler { oldNetworks = currentArtifact.networks; const oldNetwork: ContractData = oldNetworks[this._networkId]; shouldCompile = - _.isUndefined(oldNetwork) || - oldNetwork.keccak256 !== sourceHash || - oldNetwork.optimizer_enabled !== this._optimizerEnabled; + (_.isUndefined(oldNetwork) || + oldNetwork.keccak256 !== sourceHash || + oldNetwork.optimizer_enabled !== this._optimizerEnabled) && + isContractSpecified; } catch (err) { - shouldCompile = true; + shouldCompile = isContractSpecified; } if (!shouldCompile) { |