Skip to content

Commit

Permalink
Merge pull request #5 from DistRap/srk/checkFailures
Browse files Browse the repository at this point in the history
adapt to improved compileUnits
  • Loading branch information
sorki authored Mar 27, 2024
2 parents 7ff133e + d54b5fc commit 774270a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ packages:
source-repository-package
type: git
location: https://github.com/distrap/ivory
tag: 69bae09d064042e2135df2894b613ed5eadd38fa
tag: 5117a95efa786998fc24b5c5688844043555c47b
subdir:
ivory
ivory-artifact
Expand Down
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 774270a

Please sign in to comment.