From bb92582c0a500c2ec4d30b6827cd3009848c9287 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Thu, 30 Aug 2018 16:11:34 -0400 Subject: [PATCH] Fix passing compiler options --- lib/core/engine.js | 2 +- lib/modules/compiler/index.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/core/engine.js b/lib/core/engine.js index 3c54aa36..132e2951 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -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'); diff --git a/lib/modules/compiler/index.js b/lib/modules/compiler/index.js index 5758a8d0..9be06d56 100644 --- a/lib/modules/compiler/index.js +++ b/lib/modules/compiler/index.js @@ -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); });