From 87ef052f7837ffa65fb3960c4dc28cb405fd7950 Mon Sep 17 00:00:00 2001 From: sorki Date: Tue, 26 Mar 2024 13:28:31 +0100 Subject: [PATCH 1/2] bump ivory --- cabal.project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal.project b/cabal.project index 9b623fa..9d3df92 100644 --- a/cabal.project +++ b/cabal.project @@ -8,7 +8,7 @@ packages: source-repository-package type: git location: https://github.com/distrap/ivory - tag: 69bae09d064042e2135df2894b613ed5eadd38fa + tag: 5117a95efa786998fc24b5c5688844043555c47b subdir: ivory ivory-artifact From d54b5fcf3a66a0029286aa6d2e8ea32b7d499981 Mon Sep 17 00:00:00 2001 From: sorki Date: Tue, 26 Mar 2024 13:29:13 +0100 Subject: [PATCH 2/2] tower-aadl, tower-mini: adapt to improved compileUnits --- tower-aadl/src/Tower/AADL.hs | 14 ++++++++------ tower-aadl/tower-aadl.cabal | 1 - tower-mini/src/Tower/Mini.hs | 15 +++++++++------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tower-aadl/src/Tower/AADL.hs b/tower-aadl/src/Tower/AADL.hs index 3cd31dd..d4bbadd 100644 --- a/tower-aadl/src/Tower/AADL.hs +++ b/tower-aadl/src/Tower/AADL.hs @@ -28,7 +28,6 @@ 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 @@ -110,16 +109,19 @@ compileTowerAADLForPlatform fromEnv mkEnv twr' = do unless (validCIdent appname) $ error $ "appname must be valid c identifier; '" ++ appname ++ "' is not" - (cmodules, errors) <- runWriterT $ O.compileUnits mods copts + (ecmodules, errors) <- 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) - O.outputCompiler libMods [] (osSpecificOptsLibs osspecific cfg copts) + case ecmodules of + Left errs -> error $ show errs + Right cmodules -> do + let (appMods, libMods) = + partition (\m -> O.unitName m `elem` pkgs) cmodules + O.outputCompiler appMods (as osspecific) (osSpecificOptsApps osspecific cfg copts) + O.outputCompiler libMods [] (osSpecificOptsLibs osspecific cfg copts) where -- | AADL assumes that our handlers will always have a callback define. So we diff --git a/tower-aadl/tower-aadl.cabal b/tower-aadl/tower-aadl.cabal index 29787e5..a8f5089 100644 --- a/tower-aadl/tower-aadl.cabal +++ b/tower-aadl/tower-aadl.cabal @@ -29,7 +29,6 @@ library , containers , directory , filepath - , monadLib >= 3.7 , pretty >= 1.1 , wl-pprint , ivory >= 0.1.0.2 diff --git a/tower-mini/src/Tower/Mini.hs b/tower-mini/src/Tower/Mini.hs index 8857bd4..00fcc58 100644 --- a/tower-mini/src/Tower/Mini.hs +++ b/tower-mini/src/Tower/Mini.hs @@ -243,15 +243,18 @@ compileTowerMini _fromEnv mkEnv comps = do , outHdrDir = Just (f name "include") , outArtDir = Just (f name) } - (cmodules, errors) <- runWriterT $ compileUnits mods copts' + (ecmodules, errors) <- compileUnits mods copts' hPutStrLn stderr $ render $ vcat errors - let (appMods, libMods) = - partition (\m -> unitName m `elem` packages) cmodules - libAs = dependencies_artifacts deps + case ecmodules of + Left errs -> error $ show errs + Right cmodules -> do + let (appMods, libMods) = + partition (\m -> unitName m `elem` packages) cmodules + libAs = dependencies_artifacts deps - outputCompiler appMods libAs copts' - outputCompiler libMods [] copts' + outputCompiler appMods libAs copts' + outputCompiler libMods [] copts' -- | Build an individual minitower component. This is where much of -- the action is, as we finally run the underlying 'Tower' program of