aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-compiler/src/compiler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sol-compiler/src/compiler.ts')
-rw-r--r--packages/sol-compiler/src/compiler.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index 67021d445..afa4cc5bb 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -21,7 +21,6 @@ import * as semver from 'semver';
import solc = require('solc');
import { compilerOptionsSchema } from './schemas/compiler_options_schema';
-import { binPaths } from './solc/bin_paths';
import {
addHexPrefixToContractBytecode,
compileDockerAsync,
@@ -29,6 +28,7 @@ import {
createDirIfDoesNotExistAsync,
getContractArtifactIfExistsAsync,
getDependencyNameToPackagePath,
+ getSolcJSReleasesAsync,
getSourcesWithDependencies,
getSourceTreeHash,
makeContractPathsRelative,
@@ -96,12 +96,12 @@ export class Compiler {
* @return An instance of the Compiler class.
*/
constructor(opts?: CompilerOptions) {
- assert.doesConformToSchema('opts', opts, compilerOptionsSchema);
+ const passedOpts = opts || {};
+ assert.doesConformToSchema('opts', passedOpts, compilerOptionsSchema);
// TODO: Look for config file in parent directories if not found in current directory
const config: CompilerOptions = fs.existsSync(CONFIG_FILE)
? JSON.parse(fs.readFileSync(CONFIG_FILE).toString())
: {};
- const passedOpts = opts || {};
assert.doesConformToSchema('compiler.json', config, compilerOptionsSchema);
this._contractsDir = path.resolve(passedOpts.contractsDir || config.contractsDir || DEFAULT_CONTRACTS_DIR);
this._solcVersionIfExists = passedOpts.solcVersion || config.solcVersion;
@@ -211,6 +211,7 @@ export class Compiler {
// map contract paths to data about them for later verification and persistence
const contractPathToData: ContractPathToData = {};
+ const solcJSReleases = await getSolcJSReleasesAsync();
const resolvedContractSources = [];
for (const contractName of contractNames) {
const spyResolver = new SpyResolver(this._resolver);
@@ -226,7 +227,7 @@ export class Compiler {
}
contractPathToData[contractSource.path] = contractData;
const solcVersion = _.isUndefined(this._solcVersionIfExists)
- ? semver.maxSatisfying(_.keys(binPaths), parseSolidityVersionRange(contractSource.source))
+ ? semver.maxSatisfying(_.keys(solcJSReleases), parseSolidityVersionRange(contractSource.source))
: this._solcVersionIfExists;
const isFirstContractWithThisVersion = _.isUndefined(versionToInputs[solcVersion]);
if (isFirstContractWithThisVersion) {
@@ -272,7 +273,7 @@ export class Compiler {
fullSolcVersion = versionCommandOutputParts[versionCommandOutputParts.length - 1].trim();
compilerOutput = await compileDockerAsync(solcVersion, input.standardInput);
} else {
- fullSolcVersion = binPaths[solcVersion];
+ fullSolcVersion = solcJSReleases[solcVersion];
compilerOutput = await compileSolcJSAsync(solcVersion, input.standardInput);
}
if (!_.isUndefined(compilerOutput.errors)) {