diff --git a/README.md b/README.md index 8cd9cd00..a3afabc0 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ for (var contractName in output.contracts) { #### From version 0.1.6 +**Not available since 0.5.0** + Starting from version 0.1.6, multiple files are supported with automatic import resolution by the compiler as follows: ```javascript @@ -66,6 +68,8 @@ Note that all input files that are imported have to be supplied, the compiler wi #### From version 0.2.1 +**Not available since 0.5.0** + Starting from version 0.2.1, a callback is supported to resolve missing imports as follows: ```javascript @@ -107,6 +111,10 @@ Starting from version 0.4.20 a Semver compatible version number can be retrieved #### From version 0.5.0 +Starting from version 0.5.0, `compile`, `compileStandard` and `compileStandardWrapper` all do the same thing - what `compileStandardWrapper` used to do. + +*Note*: with 0.5.1, `compileStandard` and `compileStandardWrapper` will be removed. + Starting from version 0.5.0 the low-level functions are also exposed: - `solc.lowlevel.compileSingle`: the original entry point, supports only a single file - `solc.lowlevel.compileMulti`: this supports multiple files, introduced in 0.1.6 diff --git a/test/package.js b/test/package.js index ed250097..d43fbcc5 100644 --- a/test/package.js +++ b/test/package.js @@ -386,7 +386,7 @@ tape('Compilation', function (t) { } }; - var output = JSON.parse(solc.compileStandardWrapper(JSON.stringify(input))); + var output = JSON.parse(solc.compile(JSON.stringify(input))); var x = getBytecodeStandard(output, 'cont.sol', 'x'); st.ok(x); st.ok(x.length > 0); @@ -428,7 +428,7 @@ tape('Compilation', function (t) { } }; - var output = JSON.parse(solc.compileStandardWrapper(JSON.stringify(input))); + var output = JSON.parse(solc.compile(JSON.stringify(input))); var x = getBytecodeStandard(output, 'cont.sol', 'x'); st.ok(x); st.ok(x.length > 0); @@ -508,10 +508,18 @@ tape('Loading Legacy Versions', function (t) { } } }; - var output = JSON.parse(solcSnapshot.compileStandardWrapper(JSON.stringify(input))); + var output = JSON.parse(solcSnapshot.compile(JSON.stringify(input))); var x = getBytecodeStandard(output, 'cont.sol', 'x'); st.ok(x); st.ok(x.length > 0); }); }); }); + +tape('API backwards compatibility', function (t) { + t.test('compileStandard and compileStandardWrapper exists', function (st) { + st.equal(solc.compile, solc.compileStandard); + st.equal(solc.compile, solc.compileStandardWrapper); + st.end(); + }); +}); diff --git a/wrapper.js b/wrapper.js index c38cf09b..4d050535 100644 --- a/wrapper.js +++ b/wrapper.js @@ -79,20 +79,6 @@ function setupMethods (soljson) { }; } - var compile = function (input, optimise, readCallback) { - var result = ''; - if (readCallback !== undefined && compileJSONCallback !== null) { - result = compileJSONCallback(JSON.stringify(input), optimise, readCallback); - } else if (typeof input !== 'string' && compileJSONMulti !== null) { - result = compileJSONMulti(JSON.stringify(input), optimise); - } else if (compileJSON !== null) { - result = compileJSON(input, optimise); - } else { - return { errors: 'No suitable compiler interface found.' }; - } - return JSON.parse(result); - }; - // Expects a Standard JSON I/O but supports old compilers var compileStandardWrapper = function (input, readCallback) { if (compileStandard !== null) { @@ -237,13 +223,11 @@ function setupMethods (soljson) { importCallback: compileJSONCallback !== null || compileStandard !== null, nativeStandardJSON: compileStandard !== null }, - compile: compile, - compileStandard: compileStandard, + compile: compileStandardWrapper, + // Temporary wrappers to minimise breaking with other projects. + // NOTE: to be removed in 0.5.1 + compileStandard: compileStandardWrapper, compileStandardWrapper: compileStandardWrapper, - supportsSingle: compileJSON !== null, - supportsMulti: compileJSONMulti !== null, - supportsImportCallback: compileJSONCallback !== null, - supportsStandard: compileStandard !== null, // Loads the compiler of the given version from the github repository // instead of from the local filesystem. loadRemoteVersion: function (versionString, cb) {