Fix race condition
This commit is contained in:
		@@ -9,10 +9,10 @@
 | 
			
		||||
    },
 | 
			
		||||
    "scripts": {
 | 
			
		||||
        "build:watch": "tsc -w",
 | 
			
		||||
        "prebuild": "run-s clean copy_artifacts generate_contract_wrappers",
 | 
			
		||||
        "prebuild": "run-s clean compile copy_artifacts generate_contract_wrappers",
 | 
			
		||||
        "copy_artifacts": "copyfiles './src/artifacts/**/*' ./lib",
 | 
			
		||||
        "build": "tsc",
 | 
			
		||||
        "test": "run-s compile build run_mocha",
 | 
			
		||||
        "test": "run-s build run_mocha",
 | 
			
		||||
        "run_mocha": "mocha 'lib/test/**/*.js' --timeout 10000 --bail --exit",
 | 
			
		||||
        "compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846",
 | 
			
		||||
        "compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir src/artifacts",
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
## v0.2.0 - _??_
 | 
			
		||||
 | 
			
		||||
    * Check dependencies when determining if contracts should be recompiled.
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
## v0.1.0 - _February 16, 2018_
 | 
			
		||||
 | 
			
		||||
    * Add the ability to pass in specific contracts to compile in CLI (#400)
 | 
			
		||||
 
 | 
			
		||||
@@ -168,7 +168,6 @@ export class Compiler {
 | 
			
		||||
            : Array.from(this._specifiedContracts.values());
 | 
			
		||||
        await Promise.all(_.map(fileNames, async fileName => this._setCompileActionAsync(fileName)));
 | 
			
		||||
        await Promise.all(_.map(fileNames, async fileName => this._compileContractAsync(fileName)));
 | 
			
		||||
 | 
			
		||||
        this._solcErrors.forEach(errMsg => {
 | 
			
		||||
            utils.consoleLog(errMsg);
 | 
			
		||||
        });
 | 
			
		||||
@@ -185,10 +184,6 @@ export class Compiler {
 | 
			
		||||
        if (!contractSpecificSourceData.shouldCompile) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        const source = this._contractSourcesIfExists[fileName];
 | 
			
		||||
        const input = {
 | 
			
		||||
            [fileName]: source,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        const fullSolcVersion = binPaths[contractSpecificSourceData.solc_version];
 | 
			
		||||
        const solcBinPath = `./solc/solc_bin/${fullSolcVersion}`;
 | 
			
		||||
@@ -196,6 +191,10 @@ export class Compiler {
 | 
			
		||||
        const solcInstance = solc.setupMethods(solcBin);
 | 
			
		||||
 | 
			
		||||
        utils.consoleLog(`Compiling ${fileName}...`);
 | 
			
		||||
        const source = this._contractSourcesIfExists[fileName];
 | 
			
		||||
        const input = {
 | 
			
		||||
            [fileName]: source,
 | 
			
		||||
        };
 | 
			
		||||
        const sourcesToCompile = {
 | 
			
		||||
            sources: input,
 | 
			
		||||
        };
 | 
			
		||||
@@ -271,10 +270,14 @@ export class Compiler {
 | 
			
		||||
                    contractNetworkData.solc_version !== contractSpecificSourceData.solc_version;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        _.forEach(contractSpecificSourceData.dependencies, async dependency => {
 | 
			
		||||
            await this._setCompileActionAsync(dependency);
 | 
			
		||||
        await Promise.all(
 | 
			
		||||
            _.map(contractSpecificSourceData.dependencies, async dependency => this._setCompileActionAsync(dependency)),
 | 
			
		||||
        );
 | 
			
		||||
        _.forEach(contractSpecificSourceData.dependencies, dependency => {
 | 
			
		||||
            contractSpecificSourceData.shouldCompile =
 | 
			
		||||
                contractSpecificSourceData.shouldCompile || this._contractSourceData[dependency].shouldCompile;
 | 
			
		||||
                contractSpecificSourceData.shouldCompile ||
 | 
			
		||||
                (this._contractSourceData[dependency].shouldCompile &&
 | 
			
		||||
                    (this._specifiedContracts.has('*') || this._specifiedContracts.has(dependency)));
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user