Skip to content

Show spinner during compilation #7048

@kanej

Description

@kanej

hardhat test solidity seems to hang because we don’t have a spinner or something during compilation.

We should also update in place the text: Nothing to compile, to avoid adding lots of extra lines.

  • The spinner should appear when contracts and tests are compiling.

  • The spinner should be at the beginning of a new line at the end of the CLI output and then be replaced by the result once compilation is done.

  • Any errors or warnings push the spinner to a new line after the message

  • The spinner implementation must not add a new dependency and must be in hardhat-utils to be available to other projects

  • Original state

    root@5a079a243a54:~/hardhat_test# pnpm hardhat compile
    Compiling your Solidity contracts...
    

    That turns into the following when the compilation completes.

    root@5a079a243a54:~/hardhat_test# pnpm hardhat compile
    Compiling your Solidity contracts...
    Compiled 4 Solidity files with solc 0.8.28 (evm target: cancun)
  • Spinner output

    root@5a079a243a54:~/hardhat_test# pnpm hardhat compile
    Compiling your Solidity contracts...
    ⠋

    any errors move the spinner
    With the spinner

    root@5a079a243a54:~/hardhat_test# pnpm hardhat compile
    Compiling your Solidity contracts...
    Warning: Contract code size is 34623 bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries.
      --> ../../node_modules/.pnpm/@uniswap+v4-core@1.0.2/node_modules/@uniswap/v4-core/src/PoolManager.sol:80:1:
       |
    80 | contract PoolManager is IPoolManager, ProtocolFees, NoDelegateCall, ERC6909Claims, Extsload, Exttload {
       | ^ (Relevant source part starts here and spans across multiple lines).
    ⠋

    the final message replaces the spinner once complete

    root@5a079a243a54:~/hardhat_test# pnpm hardhat compile
    Compiling your Solidity contracts...
    Warning: Contract code size is 34623 bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries.
      --> ../../node_modules/.pnpm/@uniswap+v4-core@1.0.2/node_modules/@uniswap/v4-core/src/PoolManager.sol:80:1:
       |
    80 | contract PoolManager is IPoolManager, ProtocolFees, NoDelegateCall, ERC6909Claims, Extsload, Exttload {
       | ^ (Relevant source part starts here and spans across multiple lines).
    Compiled 4 Solidity files with solc 0.8.28 (evm target: cancun)

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

To-do

Relationships

None yet

Development

No branches or pull requests

Issue actions