OpenZeppelin / solidity-docgen

Documentation generator for Solidity projects
MIT License
451 stars 118 forks source link

Support use with multiple compilers #338

Open PaulRBerg opened 3 years ago

PaulRBerg commented 3 years ago

When running solidity-docgen in a project that uses multiple Solidity compilers, I am getting this error:

Error: Solidity was unable to compile. ParserError: Source file requires different compiler version (current compiler is
    0.8.9+commit.e5eed63a.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version
     --> contracts/uniswap-v2/UniswapV2Pair.sol:3:1:
      |
    3 | pragma solidity =0.5.16;
      | ^^^^^^^^^^^^^^^^^^^^^^^^

How could I use this tool with multiple Solidity compilers?

Side note: it might be worth it to enable discussions in this GitHub repository.

frangio commented 3 years ago

Thanks for the suggestion, I've enabled discussions.

Currently you would only be able to run in this context by keeping those contracts in separate directories, and including the option when running -i contracts/subdir.

PaulRBerg commented 3 years ago

Thanks for the suggestion, I've enabled discussions.

Nice. You can also convert this issue to a discussion - there's a button on the right-hand side of the screen.

Currently you would only be able to run in this context by keeping those contracts in separate directories, and including the option when running -i contracts/subdir.

Argh, yeah I'll have to refactor my code. Thanks anyway!

frangio commented 3 years ago

Argh, yeah I'll have to refactor my code.

Sorry about that!

Keeping this open as an issue because I recognize it's a legitimate problem we should solve, and it's going to happen more and more as projects mature.

Eventually the solution is I think to turn this into a Hardhat plugin where compilation is done by Hardhat which already supports multiple versions. We lose some generality by tying to Hardhat but we could add a fallback to something like what the tool does today.

galekseev commented 2 years ago

We've got the same problem. Hardhat plugin will do great for us.

frangio commented 2 years ago

Hardhat plugin is being worked on, see #350.