Skip to content

Commit

Permalink
Merge branch 'main' into documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjoosten committed Aug 12, 2023
2 parents 8f5e198 + 1f24feb commit 4e65287
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 115 deletions.
101 changes: 1 addition & 100 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,103 +1,4 @@
FROM debian:bullseye as base
# This .devcontainer stuff is shamelessly copied from github.com/vzarytovskii/haskell-dev-env
ARG USERNAME=vscode
ARG GHC_VERSION=8.10.7
ARG STACK_VERSION=2.9.3
ARG STACK_RESOLVER=lts-18.28
ARG CABAL_VERSION=3.6.2.0
ARG HLS_VERSION=1.9.1.0
ARG LLVM_VERSION=12

ENV USERNAME=${USERNAME} \
USER_UID=1000 \
USER_GID=1000 \
DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF8 \
GHC_VERSION=${GHC_VERSION} \
STACK_RESOLVER=${STACK_RESOLVER} \
STACK_VERSION=${STACK_VERSION} \
CABAL_VERSION=${CABAL_VERSION} \
HLS_VERSION=${HLS_VERSION} \
LLVM_VERSION=${LLVM_VERSION}

RUN ulimit -n 8192

RUN export LANG=C.UTF8
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils bash build-essential ca-certificates curl gcc git gnupg libffi-dev libffi7 libgmp-dev libgmp-dev libgmp10 libicu-dev libncurses-dev libncurses5 libnuma1 libnuma-dev libtinfo5 lsb-release make procps software-properties-common sudo wget xz-utils z3 zlib1g-dev

RUN wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && chmod +x /tmp/llvm.sh && /tmp/llvm.sh ${LLVM_VERSION} && rm /tmp/llvm.sh

RUN groupadd --gid $USER_GID $USERNAME && \
useradd -ms /bin/bash -K MAIL_DIR=/dev/null --uid $USER_UID --gid $USER_GID -m $USERNAME && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME

USER ${USER_UID}:${USER_GID}
WORKDIR /home/${USERNAME}
ENV PATH="/home/${USERNAME}/.local/bin:/home/${USERNAME}/.cabal/bin:/home/${USERNAME}/.ghcup/bin:$PATH"

RUN echo "export PATH=$PATH" >> /home/$USERNAME/.profile

ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=yes \
BOOTSTRAP_HASKELL_NO_UPGRADE=yes

FROM base as tooling

RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

# Set the GHC version.
RUN ghcup install ghc ${GHC_VERSION} && ghcup set ghc ${GHC_VERSION}

# Install cabal-iinstall
RUN ghcup install cabal ${CABAL_VERSION} && ghcup set cabal ${CABAL_VERSION}

# Update Cabal.
RUN cabal update && cabal new-install cabal-install

# Configure cabal
RUN cabal user-config update -f && \
sed -i 's/-- ghc-options:/ghc-options: -haddock/g' ~/.cabal/config

# Install stack
RUN ghcup install stack ${STACK_VERSION} && ghcup set stack ${STACK_VERSION}

# Set system-ghc, install-ghc and resolver for stack.
RUN ((stack ghc -- --version 2>/dev/null) || true) && \
# Set global defaults for stack.
stack config --system-ghc set system-ghc true --global && \
stack config --system-ghc set install-ghc false --global && \
stack config --system-ghc set resolver $STACK_RESOLVER

# Temporary required, because http2-4.0.0 is broken, and used to build haddock. See https://github.com/kazu-yamamoto/http2/issues/42
RUN stack install http2-3.0.3

# Set global custom defaults for stack.
RUN printf "ghc-options:\n \"\$everything\": -haddock\n" >> /home/${USERNAME}/.stack/config.yaml

# Install hls
RUN ghcup install hls ${HLS_VERSION} && ghcup set hls ${HLS_VERSION}

FROM tooling as packages

# Install global packages.
# Versions are pinned, since we don't want to accidentally break anything (by always installing latest).
RUN cabal install -v haskell-dap-0.0.15.0
RUN cabal install -v ghci-dap-0.0.19.0
RUN cabal install -v haskell-debug-adapter-0.0.37.0
RUN cabal install -v hlint-3.2.7
RUN cabal install -v apply-refact-0.9.3.0
RUN cabal install -v retrie-1.1.0.0
RUN cabal install -v stylish-haskell-0.13.0.0
# RUN cabal install -v hoogle-5.0.18.3
RUN cabal install -v ormolu-0.1.3.1
RUN cabal install -v liquidhaskell-0.8.10.2

# Generate hoogle db
# RUN hoogle generate && stack hoogle

# Set up the dependencies for Ampersand
# RUN cd /workspaces/Ampersand && stack build --dependencies-only .
FROM ampersandtarski/ampersand-devcontainer:latest

ENV DEBIAN_FRONTEND=dialog

Expand Down
109 changes: 109 additions & 0 deletions .devcontainer/DockerfileUpstream
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
FROM ubuntu:focal as base
## Inspiration from https://stackoverflow.com/questions/67680726/installing-haskells-cabal-or-ghcup-inside-a-dockerfile-wont-work
ENV TZ=Europe/Berlin
ARG USERNAME=vscode


ENV USERNAME=${USERNAME} \
USER_UID=1000 \
USER_GID=1000 \
DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF8 \
WDIR=/home/${USERNAME}


# install dependencies (source: https://www.haskell.org/ghcup/install/ )
RUN \
apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
libnuma-dev \
zlib1g-dev \
libgmp-dev \
libgmp10 \
git \
wget \
lsb-release \
software-properties-common \
gnupg2 \
apt-transport-https \
gcc \
autoconf \
automake \
build-essential \
&& rm -rf /var/lib/apt/lists/*

RUN groupadd --gid $USER_GID $USERNAME && \
useradd -ms /bin/bash -K MAIL_DIR=/dev/null --uid $USER_UID --gid $USER_GID -m $USERNAME && \
mkdir -p /etc/sudoers.d && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME

USER ${USER_UID}:${USER_GID}

RUN ulimit -n 8192


# install gpg keys
# ARG GPG_KEY=BA3CBA3FFE22B574
# RUN gpg --batch --keyserver keys.openpgp.org --recv-keys $GPG_KEY
# manual installation: see https://www.haskell.org/ghcup/install/#manual-installation

# install ghcup
# Inspiration: http://haskell.org/ghcup/install
# Install ghcup as the 'vscode' user
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

# Add ghcup and cabal to the PATH
ENV PATH="${WDIR}/.cabal/bin:${WDIR}/.ghcup/bin:${PATH}:${WDIR}/.local/bin:${PATH}"

ARG GHC=8.10.7
ARG CABAL=3.10.1.0
ARG HLS=2.0.0.1
ARG STACK=2.11.1

# install GHC and cabal

RUN ghcup install ghc --set ${GHC} && \
ghcup install cabal --set ${CABAL} && \
ghcup install stack --set ${STACK} && \
ghcup install hls --set ${HLS}

FROM base as tools

# Install global packages.
# Versions are pinned, since we don't want to accidentally break anything (by always installing latest).
RUN cabal install -v haskell-dap-0.0.15.0 && \
cabal install -v stylish-haskell-0.13.0.0 && \
cabal install -v ormolu-0.1.3.1
# RUN cabal install -v ghci-dap-0.0.19.0
# RUN cabal install -v haskell-debug-adapter-0.0.37.0
# RUN cabal install -v hlint-3.2.7
# RUN cabal install -v apply-refact-0.9.3.0
# RUN cabal install -v retrie-1.1.0.0
# RUN cabal install -v hoogle-5.0.18.3
# RUN cabal install -v liquidhaskell-0.8.10.2

# Generate hoogle db
# RUN hoogle generate && stack hoogle

# create a `binbin` directory, that contains the executables themselves. In .cabal/bin most (all?) files are symbolic links
RUN mkdir ${WDIR}/.cabal/binbin && \
cp -L ${WDIR}/.cabal/bin/* ${WDIR}/.cabal/binbin

FROM base as dev
COPY --from=tools ${WDIR}/.cabal/binbin ${WDIR}/.cabal/bin
ENV PATH="${WDIR}/.cabal/bin:${WDIR}/.ghcup/bin:${WDIR}/.local/bin:${PATH}"

# # Add just the .cabal file to capture dependencies
COPY ./package.yaml ${WDIR}/package.yaml
COPY ./stack.yaml ${WDIR}/stack.yaml

RUN groupadd --gid $USER_GID $USERNAME && \
useradd -ms /bin/bash -K MAIL_DIR=/dev/null --uid $USER_UID --gid $USER_GID -m $USERNAME && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME

ENV DEBIAN_FRONTEND=dialog

ENTRYPOINT ["/bin/bash"]
13 changes: 2 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
{
"name": "DevContainer for Haskell (GHC, Stack, Cabal, HIE, LSP, DAP, etc.)",
"remoteUser": "vscode",
"name": "DevContainer for Ampersand",
// "remoteUser": "root",
"runArgs": [],
"build": {
"args": {
"USERNAME": "vscode",
"GHC_VERSION": "8.10.7",
"STACK_VERSION": "2.9.3",
"STACK_RESOLVER": "lts-18.28",
"CABAL_VERSION": "3.6.2.0",
"HLS_VERSION": "1.9.1.0",
"LLVM_VERSION": "12"
},
"context": "..",
"dockerfile": "Dockerfile"
},
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cabal.sandbox.config
.cabal-sandbox
.dist-buildwrapper
/dist
/dist-newstyle
.idea
.ampersand

Expand Down
8 changes: 6 additions & 2 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Release notes of Ampersand

## Unreleased changes

* [Issue #1419](https://github.com/AmpersandTarski/Ampersand/issues/1419) added a test, to be activated in the regression after resolving #1419.
* [Issue #1420](https://github.com/AmpersandTarski/Ampersand/issues/1420) added a test, to be activated in the regression after resolving #1420.
* [Issue #1421](https://github.com/AmpersandTarski/Ampersand/issues/1421) added easier development through Docker image at dockerhub: [ampersandtarski/ampersand-devcontainer](https://hub.docker.com/repository/docker/ampersandtarski/ampersand-devcontainer/general). Also fixes https://github.com/AmpersandTarski/Ampersand/issues/1359

## v4.7.6 (26 february 2023)

## v4.7.5 (25 february 2023)
* [Issue #1381](https://github.com/AmpersandTarski/Ampersand/issues/1381) Generate prototype with Angular frontend (alpha version)

- [Issue #1381](https://github.com/AmpersandTarski/Ampersand/issues/1381) Generate prototype with Angular frontend (alpha version)

## v4.7.4 (20 february 2023)

Expand Down
9 changes: 8 additions & 1 deletion ampersand.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ extra-source-files:
outputTemplates/default.xwiki
outputTemplates/default.zimwiki
outputTemplates/README.md
testing/performance/Issue1409/Issue1409.xlsx
testing/performance/Issue1409/Issue1409A.adl
testing/performance/Issue1409/Issue1409B.adl
testing/README.md
testing/Sentinel/README.md
testing/Sentinel/Tests/NoSentinel/Conjuncts.adl
Expand Down Expand Up @@ -119,10 +122,13 @@ extra-source-files:
testing/Sentinel/Tests/ShouldSucceed/OnlyValidation/ViewAnnotationCheck.adl
testing/Sentinel/Tests/ShouldSucceed/testinfo.yaml
testing/StillUnsupported/Bug335_Kl0Kl1.adl
testing/StillUnsupported/Issue1397-1.adl
testing/StillUnsupported/Issue1397.adl
testing/StillUnsupported/Issue1419.adl
testing/StillUnsupported/Issue1420.adl
testing/StillUnsupported/Issue166.adl
testing/StillUnsupported/Issue166_2.adl
testing/Travis/README.md
testing/Travis/testcases/Bugs/Current/Other/testinfo.yaml
testing/Travis/testcases/Bugs/Current/SQL/ARM20-Test8.adl
testing/Travis/testcases/Bugs/Current/SQL/testinfo.yaml
testing/Travis/testcases/Bugs/Current/SQLFail/Bug302_IgnoredV.adl
Expand Down Expand Up @@ -292,6 +298,7 @@ extra-source-files:
testing/Travis/testcases/prototype/shouldSucceed/Issue1026.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue1261.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue1281.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue1413.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue142.adl
testing/Travis/testcases/prototype/shouldSucceed/Issue142.xlsx
testing/Travis/testcases/prototype/shouldSucceed/Issue142TooGeneric.adl
Expand Down
2 changes: 1 addition & 1 deletion docs/reusing-available-modules.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Reusing Available Modules

## Sessions, Identity and Access Management \(SIAM version 3\)
## Sessions, Identity and Access Management \(SIAM version 3\)

You might want to know who is using your application. Or you might want to offer each one of your users some privacy when using your application. Logging in, passwords, authorizations, are typically used for such purposes. This field, also known as Identity and Access Management is covered in [this chapter](#the-siam-module).

Expand Down
13 changes: 13 additions & 0 deletions testing/StillUnsupported/Issue1419.adl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CONTEXT Issue1419
-- This script should succeed on compile time.

CLASSIFY Ss ISA S
CLASSIFY Uu ISA U

RELATION r[S*T]
RELATION s[T*U]
RELATION t[Ss*Uu]

ENFORCE t >: r;s

ENDCONTEXT
12 changes: 12 additions & 0 deletions testing/StillUnsupported/Issue1420.adl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CONTEXT Issue1420
-- This script should fail on runtime, with an error
-- refering to the univalence of s.

RELATION r[S*T]
RELATION s[S*T] [UNI]
POPULATION r[S*T] CONTAINS
[ ("aap","noot"), ("aap","mies") ]

ENFORCE s >: r

ENDCONTEXT

0 comments on commit 4e65287

Please sign in to comment.