RyuuGan / sol-merger

Merges all imports into single file for solidity contracts
BSD 2-Clause "Simplified" License
157 stars 22 forks source link

Error! Multiple SPDX license identifiers found #37

Closed naszam closed 4 years ago

naszam commented 4 years ago

Hi,

Trying to verify a contract on Etherscan via sol-merger, I run into this compiler warning:

myc: ParserError: Multiple SPDX license identifiers found in source file. Use "AND" or "OR" to combine multiple licenses. Please see https://spdx.org for more information.

Using: npm v13.13.0 sol-merger v3.0.1

RyuuGan commented 4 years ago

Hello @naszam,

It is hard to say what is the problem. I need a reproduction for this.

Maybe it is because comments are enabled on root level of contracts.

Best regards, Valerii Aligorskii.

naszam commented 4 years ago

Hi @RyuuGan,

I guess is due to the repetition of the SPDX comment introduced in solc v0.6.8, cause the contract is inheriting another contract with the same SPDX. See issue #8989 They compile on truffle but when I try to compile on Remix or Truffle the merged file I got the error. Is there a way to fix this? Thanks!

Kind regards, Nazzareno Massari

naszam commented 4 years ago

Found it! A way to fix this issue is to remove one SPDX comment from the merged file so it doesn't throw an error when compiling.

RyuuGan commented 4 years ago

Hello @naszam,

To solve this problem I can introduce the previous behaviour, that comments from the root of the file (comments outside the structs, contracts and other exports) will not be added to.

Because this feature with comments have been asked for a long time and it was implemented in the latest release. So now I can make an options in sol-merger cli and API like removeRootComments or something like this (not sure about the name yet). So you will not require to remove them manually.

sol-merger --removeRootComments contracts/*.sol

Best regards, Valerii Aligorskii

naszam commented 4 years ago

Hi @RyuuGan,

Yep! That would be great. For the name I would reccomend something like -spdx or -removeSPDX. Thanks!

Kind regards, Nazzareno Massari

RyuuGan commented 4 years ago

Hello @naszam,

The feature should be available at version 3.1.0.

Best regards, Valerii Aligorskii