Merge pull request #757 from embark-framework/fix-passing-compiler-options

Fix passing compiler options
This commit is contained in:
André Medeiros 2018-08-30 16:26:12 -04:00 committed by GitHub
commit 6122b69a03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -165,7 +165,7 @@ class Engine {
deploymentService(options) {
let self = this;
this.registerModule('compiler', {plugins: self.plugins});
this.registerModule('compiler', {plugins: self.plugins, disableOptimizations: options.disableOptimizations});
this.registerModule('solidity', {ipc: self.ipc, useDashboard: this.useDashboard});
this.registerModule('vyper');
this.registerModule('profiler');

View File

@ -7,6 +7,8 @@ class Compiler {
this.events = embark.events;
this.logger = embark.logger;
this.disableOptimizations = options.disableOptimizations;
this.events.setCommandHandler("compiler:contracts", function(contractFiles, options, cb) {
self.compile_contracts(contractFiles, options, cb);
});
@ -27,6 +29,10 @@ class Compiler {
let compiledObject = {};
let compilerOptions = {
disableOptimizations: this.disableOptimizations || options.disableOptimizations
};
async.eachObject(available_compilers,
function (extension, compiler, callback) {
let matchingFiles = contractFiles.filter(function (file) {
@ -41,7 +47,7 @@ class Compiler {
if (!matchingFiles || !matchingFiles.length) {
return callback();
}
compiler.call(compiler, matchingFiles, options, function (err, compileResult) {
compiler.call(compiler, matchingFiles, compilerOptions, function (err, compileResult) {
Object.assign(compiledObject, compileResult);
callback(err, compileResult);
});