aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src/compiler.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-04-02 19:57:44 +0800
committerGitHub <noreply@github.com>2018-04-02 19:57:44 +0800
commitd95b1e2db499d0264a1020be1ec453c5136b5a3b (patch)
treeb26623424303ff4d5ba17080b53ef40d037a1426 /packages/deployer/src/compiler.ts
parent695b697cdf6c73bb4b5f920869ce128f9a9e7523 (diff)
parentc1d6c7ff66079731df405e25c4b2aa83c86fffb9 (diff)
downloaddexon-0x-contracts-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar
dexon-0x-contracts-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.gz
dexon-0x-contracts-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.bz2
dexon-0x-contracts-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.lz
dexon-0x-contracts-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.xz
dexon-0x-contracts-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.zst
dexon-0x-contracts-d95b1e2db499d0264a1020be1ec453c5136b5a3b.zip
Merge pull request #485 from 0xProject/feature/metacoin
Add metacoin example project
Diffstat (limited to 'packages/deployer/src/compiler.ts')
-rw-r--r--packages/deployer/src/compiler.ts25
1 files changed, 17 insertions, 8 deletions
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index 219a55c32..ba360cb57 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -45,7 +45,6 @@ export class Compiler {
private _artifactsDir: string;
// This get's set in the beggining of `compileAsync` function. It's not called from a constructor, but it's the only public method of that class and could as well be.
private _contractSources!: ContractSources;
- private _solcErrors: Set<string> = new Set();
private _specifiedContracts: Set<string> = new Set();
private _contractSourceData: ContractSourceData = {};
/**
@@ -114,9 +113,6 @@ export class Compiler {
for (const fileName of fileNames) {
await this._compileContractAsync(fileName);
}
- this._solcErrors.forEach(errMsg => {
- logUtils.log(errMsg);
- });
}
/**
* Compiles contract and saves artifact to artifactsDir.
@@ -179,10 +175,23 @@ export class Compiler {
);
if (!_.isUndefined(compiled.errors)) {
- _.forEach(compiled.errors, errMsg => {
- const normalizedErrMsg = getNormalizedErrMsg(errMsg);
- this._solcErrors.add(normalizedErrMsg);
- });
+ const SOLIDITY_WARNING_PREFIX = 'Warning';
+ const isError = (errorOrWarning: string) => !errorOrWarning.includes(SOLIDITY_WARNING_PREFIX);
+ const isWarning = (errorOrWarning: string) => errorOrWarning.includes(SOLIDITY_WARNING_PREFIX);
+ const errors = _.filter(compiled.errors, isError);
+ const warnings = _.filter(compiled.errors, isWarning);
+ if (!_.isEmpty(errors)) {
+ errors.forEach(errMsg => {
+ const normalizedErrMsg = getNormalizedErrMsg(errMsg);
+ logUtils.log(normalizedErrMsg);
+ });
+ process.exit(1);
+ } else {
+ warnings.forEach(errMsg => {
+ const normalizedErrMsg = getNormalizedErrMsg(errMsg);
+ logUtils.log(normalizedErrMsg);
+ });
+ }
}
const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION);
const contractIdentifier = `${fileName}:${contractName}`;