Skip to content

Commit

Permalink
tower-aadl, tower-mini: adapt to improved compileUnits
Browse files Browse the repository at this point in the history
  • Loading branch information
sorki committed Mar 26, 2024
1 parent 87ef052 commit d54b5fc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
14 changes: 8 additions & 6 deletions tower-aadl/src/Tower/AADL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tower-aadl/tower-aadl.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ library
, containers
, directory
, filepath
, monadLib >= 3.7
, pretty >= 1.1
, wl-pprint
, ivory >= 0.1.0.2
Expand Down
15 changes: 9 additions & 6 deletions tower-mini/src/Tower/Mini.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d54b5fc

Please sign in to comment.