foundry
foundry copied to clipboard
Bug: Forge flatten does handle multiple differing SPDX licenses
Component
Forge
Have you ensured that all of these are up to date?
- [X] Foundry
- [X] Foundryup
What version of Foundry are you on?
forge 0.2.0 (3c49efe 2022-07-14T00:05:10.018576Z)
What command(s) is the bug in?
forge build
Operating System
macOS (Intel)
Describe the bug
I run
root:~ $ forge flatten src/3.sol > src/4.sol
contracts, 1, 2, 3, get flattened into 4.sol
Then when I run build I get this:
root:~ $ forge build
[⠊] Compiling...
[⠒] Compiling 17 files with 0.8.15
[⠢] Solc 0.8.15 finished in 63.73ms
Error:
Compiler run failed
error[3716]: 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.
Also I get this error message three times?
warning: Implied profile [default] found in foundry.toml. This notation has been deprecated and may result in the profile not being registered in future versions. Please use [profile.default] instead.
warning: Implied profile [default] found in foundry.toml. This notation has been deprecated and may result in the profile not being registered in future versions. Please use [profile.default] instead.
warning: Implied profile [default] found in foundry.toml. This notation has been deprecated and may result in the profile not being registered in future versions. Please use [profile.default] instead.
@rkrasiuk this looks like an issue with how we track different licenses, can't remember how flatten behaves when that happens
@mattsse they should be stripped, ~~but now that I've taken another look, the condition should be inverse here https://github.com/gakonst/ethers-rs/blob/master/ethers-solc/src/config.rs#L346~~
@mattsse one thing that comes to mind is that our rule for detecting the license identifier is quite strict. we require it to be on the first line of any file. perhaps it's not the case in one of your source files @sambacha?
@mattsse one thing that comes to mind is that our rule for detecting the license identifier is quite strict. we require it to be on the first line of any file. perhaps it's not the case in one of your source files @sambacha?
For flattened files i think this rule is wrong