@@ -42,6 +42,7 @@ module Stack.Package
4242import qualified Data.ByteString as BS
4343import qualified Data.ByteString.Char8 as C8
4444import Data.List (isSuffixOf , isPrefixOf )
45+ import Data.Maybe (maybe )
4546import qualified Data.Map.Strict as M
4647import qualified Data.Set as S
4748import qualified Data.Text as T
@@ -589,6 +590,7 @@ componentBuildDir cabalVer component distDir
589590 | otherwise =
590591 case component of
591592 CLib -> buildDir distDir
593+ CInternalLib name -> buildDir distDir </> componentNameToDir name
592594 CExe name -> buildDir distDir </> componentNameToDir name
593595 CTest name -> buildDir distDir </> componentNameToDir name
594596 CBench name -> buildDir distDir </> componentNameToDir name
@@ -598,6 +600,7 @@ componentOutputDir :: NamedComponent -> Path Abs Dir -> Path Abs Dir
598600componentOutputDir namedComponent distDir =
599601 case namedComponent of
600602 CLib -> buildDir distDir
603+ CInternalLib name -> makeTmp name
601604 CExe name -> makeTmp name
602605 CTest name -> makeTmp name
603606 CBench name -> makeTmp name
@@ -700,6 +703,12 @@ packageDescModulesAndFiles pkg = do
700703 (return (M. empty, M. empty, [] ))
701704 (asModuleAndFileMap libComponent libraryFiles)
702705 (library pkg)
706+ (subLibrariesMods,subLibDotCabalFiles,subLibWarnings) <-
707+ liftM
708+ foldTuples
709+ (mapM
710+ (asModuleAndFileMap internalLibComponent libraryFiles)
711+ (subLibraries pkg))
703712 (executableMods,exeDotCabalFiles,exeWarnings) <-
704713 liftM
705714 foldTuples
@@ -719,14 +728,15 @@ packageDescModulesAndFiles pkg = do
719728 dfiles <- resolveGlobFiles
720729 (extraSrcFiles pkg
721730 ++ map (dataDir pkg FilePath. </> ) (dataFiles pkg))
722- let modules = libraryMods <> executableMods <> testMods <> benchModules
731+ let modules = libraryMods <> subLibrariesMods <> executableMods <> testMods <> benchModules
723732 files =
724- libDotCabalFiles <> exeDotCabalFiles <> testDotCabalFiles <>
733+ libDotCabalFiles <> subLibDotCabalFiles <> exeDotCabalFiles <> testDotCabalFiles <>
725734 benchDotCabalPaths
726- warnings = libWarnings <> exeWarnings <> testWarnings <> benchWarnings
735+ warnings = libWarnings <> subLibWarnings <> exeWarnings <> testWarnings <> benchWarnings
727736 return (modules, files, dfiles, warnings)
728737 where
729738 libComponent = const CLib
739+ internalLibComponent = CInternalLib . T. pack . maybe " " Cabal. unUnqualComponentName . libName
730740 exeComponent = CExe . T. pack . Cabal. unUnqualComponentName . exeName
731741 testComponent = CTest . T. pack . Cabal. unUnqualComponentName . testName
732742 benchComponent = CBench . T. pack . Cabal. unUnqualComponentName . benchmarkName
0 commit comments