Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop-versatile' into develop. Close #204.
**Description** The standalone backend is capable of working with different kinds of property languages, as well as with `--parse-prop-via`, but the same features are not available in other backends. It also supports other kinds of JSON/XML formats, instead of using only a fixed format. The diagrams backend also supports the literal property "language", but that's not available in any of the other backends. To improve Ogma altogether and facilitate using the tool, we'd like these features to be present in as many backends as possible. **Type** - Feature: extend capability to other backends. **Additional context** None. **Requester** - Ivan Perez. **Method to check presence of bug** Not applicable (not a bug). **Expected result** The standalone backend is capable of supporting the "literal" property language. The ROS and FPrime backends support different file formats, property languages, and the use of external pre-processors like LLMs. The following dockerfile uses the standalone backend to generate a monitor using a literal Copilot expression gathered from a custom JSON file, and then uses the FPrime backend to produce an FPrime component. The Copilot monitor is further compiled, and building the Dockerfile generated by the FPrime backend completes the compilation process correctly. Note that, due to a standing issue with the FPrime backend (java is needed in newer versions), we need to modify the Dockerfile generated to install java. This can be done in a way that does not interfere with future tests (the modification will succeed even if java is available on the guest image already). ``` --- Dockerfile-verify-204 FROM ubuntu:trusty ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update RUN apt-get install --yes software-properties-common RUN add-apt-repository ppa:hvr/ghc RUN apt-get update RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4 RUN apt-get install --yes libz-dev ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH RUN cabal update RUN cabal v1-sandbox init RUN cabal v1-install alex happy RUN apt-get install --yes git ADD document.json /tmp/document.json ADD json-format.cfg /tmp/json-format.cfg ADD fprime-variable-dbs /tmp/fprime-variable-dbs ADD fprime-handlers /tmp/fprime-handlers CMD git clone $REPO && \ cd $NAME && \ git checkout $COMMIT && \ cd .. && \ cabal v1-sandbox init && \ cabal v1-install copilot-4.2 $NAME/$PAT**/ --constraint="aeson>=2.0.3.0" && \ ./.cabal-sandbox/bin/ogma standalone --file-name /tmp/document.json -f /tmp/json-format.cfg -p literal --target-file-name copilot --target-dir fprime_demo && \ ./.cabal-sandbox/bin/ogma fprime --app-target-dir fprime_demo --handlers-file /tmp/fprime-handlers --input-file /tmp/document.json -f /tmp/json-format.cfg -p literal --variable-db /tmp/fprime-variable-db && \ cabal v1-exec -- runhaskell fprime_demo/Copilot.hs && \ sed -i -e '0,/RUN apt-get install/{s/\(RUN apt-get install .*\)/\1 default-jre/}' fprime_demo/Dockerfile && \ mv copilot* fprime_demo/ --- document.json { "Example": { "internal_variables": [], "external_variables": [ {"name":"input", "type":"Float", "meaning": "Input from the system"} ], "properties": [ { "id": "MyProperty", "formula": "PTLTL.alwaysBeen (input /= 30.0)", "text": "Input is never 30" } ] } } --- fprime-handlers handlerMyProperty --- fprime-variable-db ("pullup", "bool") ("input", "float") --- json-format.cfg JSONFormat { specInternalVars = Just "..internal_variables[*]" , specInternalVarId = ".name" , specInternalVarExpr = ".meaning" , specInternalVarType = Just ".type" , specExternalVars = Just "..external_variables[*]" , specExternalVarId = ".name" , specExternalVarType = Just ".type" , specRequirements = "..properties[*]" , specRequirementId = ".id" , specRequirementDesc = Just ".text" , specRequirementExpr = ".formula" } ``` Command (substitute variables based on new path after merge): ``` $ docker run -v $PWD/fprime_demo:/fprime_demo -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e "PAT=ogma" -e "COMMIT=<HASH>" -it ogma-verify-204 $ cd fprime_demo $ docker build -t ogma-verify-204-fprime -f Dockerfile . ``` **Solution implemented** Modify standalone backend to support literal format. Modify ROS backend to support different property formats, file formats and external processors like LLMs. Modify FPrime backend to support different property formats, file formats and external processors like LLMs. Adjust tests to make file names match property formats and backend names. Adjust examples to make file names match property formats. **Further notes** We decide not to include the same ideas wrt. the cFS backend because it's slightly different, and it might be too hard to do as part of the same issue.
- Loading branch information