ogma-cli 1.0.7 → 1.0.8
raw patch · 5 files changed
+181/−2 lines, 5 filesdep ~ogma-core
Dependency ranges changed: ogma-core
Files
- CHANGELOG.md +6/−0
- ogma-cli.cabal +11/−2
- src/CLI/CommandFPrimeApp.hs +148/−0
- src/CLI/CommandTop.hs +14/−0
- src/Main.hs +2/−0
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Revision history for ogma-cli +## [1.0.8] - 2023-03-21++* Version bump 1.0.8 (#81).+* Introduce new F' (FPrime) backend (#77).+* Mark package as uncurated (#74).+ ## [1.0.7] - 2023-01-21 * Version bump 1.0.7 (#69). * Replace tabs in cabal file (#69).
ogma-cli.cabal view
@@ -32,7 +32,7 @@ build-type: Simple name: ogma-cli-version: 1.0.7+version: 1.0.8 homepage: http://nasa.gov license: OtherLicense license-file: LICENSE.pdf@@ -86,6 +86,7 @@ > structs Generate Copilot structs from C structs > handlers Generate message handlers from C structs > cfs Generate a complete CFS/Copilot application+ > fprime Generate a complete F' monitoring component > fret-component-spec Generate a Copilot file from a FRET Component > Specification > fret-reqs-db Generate a Copilot file from a FRET Requirements@@ -108,6 +109,13 @@ . - <https://shemesh.larc.nasa.gov/people/cam/publications/FMAS2020_3.pdf "From Requirements to Autonomous Flight">, Dutle et al. 2020. +-- Ogma packages should be uncurated so that only the official maintainers make+-- changes.+--+-- Because this is a NASA project, we want to make sure that users obtain+-- exactly what we publish, unmodified by anyone external to our project.+x-curation: uncurated+ executable ogma main-is:@@ -117,6 +125,7 @@ CLI.CommandCFSApp CLI.CommandCStructs2Copilot CLI.CommandCStructs2MsgHandlers+ CLI.CommandFPrimeApp CLI.CommandFretComponentSpec2Copilot CLI.CommandFretReqsDB2Copilot CLI.CommandROSApp@@ -126,7 +135,7 @@ build-depends: base >= 4.11.0.0 && < 5 , optparse-applicative- , ogma-core >= 1.0.7 && < 1.1+ , ogma-core >= 1.0.8 && < 1.1 hs-source-dirs: src
+ src/CLI/CommandFPrimeApp.hs view
@@ -0,0 +1,148 @@+-- Copyright 2022 United States Government as represented by the Administrator+-- of the National Aeronautics and Space Administration. All Rights Reserved.+--+-- Disclaimers+--+-- No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY+-- OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT+-- LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO+-- SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A+-- PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE+-- SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF+-- PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN+-- ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR+-- RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR+-- ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER,+-- GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING+-- THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES+-- IT "AS IS."+--+-- Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST+-- THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS+-- ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN+-- ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,+-- INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S+-- USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE+-- UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY+-- PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY+-- FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS+-- AGREEMENT.+--+-- | CLI interface to the FPrimeApp subcommand.+module CLI.CommandFPrimeApp+ (+ -- * Direct command access+ command+ , CommandOpts+ , ErrorCode++ -- * CLI+ , commandDesc+ , commandOptsParser+ )+ where++-- External imports+import Options.Applicative ( Parser, help, long, metavar, optional, showDefault,+ strOption, value )++-- External imports: command results+import Command.Result ( Result )++-- External imports: actions or commands supported+import Command.FPrimeApp ( ErrorCode, fprimeApp )++-- * Command++-- | Options needed to generate the FPrime component.+data CommandOpts = CommandOpts+ { fprimeAppTarget :: String+ , fprimeAppFRETFile :: Maybe String+ , fprimeAppVarNames :: Maybe String+ , fprimeAppVarDB :: Maybe String+ , fprimeAppHandlers :: Maybe String+ }++-- | Create <https://github.com/nasa/fprime FPrime> component that subscribe+-- to obtain necessary data from the bus and call Copilot when new data+-- arrives.+--+-- This is just an uncurried version of "Command.fprimeApp".+command :: CommandOpts -> IO (Result ErrorCode)+command c =+ fprimeApp+ (fprimeAppTarget c)+ (fprimeAppFRETFile c)+ (fprimeAppVarNames c)+ (fprimeAppVarDB c)+ (fprimeAppHandlers c)++-- * CLI++-- | FPrime command description+commandDesc :: String+commandDesc = "Generate a complete F' monitoring component"++-- | Subparser for the @fprime@ command, used to generate an FPrime component+-- connected to Copilot monitors.+commandOptsParser :: Parser CommandOpts+commandOptsParser = CommandOpts+ <$> strOption+ ( long "app-target-dir"+ <> metavar "DIR"+ <> showDefault+ <> value "fprime"+ <> help strFPrimeAppDirArgDesc+ )+ <*> optional+ ( strOption+ ( long "fret-file-name"+ <> metavar "FILENAME"+ <> help strFPrimeAppFRETFileNameArgDesc+ )+ )+ <*> optional+ ( strOption+ ( long "variable-file"+ <> metavar "FILENAME"+ <> help strFPrimeAppVarListArgDesc+ )+ )+ <*> optional+ ( strOption+ ( long "variable-db"+ <> metavar "FILENAME"+ <> help strFPrimeAppVarDBArgDesc+ )+ )+ <*> optional+ ( strOption+ ( long "handlers-file"+ <> metavar "FILENAME"+ <> help strFPrimeAppHandlerListArgDesc+ )+ )++-- | Argument target directory to FPrime component generation command+strFPrimeAppDirArgDesc :: String+strFPrimeAppDirArgDesc = "Target directory"++-- | Argument FRET CS to FPrime component generation command+strFPrimeAppFRETFileNameArgDesc :: String+strFPrimeAppFRETFileNameArgDesc =+ "File containing FRET Component Specification"++-- | Argument variable list to FPrime component generation command+strFPrimeAppVarListArgDesc :: String+strFPrimeAppVarListArgDesc =+ "File containing list of F' variables to make accessible"++-- | Argument variable database to FPrime component generation command+strFPrimeAppVarDBArgDesc :: String+strFPrimeAppVarDBArgDesc =+ "File containing a DB of known F' variables"++-- | Argument handler list to FPrime component generation command+strFPrimeAppHandlerListArgDesc :: String+strFPrimeAppHandlerListArgDesc =+ "File containing list of Copilot handlers used in the specification"
src/CLI/CommandTop.hs view
@@ -89,6 +89,7 @@ import qualified CLI.CommandCFSApp import qualified CLI.CommandCStructs2Copilot import qualified CLI.CommandCStructs2MsgHandlers+import qualified CLI.CommandFPrimeApp import qualified CLI.CommandFretComponentSpec2Copilot import qualified CLI.CommandFretReqsDB2Copilot import qualified CLI.CommandROSApp@@ -104,6 +105,7 @@ CommandOptsCFSApp CLI.CommandCFSApp.CommandOpts | CommandOptsCStructs2Copilot CLI.CommandCStructs2Copilot.CommandOpts | CommandOptsCStructs2MsgHandlers CLI.CommandCStructs2MsgHandlers.CommandOpts+ | CommandOptsFPrimeApp CLI.CommandFPrimeApp.CommandOpts | CommandOptsFretComponentSpec2Copilot CLI.CommandFretComponentSpec2Copilot.CommandOpts | CommandOptsFretReqsDB2Copilot CLI.CommandFretReqsDB2Copilot.CommandOpts | CommandOptsROSApp CLI.CommandROSApp.CommandOpts@@ -121,6 +123,7 @@ ( subcommandCStructs <> subcommandMsgHandlers <> subcommandCFSApp+ <> subcommandFPrimeApp <> subcommandFretComponentSpec <> subcommandFretReqs <> subcommandROSApp@@ -187,6 +190,15 @@ (CommandOptsROSApp <$> CLI.CommandROSApp.commandOptsParser) CLI.CommandROSApp.commandDesc +-- | Modifier for the FPrime app expansion subcommand, linking the subcommand+-- options and description to the command @fprime@ at top level.+subcommandFPrimeApp :: Mod CommandFields CommandOpts+subcommandFPrimeApp =+ subcommand+ "fprime"+ (CommandOptsFPrimeApp <$> CLI.CommandFPrimeApp.commandOptsParser)+ CLI.CommandFPrimeApp.commandDesc+ -- * Command dispatcher -- | Command dispatcher that obtains the parameters from the command line and@@ -215,6 +227,8 @@ id <$> CLI.CommandCStructs2Copilot.command c command (CommandOptsCStructs2MsgHandlers c) = id <$> CLI.CommandCStructs2MsgHandlers.command c+command (CommandOptsFPrimeApp c) =+ id <$> CLI.CommandFPrimeApp.command c command (CommandOptsFretComponentSpec2Copilot c) = id <$> CLI.CommandFretComponentSpec2Copilot.command c command (CommandOptsFretReqsDB2Copilot c) =
src/Main.hs view
@@ -53,6 +53,8 @@ -- * Generate Robot Operating System (ROS) applications for runtime monitoring -- using Copilot. --+-- * Generate F' (FPrime) components for runtime monitoring using Copilot.+-- -- More information can be obtained by calling ogma with the argument @--help@. module Main ( main )