aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer
diff options
context:
space:
mode:
Diffstat (limited to 'packages/deployer')
-rw-r--r--packages/deployer/CHANGELOG.json9
-rw-r--r--packages/deployer/solc_bin/.gitkeep0
-rw-r--r--packages/deployer/src/compiler.ts25
-rw-r--r--packages/deployer/src/globals.d.ts46
-rw-r--r--packages/deployer/tsconfig.json7
5 files changed, 27 insertions, 60 deletions
diff --git a/packages/deployer/CHANGELOG.json b/packages/deployer/CHANGELOG.json
index c06bbc887..cc0d8b7cf 100644
--- a/packages/deployer/CHANGELOG.json
+++ b/packages/deployer/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "0.3.5",
+ "changes": [
+ {
+ "note": "Don't try to write contract artifact if the error occured",
+ "pr": 485
+ }
+ ]
+ },
+ {
"version": "0.3.4",
"changes": [
{
diff --git a/packages/deployer/solc_bin/.gitkeep b/packages/deployer/solc_bin/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/deployer/solc_bin/.gitkeep
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}`;
diff --git a/packages/deployer/src/globals.d.ts b/packages/deployer/src/globals.d.ts
index 5b0d495d5..94e63a32d 100644
--- a/packages/deployer/src/globals.d.ts
+++ b/packages/deployer/src/globals.d.ts
@@ -1,49 +1,3 @@
-declare module 'dirty-chai';
-
-// tslint:disable:completed-docs
-declare module 'solc' {
- export interface ContractCompilationResult {
- srcmap: string;
- srcmapRuntime: string;
- bytecode: string;
- runtimeBytecode: string;
- interface: string;
- }
- export interface CompilationResult {
- errors: string[];
- contracts: {
- [contractIdentifier: string]: ContractCompilationResult;
- };
- sources: {
- [sourceName: string]: {
- AST: any;
- };
- };
- sourceList: string[];
- }
- export interface ImportContents {
- contents: string;
- }
- export interface InputSources {
- sources: {
- [fileName: string]: string;
- };
- }
- export interface SolcInstance {
- compile(
- sources: InputSources,
- optimizerEnabled: number,
- findImports: (importPath: string) => ImportContents,
- ): CompilationResult;
- }
- export function loadRemoteVersion(versionName: string, cb: (err: Error | null, res?: SolcInstance) => void): void;
- export function setupMethods(solcBin: any): SolcInstance;
-}
-
-declare module 'web3-eth-abi' {
- export function encodeParameters(typesArray: string[], parameters: any[]): string;
-}
-
declare module '*.json' {
const json: any;
/* tslint:disable */
diff --git a/packages/deployer/tsconfig.json b/packages/deployer/tsconfig.json
index a4cbc37c5..63cbc75c3 100644
--- a/packages/deployer/tsconfig.json
+++ b/packages/deployer/tsconfig.json
@@ -4,10 +4,5 @@
"outDir": "lib",
"strictFunctionTypes": false
},
- "include": [
- "./src/**/*",
- "./test/**/*",
- "../../node_modules/types-bn/index.d.ts",
- "../../node_modules/types-ethereumjs-util/index.d.ts"
- ]
+ "include": ["./src/**/*", "./test/**/*"]
}