From d3bb9629ff107c9a10e41e29ebaf94fc87b616f9 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 20 Oct 2021 23:00:45 -0400 Subject: [PATCH] Create `happy-boot` exe This helps avoid missing features in cabal-install, but doesn't yet work because Cabal doesn't realize it should use `happy-boot` for `.ly` files. --- .github/haskell-ci.patch | 43 ---------------------- .github/workflows/haskell-ci.yml | 30 ++++++++-------- happy.cabal | 62 ++++++++++++++++++++++---------- 3 files changed, 59 insertions(+), 76 deletions(-) delete mode 100644 .github/haskell-ci.patch diff --git a/.github/haskell-ci.patch b/.github/haskell-ci.patch deleted file mode 100644 index 79e6de49..00000000 --- a/.github/haskell-ci.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- workflows/haskell-ci.yml 2021-07-14 19:49:44.000000000 +0200 -+++ workflows/haskell-ci.yml-patched 2021-07-14 19:49:28.000000000 +0200 -@@ -196,7 +196,7 @@ - cat cabal.project.local - - name: dump install plan - run: | -- $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all -+ $CABAL v2-build --flags=-bootstrap $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all - cabal-plan - - name: cache - uses: actions/cache@v2 -@@ -206,17 +206,19 @@ - restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- - - name: install dependencies - run: | -- $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all -- $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all -- - name: build w/o tests -+ $CABAL v2-build --flags=-bootstrap $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all -+ $CABAL v2-build --flags=-bootstrap $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all -+ - name: build w/o tests and install - run: | -- $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all -+ $CABAL v2-install --reinstall --overwrite-policy=always --flags=-bootstrap $ARG_COMPILER --disable-tests --disable-benchmarks all - - name: build - run: | -- $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always -+ $CABAL v2-build --flags=-bootstrap $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - - name: tests - run: | -- $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct -+ export HAPPY=$HOME/.cabal/bin/happy -+ export HC=$HC -+ $CABAL v2-test --flags=-bootstrap $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct - - name: cabal check - run: | - cd ${PKGDIR_happy} || false -@@ -224,4 +226,4 @@ - - name: unconstrained build - run: | - rm -f cabal.project.local -- $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all -+ $CABAL v2-build --flags=-bootstrap $ARG_COMPILER --disable-tests --disable-benchmarks all diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index c7513206..eabc315d 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.13.20210606 +# version: 0.13.20211011 # -# REGENDATA ("0.13.20210606",["github","happy.cabal"]) +# REGENDATA ("0.13.20211011",["github","happy.cabal"]) # name: Haskell-CI on: @@ -94,7 +94,11 @@ jobs: apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 apt-add-repository -y 'ppa:hvr/ghc' apt-get update - apt-get install -y "$HCNAME" cabal-install-3.4 + apt-get install -y "$HCNAME" + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.16.2/x86_64-linux-ghcup-0.1.16.2 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -110,7 +114,7 @@ jobs: echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" - echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" @@ -196,7 +200,7 @@ jobs: cat cabal.project.local - name: dump install plan run: | - $CABAL v2-build --flags=-bootstrap $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - name: cache uses: actions/cache@v2 @@ -206,19 +210,17 @@ jobs: restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- - name: install dependencies run: | - $CABAL v2-build --flags=-bootstrap $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all - $CABAL v2-build --flags=-bootstrap $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all - - name: build w/o tests and install + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all + - name: build w/o tests run: | - $CABAL v2-install --reinstall --overwrite-policy=always --flags=-bootstrap $ARG_COMPILER --disable-tests --disable-benchmarks all + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - name: build run: | - $CABAL v2-build --flags=-bootstrap $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - name: tests run: | - export HAPPY=$HOME/.cabal/bin/happy - export HC=$HC - $CABAL v2-test --flags=-bootstrap $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct - name: cabal check run: | cd ${PKGDIR_happy} || false @@ -226,4 +228,4 @@ jobs: - name: unconstrained build run: | rm -f cabal.project.local - $CABAL v2-build --flags=-bootstrap $ARG_COMPILER --disable-tests --disable-benchmarks all + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all diff --git a/happy.cabal b/happy.cabal index 9cf5d0e1..56d10de1 100644 --- a/happy.cabal +++ b/happy.cabal @@ -144,11 +144,6 @@ extra-source-files: tests/rank2.y tests/shift01.y -flag bootstrap - description: Optimize the implementation of happy using a pre-built happy - manual: True - default: True - source-repository head type: git location: https://github.com/simonmar/happy.git @@ -187,20 +182,49 @@ executable happy ParamRules PrettyGrammar - if flag(bootstrap) - -- TODO put this back when Cabal can use it's qualified goals to better - -- understand bootstrapping, see - -- https://github.com/haskell/cabal/issues/7189 - --build-tools: happy - cpp-options: -DHAPPY_BOOTSTRAP - other-modules: - ParseMonad.Bootstrapped - Parser.Bootstrapped - AttrGrammarParser - else - other-modules: - ParseMonad.Oracle - Parser.Oracle + ParseMonad.Bootstrapped + Parser.Bootstrapped + AttrGrammarParser + + build-tool-depends: happy:happy-boot + cpp-options: -DHAPPY_BOOTSTRAP + +executable happy-boot + hs-source-dirs: src + main-is: Main.lhs + + build-depends: base < 5, + array, + containers >= 0.4.2, + mtl >= 2.2.1 + -- mtl-2.2.1 added Control.Monad.Except + + default-language: Haskell98 + default-extensions: CPP, MagicHash, FlexibleContexts, NamedFieldPuns + ghc-options: -Wall + other-modules: + Paths_happy + AbsSyn + First + GenUtils + Grammar + Info + LALR + Lexer + ParseMonad + ParseMonad.Class + Parser + ProduceCode + ProduceGLRCode + NameSet + Tabular + Target + AttrGrammar + ParamRules + PrettyGrammar + + ParseMonad.Oracle + Parser.Oracle test-suite tests