mirror of https://github.com/embarklabs/embark.git
fix contract directories config
This commit is contained in:
parent
68886d7095
commit
1666be1158
|
@ -7,6 +7,7 @@ class Compiler {
|
|||
this.plugins = options.plugins;
|
||||
this.logger = options.logger;
|
||||
this.solcVersion = options.solcVersion;
|
||||
this.contractDirectories = options.contractDirectories;
|
||||
}
|
||||
|
||||
compile_contracts(contractFiles, cb) {
|
||||
|
@ -56,7 +57,12 @@ class Compiler {
|
|||
function prepareInput(callback) {
|
||||
async.each(contractFiles,
|
||||
function(file, fileCb) {
|
||||
let filename = file.filename.replace('app/contracts/', '');
|
||||
let filename = file.filename;
|
||||
|
||||
for (let directory of self.contractDirectories) {
|
||||
filename = filename.replace(directory, '');
|
||||
}
|
||||
|
||||
file.content(function(fileContent) {
|
||||
input[filename] = fileContent;
|
||||
fileCb();
|
||||
|
|
|
@ -8,6 +8,7 @@ let Compiler = require('./compiler.js');
|
|||
class ContractsManager {
|
||||
constructor(options) {
|
||||
this.contractFiles = options.contractFiles;
|
||||
this.contractDirectories = options.contractDirectories;
|
||||
this.contractsConfig = options.contractsConfig;
|
||||
this.contracts = {};
|
||||
this.logger = options.logger;
|
||||
|
@ -25,7 +26,7 @@ class ContractsManager {
|
|||
let self = this;
|
||||
async.waterfall([
|
||||
function compileContracts(callback) {
|
||||
let compiler = new Compiler({plugins: self.plugins, logger: self.logger, solcVersion: self.solcVersion});
|
||||
let compiler = new Compiler({plugins: self.plugins, logger: self.logger, solcVersion: self.solcVersion, contractDirectories: self.contractDirectories});
|
||||
compiler.compile_contracts(self.contractFiles, function (err, compiledObject) {
|
||||
self.compiledContracts = compiledObject;
|
||||
callback(err);
|
||||
|
|
|
@ -26,6 +26,7 @@ class DeployManager {
|
|||
function buildContracts(callback) {
|
||||
let contractsManager = new ContractsManager({
|
||||
contractFiles: self.config.contractsFiles,
|
||||
contractDirectories: self.config.contractDirectories,
|
||||
contractsConfig: self.config.contractsConfig,
|
||||
logger: self.logger,
|
||||
plugins: self.plugins
|
||||
|
|
|
@ -198,6 +198,12 @@ Config.prototype.loadWebServerConfigFile = function() {
|
|||
Config.prototype.loadEmbarkConfigFile = function() {
|
||||
var contracts = this.embarkConfig.contracts;
|
||||
this.contractsFiles = this.loadFiles(contracts);
|
||||
// determine contract 'root' directories
|
||||
this.contractDirectories = contracts.map((dir) => {
|
||||
return dir.split("**")[0];
|
||||
}).map((dir) => {
|
||||
return dir.split("*.")[0];
|
||||
});
|
||||
|
||||
this.buildDir = this.embarkConfig.buildDir;
|
||||
this.configDir = this.embarkConfig.config;
|
||||
|
|
Loading…
Reference in New Issue