What happens if you edit the file at compile time?

Sometimes compilation takes a lot of time, and I want to communicate with the file at compile time. Will saving a new file at compile time affect the build? Or is everything preloaded?

+4
source share
2 answers

I'm not sure this is an important question: "In this case, all compilers and languages?"

It is more important to ask: for a given build system, can I edit the source during build?

With the ant construct, it is clear that ant decides to compile early (based on the file’s timestamps), but you don’t know exactly when the compilation task starts.

Of course, it is true that the compiler reads the source file only once, but usually you do not know when this will happen.

An interesting use case:

When I run sbt> ~ test , will the test run finish while editing the code, or will it stop recompiling the middle of the stream?

I could see that it is useful to have a command parameter to determine if editing cancels the test run. You might want to see the test result, or maybe you are interested in the test results after modification.

This is especially true if the compilation and testing cycles seem endless.

Here is a document for testing. doc to start execution says:

Monitoring stops when the button is pressed.

which can be interpreted as meaning that monitoring does not stop during the execution of a task.

+2
source

I tried this myself and I see that everything is preloaded. You can add and edit what you get.

+4
source

Source: https://habr.com/ru/post/1491934/


All Articles