add warning after compile for files without a compatible compiler

This commit is contained in:
Jonathan Rainville 2018-04-11 09:47:55 -04:00
parent 6647c31d38
commit 7d8c7b119c
1 changed files with 13 additions and 3 deletions

View File

@ -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);
}
);