Fix passing compiler options

This commit is contained in:
Andre Medeiros 2018-08-30 16:11:34 -04:00
parent 026da48e74
commit bb92582c0a
2 changed files with 8 additions and 2 deletions

View File

@ -165,7 +165,7 @@ class Engine {
deploymentService(options) { deploymentService(options) {
let self = this; 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('solidity', {ipc: self.ipc, useDashboard: this.useDashboard});
this.registerModule('vyper'); this.registerModule('vyper');
this.registerModule('profiler'); this.registerModule('profiler');

View File

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