-
Notifications
You must be signed in to change notification settings - Fork 26
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-standalone-templates' into develop. Close #189.
**Description** The standalone application generation backend uses a fixed template to generate the standalone application. That template does not fit all use cases, so we are finding users heavily modifying the output (which is hard to keep up with when there are changes), and or not using ogma altogether for that reason. Allowing users to pick their own standalone template would make Ogma more versatile. **Type** - Feature: Enable customizing output produced. **Additional context** None. **Requester** - Ivan Perez. **Method to check presence of bug** Not applicable (not a bug). **Expected result** Ogma allows users to pick the custom standalone application template they want to use instead of relying on the one provided by default. The following dockerfile generates a standalone Copilot monitor using the default template and using a copy and the default template and checks that both are the same. It then adds a file to the copy of the template and checks that the file is copied to the target directory when the custom template is used, after which it prints the message "Success". Compiling the produced component completes successfully: ```Dockerfile 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 CMD git clone $REPO \ && cd $NAME \ && git checkout $COMMIT \ && cd .. \ && cp -r $NAME/ogma-core/templates/standalone custom-template-standalone \ && cabal v1-sandbox init \ && cabal v1-install $NAME/$PAT**/ copilot-4.1 --constraint="aeson>=2.0.3.0" \ && ./.cabal-sandbox/bin/ogma standalone --file-name $NAME/ogma-cli/examples/fret.json --input-format fcs --target-dir orig \ && ./.cabal-sandbox/bin/ogma standalone --file-name $NAME/ogma-cli/examples/fret.json --input-format fcs --target-dir new --template-dir custom-template-standalone \ && diff -rq orig new \ && rm -rf new/ \ && echo "Success" >> custom-template-standalone/README \ && ./.cabal-sandbox/bin/ogma standalone --file-name $NAME/ogma-cli/examples/fret.json --input-format fcs --target-dir new --template-dir custom-template-standalone \ && cabal v1-exec -- runhaskell -XPartialTypeSignatures -Wno-partial-type-signatures new/Copilot.hs \ && cat new/README ``` Command (substitute variables based on new path after merge): ```sh $ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e "PAT=ogma" -e "COMMIT=<HASH>" -it ogma-verify-189 ``` **Solution implemented** Modify `ogma-core` to use variable expansion based on mustache to create the output files. Modify `ogma-core`'s template to use the variables used by the standalone application generation module. Modify `ogma-core` to give users the ability to pick a target directory via an input argument. Modify `ogma-core` to give users the ability to pick a template directory via an optional input argument. Modify tests in `ogma-core` to provide the new arguments to the standalone backend so that tests keep working. Modify `ogma-cli` to give users the ability to pick a target directory via an optional input argument (exposing the corresponding argument from `ogma-core`). Modify `ogma-cli` to give users the ability to pick a template directory via an optional input argument (exposing the corresponding argument from `ogma-core`). **Further notes** The `README` is not modified to demonstrate new capability, because there is no entry in the `README` for the standalone backend.
- Loading branch information
Showing
8 changed files
with
175 additions
and
128 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
Oops, something went wrong.