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-copilot-3.19' into develop. Close #231.
**Description** Copilot 3.19 changed the way that structs are generated. For example, the function `typename` was removed in favor of `typeName`. The code currently generated by Ogma requires Copilot < 3.19 to work. We need to update that. **Type** - Management: Update to work with new versions of dependencies. **Additional context** None. **Requester** - Ivan Perez. **Method to check presence of bug** Not applicable (not a bug). **Expected result** The code generated by the struct generator compiles with Copilot 4.2, the current version as of the time of this writing. The following dockerfile installs Copilot 4.2 and Ogma, and uses the structs command to generate a Copilot struct definition, and uses Copilot to check that the code generated compiles, 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 --lib copilot copilot-c99 copilot-language \ copilot-theorem copilot-libraries copilot-interpreter \ && cabal install ogma-cli:ogma \ && echo '{-# LANGUAGE DataKinds #-}' >> Point.hs \ && echo 'module Point where' >> Point.hs \ && echo 'import Language.Copilot' >> Point.hs \ && ogma structs --header-file-name ogma-cli/examples/point.h >> Point.hs \ && ghc -c Point.hs \ && echo "Success" ``` 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-231 ``` **Solution implemented** Modify the code generated by the Copilot struct backend to use the class method `typeName` instead of the old name `typename`. Adjust local names in the Ogma code accordingly. **Further notes** None.
- Loading branch information