• Edward Z. Yang's avatar
    Properly assign component ID/build dir for LibV09 test libraries · 18fcd9c1
    Edward Z. Yang authored
    
    
    Cabal's LibV09 support has always been a bit skeevy.  The general
    idea was that a detailed-0.9 test-suite is built as a library
    and an Cabal-provided stub executable.  In particular, the test suite
    library must be installed to the installed package database so that the
    executable can be compiled.
    
    Old versions of Cabal did something very skeevy here:  they installed
    the test library as a "package", with the same package name as
    the "test-suite" stanza; furthermore, they built the products
    into the same directory as the library proper.
    
    Consequently, a lot of bad things could happen (both of which I've
    added tests for):
    
        1. If the name of the test suite and the name of some other
        package coincide (and have the same version), they will clobber
        each other.  In GHC 7.8 and earlier, this just flat out
        kills the build, because it will shadow.  There's an explicit
        test to make sure test suites don't conflict with the package
        name, but you can get unlucky.
    
        2. The test suite library is built into the same directory
        as the main library, which means that if the test library
        implements the same module name as something in the main
        library it will clobber the interface file and badness
        will ensue.
    
    This patchset fixes both of these issues, by (1) giving internal
    test libraries proper names which are guaranteed to be unique
    up to Cabal's dependency resolution, and (2) building the test
    suite library into a separate directory.
    
    In doing so, it also lays the groundwork for other types of
    internal libraries, e.g. #269, as well as extra (invisible)
    libraries which we may install.
    
    For GHC 7.8 and earlier, we follow the reserved namespace
    convention as per #3017.
    Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
    18fcd9c1
DuplicateModuleName.cabal 638 Bytes