Forum > General

[SOLVED] Recompiling Units because of Generic/ Include/ Inline changes

(1/2) > >>

Okoba:
Hello,

I have multiple generic types, and they are used in many units.
The problem is, if I change my generic type (Like TGenericList), I need to force recompile all dependant units, so all packages and open project need to be explicitly cleaned and recompiled.
This issue is similar to include files, and changing inline functions too, other dependant units to those include files or inline functions need to be recompiled.

This problem beside the time wasting, made me fall into many pseudo bugs, that I think something is wrong, but there is only a need to clean and recompile all units.

Is there a way to prevent this?

Thaddy:
You can compile units that you don't want to be changed with -Ur. such units are never automatically recompiled. But the compiler may complain if it really needs such units to be compiled again. That is only the case if you are sure that there is no dependency on your modified code at all.
But all packages and units that are really not dependent on your altered code can be compiled with -Ur. -Ur stands for release build. E.g. the rtl is by default compiled like that.
In fact, after debugging, this is a good idea for any package.

You could also try -B-, which turns full rebuild off for your project. The latter is only necessary if -B is specified either on the command line or in Lazarus compiler settings. Then again, you also specified -Sew, maybe without knowing, so that may be likely be the case. But even if -B is specified, code that is compiled with -Ur will not be part of the rebuild.

Okoba:
Thaddy, I think you misread my post. I want Lazarus to recompile all dependant units, not prevent it. For now, Lazarus does not recompile units if the generic unit changes, so they still use an old generic.

Thaddy:

--- Quote from: Okoba on January 07, 2023, 12:15:55 pm ---Thaddy, I think you misread my post. I want Lazarus to recompile all dependant units, not prevent it. For now, Lazarus does not recompile units if the generic unit changes, so they still use an old generic.

--- End quote ---
Then make sure -B is specified and the affected units and packages are NOT marked as release build, so -Ur-. So the reverse from my first answer. :D
I interpreted your question that those units / packages should NOT be rebuild, in that case there is no possibility to skip rebuilding, since now you tell me they ARE dependent on the changed code....
And that is absolutely not clear in your question.
You could have found that out yourself. Well, you did, but found it cumbersome?
Stick to the rules.... O:-) 8-) If code is dependent on your changes, that code MUST be rebuild.

Okoba:
-B works! Thanks.
But what -B means? In Lazarus it says "Build all modules", but what does it mean? Will it build dependant units of what changed? all packages?

Navigation

[0] Message Index

[#] Next page

Go to full version