Adds a CompilerProvider class that can be configured to fetch an arbitrary solc version from the solc-bin remote. Defaults to truffle's installed solc. Versions fetched from the remote are cached and only need to be retrieved once. Unit tests running locally suggest download times are in the 3-5 second range over a typical wifi connection.
Idea for Part II of BYOC is to extend CompilerProvider to allow use of a natively compiled solc by setting the solc key to "native".
CompilerProvider API
const provider = new CompilerProvider(options.compiler);
const solc = await provider.load();
const nativeSolc = await provider.load(options.solc);
// Get a collection of usable release keys,
// for something like `truffle compile --list`
const releases = await provider.getReleases();
PR includes logic to require solc-js from an arbitrary location on the local filesystem (use case is support for npm install -g solc) but unfortunately webpack mangles any require statement which relies on variables that resolve at run-time. This feature could probably be removed at no great loss, although there are other options.
PR also includes tests for the new code and misc fixes for the existing test suite.
Moved .sol files to a sources folder
Skipping two tests for Parser.parse. We stopped supporting that method along with Profiled.get_defined_contracts in truffle-core 123. These should be removed in a separate PR.
Part I of "Bring your own compiler"
Adds a
CompilerProvider
class that can be configured to fetch an arbitrary solc version from the solc-bin remote. Defaults to truffle's installed solc. Versions fetched from the remote are cached and only need to be retrieved once. Unit tests running locally suggest download times are in the 3-5 second range over a typical wifi connection.User API:
Idea for Part II of BYOC is to extend CompilerProvider to allow use of a natively compiled solc by setting the
solc
key to "native".CompilerProvider API
PR includes logic to require solc-js from an arbitrary location on the local filesystem (use case is support for
npm install -g solc
) but unfortunately webpack mangles anyrequire
statement which relies on variables that resolve at run-time. This feature could probably be removed at no great loss, although there are other options.PR also includes tests for the new code and misc fixes for the existing test suite.
.sol
files to asources
folderParser.parse
. We stopped supporting that method along withProfiled.get_defined_contracts
in truffle-core 123. These should be removed in a separate PR.