From 7d8c7b119c65d4746c18b4ffebc14e7e6557986c Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 11 Apr 2018 09:47:55 -0400 Subject: [PATCH] add warning after compile for files without a compatible compiler --- lib/contracts/compiler.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/contracts/compiler.js b/lib/contracts/compiler.js index c9a7ffa4..fa474e52 100644 --- a/lib/contracts/compiler.js +++ b/lib/contracts/compiler.js @@ -7,9 +7,10 @@ class Compiler { } compile_contracts(contractFiles, cb) { + const self = this; let available_compilers = {}; - let pluginCompilers = this.plugins.getPluginsProperty('compilers', 'compilers'); + let pluginCompilers = self.plugins.getPluginsProperty('compilers', 'compilers'); pluginCompilers.forEach(function (compilerObject) { available_compilers[compilerObject.extension] = compilerObject.cb; }); @@ -18,10 +19,13 @@ class Compiler { async.eachObject(available_compilers, function (extension, compiler, callback) { - // TODO: warn about files it doesn't know how to compile let matchingFiles = contractFiles.filter(function (file) { let fileMatch = file.filename.match(/\.[0-9a-z]+$/); - return (fileMatch && (fileMatch[0] === extension)); + if (fileMatch && (fileMatch[0] === extension)) { + file.compiled = true; + return true; + } + return false; }); compiler.call(compiler, matchingFiles || [], function (err, compileResult) { @@ -30,6 +34,12 @@ class Compiler { }); }, function (err) { + contractFiles.forEach(file => { + if (!file.compiled) { + self.logger.warn(`${file.filename} doesn't have a compatible contract compiler. Maybe a plugin exists for it.`); + } + }); + cb(err, compiledObject); } );