Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

add no-compile flag #2661

Closed
okwme opened this issue Dec 9, 2019 · 13 comments
Closed

add no-compile flag #2661

okwme opened this issue Dec 9, 2019 · 13 comments

Comments

@okwme
Copy link

okwme commented Dec 9, 2019

Issue

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: #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.

@robertmagier
Copy link
Contributor

robertmagier commented Dec 23, 2019

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-all to be true. How should it work when user sets --compile-all and --no-compile together.

Maybe we should call this flag --compile-none because 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.

@okwme
Copy link
Author

okwme commented Dec 23, 2019 via email

@robertmagier
Copy link
Contributor

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.

@robertmagier
Copy link
Contributor

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:

  1. if some contract is missing from the build folder then I will log an error message.
  2. if we have --compile-all and -no-compile together then I will also throw an error message.

I still think we should call it --compile-none instead --no-compile. I guess it doesn't matter much.

@robertmagier
Copy link
Contributor

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.

@robertmagier
Copy link
Contributor

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.

robertmagier added a commit to robertmagier/truffle that referenced this issue Dec 26, 2019
@okwme
Copy link
Author

okwme commented Jan 2, 2020

Excited to see this @robertmagier !!!
--compile-none make sense in the context of --compile-all.
Tests should be able to skip compilation too.

@okwme okwme closed this as completed Jan 2, 2020
@okwme okwme reopened this Jan 2, 2020
@robertmagier
Copy link
Contributor

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.

@Ankarrr
Copy link

Ankarrr commented Jul 11, 2020

@robertmagier Sounds great. Is --compile-none released?

@pakuula
Copy link

pakuula commented Dec 11, 2020

Thank you VERY much, @robertmagier

Could you update the docs as well?

@haltman-at
Copy link
Contributor

Is there still an issue here? Am I mistaken in saying that --compile-none is now implemented?

@luksch42
Copy link

@haltman-at --compile-none is implemented.

@haltman-at
Copy link
Contributor

OK I'm just going to go ahead and close this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants