root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.63k stars 1.26k forks source link

Improve header file encapsulation #16327

Open vgvassilev opened 2 weeks ago

vgvassilev commented 2 weeks ago

Explain what you would like to see improved and how.

We should move all headers from $ROOTSYS/include to $ROOTSYS/ROOT/{component} and we should automatically generate wrapping headers that #include the relevant ROOT/ header with a deprecation warning. Eg.

mv ROOTSYS/include/TLish.h ROOTSYS/include/ROOT/core/TLish.h
cat ROOTSYS/include/TLish.h
#warn "This forwarding header will go away in X please include \"ROOT/Base/TLish.h\" "
#include "ROOT/core/TLish.h"

The trampoline header file can be generated by our build system by adding a -DROOT_COMPATIBILITY switch that's on by default for few releases and then off.

ROOT version

master

Installation method

N/A

Operating system

N/A

Additional context

No response

dpiparo commented 2 weeks ago

Hi @vgvassilev could you please perhaps share a bit of the motivation you see behind this proposal, in other words the benefits for the project?

vgvassilev commented 2 weeks ago

Pretty much the same motivation of having new headers in ROOTSYS/include/ROOT. The upshot is that the third party codebase will become clearer of that TList.h is a ROOT thing; and more importantly we will define away a class of problems we have when installing ROOT. Right now on some systems we install everything in /usr/include, which is not a good practice unless one is libc.

vgvassilev commented 2 days ago

I remember @linev has made some progress in the past with this but then we were blocked by something wrt to modules that I do not remember...

linev commented 2 days ago

Some time ago we adjust cmake files so that when building ROOT libraries we using headers from source directories and not headers from $ROOTSYS/include. This makes dependencies between ROOT components more clear.

I just checked $ROOTSYS/include - there are 1476 files. And going this way we will double number of files.

vgvassilev commented 2 days ago

Yes, that is correct but only doubling them in count and during the deprecation phase.