add solc options

This commit is contained in:
Iuri Matias 2018-08-20 09:27:23 -04:00
parent cc39931852
commit 6ae697f36a
3 changed files with 23 additions and 3 deletions

View File

@ -54,11 +54,11 @@ Config.prototype.loadConfigFiles = function(options) {
this.embarkConfig = fs.readJSONSync(options.embarkConfig);
this.embarkConfig.plugins = this.embarkConfig.plugins || {};
this.loadEmbarkConfigFile();
this.plugins = new Plugins({plugins: this.embarkConfig.plugins, logger: this.logger, interceptLogs: interceptLogs, events: this.events, config: this, context: this.context, env: this.env});
this.plugins.loadPlugins();
this.loadEmbarkConfigFile();
this.loadBlockchainConfigFile();
this.loadStorageConfigFile();
this.loadCommunicationConfigFile();
@ -329,6 +329,17 @@ Config.prototype.loadWebServerConfigFile = function() {
};
Config.prototype.loadEmbarkConfigFile = function() {
var configObject = {
options: {
solc: {
"optimize": true,
"optimize-runs": 200
}
}
};
this.embarkConfig = this._mergeConfig(this.embarkConfig, configObject, true);
const contracts = this.embarkConfig.contracts;
const newContractsFiles = this.loadFiles(contracts);
if (!this.contractFiles || newContractsFiles.length !== this.contractFiles.length || !deepEqual(newContractsFiles, this.contractFiles)) {
@ -348,6 +359,8 @@ Config.prototype.loadEmbarkConfigFile = function() {
this.buildDir = this.embarkConfig.buildDir;
this.configDir = this.embarkConfig.config;
};
Config.prototype.loadPipelineConfigFile = function() {

View File

@ -11,6 +11,7 @@ class Solidity {
this.solcAlreadyLoaded = false;
this.solcW = null;
this.useDashboard = options.useDashboard;
this.options = embark.config.embarkConfig.options.solc;
embark.registerCompiler(".sol", this.compile_solidity.bind(this));
}
@ -65,8 +66,8 @@ class Solidity {
sources: input,
settings: {
optimizer: {
enabled: true,
runs: 200
enabled: self.options.optimize,
runs: self.options["optimize-runs"]
},
outputSelection: {
'*': {

View File

@ -21,5 +21,11 @@
},
"plugins": {
"embark-service": {}
},
"options": {
"solc": {
"optimize": true,
"optimize-runs": 200
}
}
}