-
Notifications
You must be signed in to change notification settings - Fork 30
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-cfs-extravars' into develop. Close #106.
**Description** The generated cFS application may need definitions that come from external files, such as message IDs from other applications, or structs defined elsewhere. Users may also want to customize additional aspects of the generated application without having to modify the template, such as passing additional variables to be expanded in the template. There should be a setting to include additional headers or other variables so that the generated app never has to be modified. **Type** - Feature: facilitate customizing generated applications. **Additional context** None. **Requester** - Ivan Perez. **Method to check presence of bug** Not applicable (not a bug). **Expected result** Ogma provides a mechanism to provide additional variables to be expanded in cFS applications. The following dockerfile first checks that passing the additional extra variables files does not affect the result unless the variable is mentioned in the template, by comparing the result to a run without passing any extra vars. It later adds a file with a custom variable, and then passes an extra template variable using the new flag, after which it prints the message "Success": ``` FROM ubuntu:focal ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update RUN apt-get install --yes \ curl g++ gcc git libgmp3-dev libz-dev make pkg-config RUN mkdir -p $HOME/.local/bin ENV PATH=$PATH:/root/.local/bin/ RUN curl https://downloads.haskell.org/~ghcup/0.1.17.7/x86_64-linux-ghcup-0.1.17.7 -o $HOME/.local/bin/ghcup RUN chmod a+x $HOME/.local/bin/ghcup ENV PATH=$PATH:/root/.ghcup/bin/ RUN ghcup install ghc 9.10 RUN ghcup install cabal 3.12 RUN ghcup set ghc 9.10.1 RUN cabal update SHELL ["/bin/bash", "-c"] CMD git clone $REPO \ && cd $NAME \ && git checkout $COMMIT \ && cabal install ogma-cli:ogma \ && ogma cfs --variable-file ogma-cli/examples/cfs-variables --variable-db ogma-cli/examples/cfs-variable-db --app-target-dir original --handlers-file ogma-cli/examples/cfs-handlers \ && cp -r ogma-core/templates/copilot-cfs custom \ && find custom -iname '.gitignore' -delete \ && echo '{ "message": "Success" }' >> template-vars \ && ogma cfs --variable-file ogma-cli/examples/cfs-variables --variable-db ogma-cli/examples/cfs-variable-db --app-target-dir new --handlers-file ogma-cli/examples/cfs-handlers \ --app-template-dir custom --template-vars template-vars \ && diff -rq original new \ && echo '{{message}}' >> custom/fsw/result \ && rm -rf new \ && ogma cfs --variable-file ogma-cli/examples/cfs-variables --variable-db ogma-cli/examples/cfs-variable-db --app-target-dir new --handlers-file ogma-cli/examples/cfs-handlers \ --app-template-dir custom --template-vars template-vars \ && cat new/fsw/result ``` Command (substitute variables based on new path after merge): ```sh $ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e "COMMIT=<HASH>" -it ogma-verify-106 ``` **Solution implemented** Update `ogma-core` to expect a new argument with a JSON file listing additional keys to expand as variables in the template. Update `ogma-cli` to expose the new argument to the user via an optional flag. Update `ogma-cli` to document new feature in the README. **Further notes** None.
- Loading branch information
Showing
5 changed files
with
101 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters