Header unit name to BMI mapping
From the README:
It is expected that absolute header-unit names convert to relative CMI names, to keep all CMIs within the CMI repository. This means that steps must be taken to distinguish the CMIs for
/herefrom./here, and this can be achieved by replacing the leading./directory with,/, which is visually similar but does not have the self-reference semantics of dot. Likewise, header-unit names containing..directories, can be remapped to,,. (When symlinks are involvedbob/dob/..might not be bob, of course.) C++ header-unit semantics are such that there is no need to resolve multiple ways of spelling a particular header-unit to a unique CMI file.
Just want to mention the alternative approach that we use in build2: instead of trying to sanitize the path we hash it and then use the abbreviated hash as the BMI file name. More specifically (comment from the code):
// What should we use as a file/target name? On one hand we want it
// unique enough so that <stdio.h> and <custom/stdio.h> don't end up
// with the same BMI. On the other, we need the same headers resolving
// to the same target, regardless of how they were imported. So it feels
// like the name should be the absolute and normalized (actualized on
// case-insensitive filesystems) header path. We could try to come up
// with something by sanitizing certain characters, etc. But then the
// names will be very long and ugly, they will run into path length
// limits, etc. So instead we will use the file name plus an abbreviated
// hash of the whole path, something like stdio-211321fe6de7.