diff --git a/tower-aadl/src/Tower/AADL.hs b/tower-aadl/src/Tower/AADL.hs index 8584e79..3cd31dd 100644 --- a/tower-aadl/src/Tower/AADL.hs +++ b/tower-aadl/src/Tower/AADL.hs @@ -26,9 +26,11 @@ import Data.Char import Control.Monad hiding (forever) import System.FilePath (addExtension, takeFileName, (<.>)) +import System.IO (hPutStrLn, stderr) import System.Exit (exitFailure) - +import MonadLib (runWriterT) import Text.PrettyPrint.Leijen hiding (()) +import qualified Text.PrettyPrint import qualified Ivory.Compile.C.CmdlineFrontend as O import qualified Ivory.Compile.C.Types as O @@ -108,7 +110,12 @@ compileTowerAADLForPlatform fromEnv mkEnv twr' = do unless (validCIdent appname) $ error $ "appname must be valid c identifier; '" ++ appname ++ "' is not" - cmodules <- O.compileUnits mods copts + (cmodules, errors) <- runWriterT $ O.compileUnits mods copts + hPutStrLn stderr + . Text.PrettyPrint.render + $ Text.PrettyPrint.vcat + errors + let (appMods, libMods) = partition (\m -> O.unitName m `elem` pkgs) cmodules O.outputCompiler appMods (as osspecific) (osSpecificOptsApps osspecific cfg copts) diff --git a/tower-aadl/tower-aadl.cabal b/tower-aadl/tower-aadl.cabal index fc6bfa0..29787e5 100644 --- a/tower-aadl/tower-aadl.cabal +++ b/tower-aadl/tower-aadl.cabal @@ -29,6 +29,8 @@ library , containers , directory , filepath + , monadLib >= 3.7 + , pretty >= 1.1 , wl-pprint , ivory >= 0.1.0.2 , ivory-artifact diff --git a/tower-mini/src/Tower/Mini.hs b/tower-mini/src/Tower/Mini.hs index a872511..8857bd4 100644 --- a/tower-mini/src/Tower/Mini.hs +++ b/tower-mini/src/Tower/Mini.hs @@ -42,7 +42,9 @@ import Data.List (partition) import MonadLib (forM_, runWriterT, when) import System.FilePath (()) import System.Exit (exitFailure) +import System.IO (hPutStrLn, stderr) import Text.PrettyPrint.Mainland ((<+>), putDoc, text) +import Text.PrettyPrint (render, vcat) import qualified Data.Map as Map @@ -241,7 +243,8 @@ compileTowerMini _fromEnv mkEnv comps = do , outHdrDir = Just (f name "include") , outArtDir = Just (f name) } - cmodules <- compileUnits mods copts' + (cmodules, errors) <- runWriterT $ compileUnits mods copts' + hPutStrLn stderr $ render $ vcat errors let (appMods, libMods) = partition (\m -> unitName m `elem` packages) cmodules diff --git a/tower-mini/tower-mini.cabal b/tower-mini/tower-mini.cabal index 6d86d47..222a9a8 100644 --- a/tower-mini/tower-mini.cabal +++ b/tower-mini/tower-mini.cabal @@ -16,6 +16,7 @@ library , filepath , mainland-pretty >= 0.4.0.0 , monadLib + , pretty >= 1.1 , ivory >= 0.1.0.2 , ivory-backend-c , tower