It would be nice to have a --no-compile flag that skips compilation on commands that otherwise include it by default. This would also solve the issue here: https://github.com/trufflesuite/truffle/issues/469.
This is a command I needed and had to switch to buidler to use because I have some contracts which for legacy purposes must remain tied to solc4 and some contracts which should use solc5. In order to compile them I need to set a different config file for each compilation. Then when it comes to migrating or testing them, I want to prevent them from being compiled with the wrong compiler, so i include the --no-compile option.
I would like to work on this issue.
How exactly this flag should work ?
There is also --compile-all flag already which will force truffle to compile all contracts. And there is also --debugflag which will set --compile-allto be true. How should it work when user sets --compile-all and --no-compile together.
Maybe we should call this flag --compile-nonebecause setting--no-compile works as equivalent of setting --compile flag to false. If I understand it correctly.
Also, if user sets --no-compile flag should we also avoid compiling when ./build folder is empty (or missing some contracts) ?
In this case tests will fail since there are no compiled contracts to use.
--compile-all has always confused me, it seems like it's always on. Does
truffle skip compiling a contract that it sees is already compiled? does it
have a timestamp or a hash on the un-compiled code to see if there are
changes?
wrt no-compile and an empty build folder i think throwing an error is
appropriate and not a problem
On Sun, Dec 22, 2019 at 8:01 PM robertmagier notifications@github.com
wrote:
I would like to work on this issue.
How exactly this flag should work ?
There is also --compile-all flag already which will force truffle to
compile all contracts. And there is also --debug flag which will set
--compile-true to be true. How should it work when user sets --compile-all
and --no-compile together.Also, if user sets --no-compile flag should we also avoiding compiling
when ./build folder is empty (or missing some contracts) ?
In this case tests will fail since there are no compiled contracts to use.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/truffle/issues/2661?email_source=notifications&email_token=AAHLLVCZ37MP2YA6SXPUIC3Q2AEVVA5CNFSM4JYQM4F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHP57HQ#issuecomment-568319902,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAHLLVHCXZF4VKXXPJUMQUDQ2AEVVANCNFSM4JYQM4FQ
.
--
billyrennekamp.com
I used to get this error while working on windows. I don't get this working on Linux. It might be related to test resolver and timestamps as you say. @okwme do you have a project I can use to reproduce this error ? What is the environment you are working on ?
We will have to throw an error every time we are missing even one of contracts in build folder.
Ok. And I see also you have an issue with two different compiler versions. So basically we simply have to use -no-compile flag to make it work properly.
So I think I will implement like this:
I still think we should call it --compile-none instead --no-compile. I guess it doesn't matter much.
What about test written in solidity ? If flag --compile-none is true should I compile those tests ?
Or should I skip running solidity tests ?
If I compile solidity test then it means I will have to also compile all contracts those tests test. Which means I can get to the same problem I was trying to avoid at the first place - trying to compile files using two different compiler versions.
I also don't think I don't have to do anything to throw an error about missing artifact. It is already implemented in truffle.
Truffle will throw an error message:
Error: Could not find artifacts for LostArtifactName from any sources
and exit. This should be clear enough to either remove flag --compile-none or run build command to build missing artifact.
Excited to see this @robertmagier !!!
--compile-none make sense in the context of --compile-all.
Tests should be able to skip compilation too.
Test will skip compilation. The way I implemented this is that we are not going to compile tests. Because if we do it then we will also have to compile all dependencies. The option would be to use --compile-none flag and add another feature to choose which test you want to compile. I have also implemented another feature to choose which files to compile in truffle compile command so it will be easier to implement it. If this is really required.
@robertmagier Sounds great. Is --compile-none released?
Thank you VERY much, @robertmagier
Could you update the docs as well?
Most helpful comment
Test will skip compilation. The way I implemented this is that we are not going to compile tests. Because if we do it then we will also have to compile all dependencies. The option would be to use --compile-none flag and add another feature to choose which test you want to compile. I have also implemented another feature to choose which files to compile in truffle compile command so it will be easier to implement it. If this is really required.