extract method _getContractNamesToCompile()
This commit is contained in:
@@ -159,16 +159,17 @@ export class Compiler {
|
|||||||
public async compileAsync(): Promise<void> {
|
public async compileAsync(): Promise<void> {
|
||||||
await createDirIfDoesNotExistAsync(this._artifactsDir);
|
await createDirIfDoesNotExistAsync(this._artifactsDir);
|
||||||
await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
|
await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
|
||||||
let contractNamesToCompile: string[] = [];
|
await this._compileContractsAsync(this._getContractNamesToCompile());
|
||||||
|
}
|
||||||
|
private _getContractNamesToCompile(): string[] {
|
||||||
if (this._specifiedContracts === ALL_CONTRACTS_IDENTIFIER) {
|
if (this._specifiedContracts === ALL_CONTRACTS_IDENTIFIER) {
|
||||||
const allContracts = this._nameResolver.getAll();
|
const allContracts = this._nameResolver.getAll();
|
||||||
contractNamesToCompile = _.map(allContracts, contractSource =>
|
return _.map(allContracts, contractSource =>
|
||||||
path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION),
|
path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
contractNamesToCompile = this._specifiedContracts;
|
return this._specifiedContracts;
|
||||||
}
|
}
|
||||||
await this._compileContractsAsync(contractNamesToCompile);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Compiles contract and saves artifact to artifactsDir.
|
* Compiles contract and saves artifact to artifactsDir.
|
||||||
|
|||||||
Reference in New Issue
Block a user