Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I prevent XE8 from adding System.ImageList?

A Form in XE8 gets automatically the uses System.ImageList added. Like on the embarcadero site is said:

System.ImageList contains the common for both FireMonkey and VCL code implementing the most basic device-independent features of image lists. System.ImageList contains the code supporting interaction between images in an image list and using them components (like controls, menu items, and so on).

But my colleagues are mostly still using XE7. Now, they need to remove that uses constantly after my commit. My XE8 automatically adds this uses when I would remove it. I could remove the uses before I commit with another editor of course. But it would be more productive when I could prevent XE8 from adding this part of code. Or would Firemonkey and VCL stop working properly?

So my question is: Can I prevent XE8 from adding System.ImageList to my uses in a Form?

like image 853
davepaul12 Avatar asked Jul 10 '15 06:07

davepaul12


1 Answers

Can I prevent XE8 from adding System.ImageList to my uses in a Form?

No. The IDE will do this come what may. Your options include:

  • Wrapping the unit in a conditional so that the XE7 compiler does not see it.
  • Create a dummy, empty unit, named System.ImageList, that you list in the .dpr file, again wrapped in a conditional so that it is only seen by the XE7 compiler.
  • Maintain separate .dproj files for the different versions. In the XE7 version add a unit alias that maps System.ImageList to System.
  • Removing the unit before committing using a text editor or a script.
  • Having your team standardise on a common version of Delphi.

Personally I would recommend the latter option. Remember that you can happily install multiple Delphi versions side-by-side and, if necessary, use different versions for different projects. This is essential when maintaining release branches of your program.

If you simply cannot do this then the unit alias is perhaps the least invasive option. I guess you don't have the .dproj file under revision control because if you did then you'd be facing similar issues with XE7 modifying the XE8 version and vice versa. So if the .dproj file is outside revision control it should be easy enough to make the modifications locally just for the XE7 users. But a trick like that should only ever be viewed as a temporary stepping stone to keep you afloat until you are all on the same version of Delphi.

More generally, Embarcadero are currently releasing new versions very frequently. It costs time to upgrade. You have to install, iron out any compilation problems, test the build under the compiler, and deal with any defects that arise. You don't have to take every upgrade. It's fine to skip some. It can be more efficient to do so. At my workplace we moved from XE3 to XE7 and are not going to take XE8. If you do take an upgrade, make sure the benefits outweigh the costs.

like image 154
David Heffernan Avatar answered Sep 29 '22 12:09

David Heffernan