From 73e1ea48722ae23eeb138b18461adb4a1ab261db Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Wed, 24 Jul 2024 09:32:21 -0400 Subject: [PATCH] cabal for ci (#541) * use cabal to build/run the ci script * update build instructions, remove azure tests --- .github/workflows/ghc-lib-da-ghc-8.4.3.yml | 52 ++--- .../ghc-lib-ghc-9.10.1-ghc-9.8.2.yml | 52 ++--- .../workflows/ghc-lib-ghc-9.8.2-ghc-9.6.5.yml | 52 ++--- .../ghc-lib-ghc-master-ghc-9.10.1.yml | 53 ++--- CI.hs | 7 +- README.md | 17 +- azure-pipelines.yml | 212 ------------------ ghc-lib-gen.cabal | 31 ++- ghc-lib-gen/src/Ghclibgen.hs | 24 +- 9 files changed, 117 insertions(+), 383 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/ghc-lib-da-ghc-8.4.3.yml b/.github/workflows/ghc-lib-da-ghc-8.4.3.yml index 9f9fdb76..634d300a 100644 --- a/.github/workflows/ghc-lib-da-ghc-8.4.3.yml +++ b/.github/workflows/ghc-lib-da-ghc-8.4.3.yml @@ -1,6 +1,7 @@ name: ghc-lib-da-ghc-8.4.3 on: push: + pull_request: jobs: runhaskell: name: ${{ matrix.os }} @@ -11,53 +12,36 @@ jobs: os: [ubuntu, windows] steps: - uses: actions/checkout@v4 - - name: Install msys2 (windows) + - name: Configure msys2 (windows) shell: bash run: |- - cd /c - curl -L https://github.com/commercialhaskell/stackage-content/releases/download/msys2-20230526/msys2-20230526-x86_64.tar.xz -o msys2-20230526-x86_64.tar.xz - tar xvf ./msys2-20230526-x86_64.tar.xz > /dev/null + echo "MSYSTEM=CLANG64" >> $GITHUB_ENV + echo "/c/mingw64/usr/bin" >> $GITHUB_PATH + echo "/c/msys64/usr/bin" >> $GITHUB_PATH if: matrix.os == 'windows' - - name: Install ghcup + - name: Install ghcup (windows) shell: bash run: |- - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \ - BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ - BOOTSTRAP_HASKELL_GHC_VERSION=8.4.3 \ - BOOTSTRAP_HASKELL_CABAL_VERSION=latest \ - BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 \ - BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 \ - BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh - - name: Setup cabal (windows) - shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' - run: |- - PATH=/c/cabal/bin:/c/.ghcup/ghc-8.4.3/bin:/c/.ghcup/bin:$PATH - export PATH - cabal update - cabal install alex happy - cabal --store-dir="c:\\cabal\\store" --lib --force-reinstalls --package-env=- install extra-1.6.13 optparse-applicative-0.14.3.0 + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=8.4.3 BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh + echo "/c/ghcup/bin" >> $GITHUB_PATH + echo "/c/ghcup/ghc/8.4.3/bin" >> $GITHUB_PATH + echo "/c/cabal/bin" >> $GITHUB_PATH if: matrix.os == 'windows' - - name: Setup cabal(unix) + - name: Install ghcup (unix) shell: bash run: |- - PATH="$HOME/.cabal/bin":"$HOME/.ghcup/ghc/8.4.3/bin":"$HOME/.ghcup/bin":"$PATH" - export PATH - cabal install alex happy - cabal --store-dir=$HOME/.cabal/store --lib --force-reinstalls --package-env=- install extra-1.6.13 optparse-applicative-0.14.3.0 - if: matrix.os == 'ubuntu' || matrix.os == 'macos' + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=8.4.3 BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh + echo "$HOME/.ghcup/bin" >> $GITHUB_PATH + echo "$HOME/.ghcup/ghc/8.4.3/bin" >> $GITHUB_PATH + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + if: matrix.os == 'ubuntu' || matrix.os == 'macos' - name: Run CI.hs (windows) shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' run: |- - PATH=/c/cabal/bin:/c/ghcup/ghc/8.4.3/bin:/c/ghcup/bin:/c/msys64/usr/bin:/c/mingw64/bin:"/c/program files/git/bin":"$PATH" - export PATH - MSYSTEM=CLANG64; export MSYSTEM pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm - runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=/c/cabal/store/$(ls /c/cabal/store)/package.db CI.hs --da + cabal run exe:ghc-lib-build-tool -- --da if: matrix.os == 'windows' - name: Run CI.hs (unix) shell: bash - run: |- - PATH="$HOME/.cabal/bin":"$HOME/.ghcup/ghc/8.4.3/bin":"$HOME/.ghcup/bin":"$PATH" - export PATH - runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=$HOME/.cabal/store/$(ls $HOME/.cabal/store)/package.db CI.hs --da + run: cabal run exe:ghc-lib-build-tool -- --da if: matrix.os == 'ubuntu' || matrix.os == 'macos' diff --git a/.github/workflows/ghc-lib-ghc-9.10.1-ghc-9.8.2.yml b/.github/workflows/ghc-lib-ghc-9.10.1-ghc-9.8.2.yml index 801f99eb..4a1a49a8 100644 --- a/.github/workflows/ghc-lib-ghc-9.10.1-ghc-9.8.2.yml +++ b/.github/workflows/ghc-lib-ghc-9.10.1-ghc-9.8.2.yml @@ -1,6 +1,7 @@ name: ghc-lib-ghc-9.10.1-ghc-9.8.2 on: push: + pull_request: jobs: runhaskell: name: ${{ matrix.os }} @@ -14,53 +15,36 @@ jobs: - name: Install build tools (macOS) run: brew install automake if: matrix.os == 'macos' - - name: Install msys2 (windows) + - name: Configure msys2 (windows) shell: bash run: |- - cd /c - curl -L https://github.com/commercialhaskell/stackage-content/releases/download/msys2-20230526/msys2-20230526-x86_64.tar.xz -o msys2-20230526-x86_64.tar.xz - tar xvf ./msys2-20230526-x86_64.tar.xz > /dev/null + echo "MSYSTEM=CLANG64" >> $GITHUB_ENV + echo "/c/mingw64/usr/bin" >> $GITHUB_PATH + echo "/c/msys64/usr/bin" >> $GITHUB_PATH if: matrix.os == 'windows' - - name: Install ghcup + - name: Install ghcup (windows) shell: bash run: |- - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \ - BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ - BOOTSTRAP_HASKELL_GHC_VERSION=9.8.2 \ - BOOTSTRAP_HASKELL_CABAL_VERSION=latest \ - BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 \ - BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 \ - BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh - - name: Setup cabal (windows) - shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' - run: |- - PATH=/c/cabal/bin:/c/.ghcup/ghc-9.8.2/bin:/c/.ghcup/bin:$PATH - export PATH - cabal update - cabal install alex happy - cabal --store-dir="c:\\cabal\\store" --lib --force-reinstalls --package-env=- install extra-1.7.16 optparse-applicative-0.18.1.0 + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.8.2 BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh + echo "/c/ghcup/bin" >> $GITHUB_PATH + echo "/c/ghcup/ghc/9.8.2/bin" >> $GITHUB_PATH + echo "/c/cabal/bin" >> $GITHUB_PATH if: matrix.os == 'windows' - - name: Setup cabal(unix) + - name: Install ghcup (unix) shell: bash run: |- - PATH="$HOME/.cabal/bin":"$HOME/.ghcup/ghc/9.8.2/bin":"$HOME/.ghcup/bin":"$PATH" - export PATH - cabal install alex happy - cabal --store-dir=$HOME/.cabal/store --lib --force-reinstalls --package-env=- install extra-1.7.16 optparse-applicative-0.18.1.0 - if: matrix.os == 'ubuntu' || matrix.os == 'macos' + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.8.2 BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh + echo "$HOME/.ghcup/bin" >> $GITHUB_PATH + echo "$HOME/.ghcup/ghc/9.8.2/bin" >> $GITHUB_PATH + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + if: matrix.os == 'ubuntu' || matrix.os == 'macos' - name: Run CI.hs (windows) shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' run: |- - PATH=/c/cabal/bin:/c/ghcup/ghc/9.8.2/bin:/c/ghcup/bin:/c/msys64/usr/bin:/c/mingw64/bin:"/c/program files/git/bin":"$PATH" - export PATH - MSYSTEM=CLANG64; export MSYSTEM pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm - runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=/c/cabal/store/$(ls /c/cabal/store)/package.db CI.hs --ghc-flavor ghc-9.10.1 + cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-9.10.1 if: matrix.os == 'windows' - name: Run CI.hs (unix) shell: bash - run: |- - PATH="$HOME/.cabal/bin":"$HOME/.ghcup/ghc/9.8.2/bin":"$HOME/.ghcup/bin":"$PATH" - export PATH - runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=$HOME/.cabal/store/$(ls $HOME/.cabal/store)/package.db CI.hs --ghc-flavor ghc-9.10.1 + run: cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-9.10.1 if: matrix.os == 'ubuntu' || matrix.os == 'macos' diff --git a/.github/workflows/ghc-lib-ghc-9.8.2-ghc-9.6.5.yml b/.github/workflows/ghc-lib-ghc-9.8.2-ghc-9.6.5.yml index 5562a12f..5bf86747 100644 --- a/.github/workflows/ghc-lib-ghc-9.8.2-ghc-9.6.5.yml +++ b/.github/workflows/ghc-lib-ghc-9.8.2-ghc-9.6.5.yml @@ -1,6 +1,7 @@ name: ghc-lib-ghc-9.8.2-ghc-9.6.5 on: push: + pull_request: jobs: runhaskell: name: ${{ matrix.os }} @@ -14,53 +15,36 @@ jobs: - name: Install build tools (macOS) run: brew install automake if: matrix.os == 'macos' - - name: Install msys2 (windows) + - name: Configure msys2 (windows) shell: bash run: |- - cd /c - curl -L https://github.com/commercialhaskell/stackage-content/releases/download/msys2-20230526/msys2-20230526-x86_64.tar.xz -o msys2-20230526-x86_64.tar.xz - tar xvf ./msys2-20230526-x86_64.tar.xz > /dev/null + echo "MSYSTEM=CLANG64" >> $GITHUB_ENV + echo "/c/mingw64/usr/bin" >> $GITHUB_PATH + echo "/c/msys64/usr/bin" >> $GITHUB_PATH if: matrix.os == 'windows' - - name: Install ghcup + - name: Install ghcup (windows) shell: bash run: |- - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \ - BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ - BOOTSTRAP_HASKELL_GHC_VERSION=9.6.5 \ - BOOTSTRAP_HASKELL_CABAL_VERSION=latest \ - BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 \ - BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 \ - BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh - - name: Setup cabal (windows) - shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' - run: |- - PATH=/c/cabal/bin:/c/.ghcup/ghc-9.6.5/bin:/c/.ghcup/bin:$PATH - export PATH - cabal update - cabal install alex happy - cabal --store-dir="c:\\cabal\\store" --lib --force-reinstalls --package-env=- install extra-1.7.16 optparse-applicative-0.18.1.0 semaphore-compat-1.0.0 + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.6.5 BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh + echo "/c/ghcup/bin" >> $GITHUB_PATH + echo "/c/ghcup/ghc/9.6.5/bin" >> $GITHUB_PATH + echo "/c/cabal/bin" >> $GITHUB_PATH if: matrix.os == 'windows' - - name: Setup cabal(unix) + - name: Install ghcup (unix) shell: bash run: |- - PATH=$HOME/.cabal/bin:$HOME/.ghcup/ghc/9.6.5/bin:$HOME/.ghcup/bin:"$PATH" - export PATH - cabal install alex happy - cabal --store-dir=$HOME/.cabal/store --lib --force-reinstalls --package-env=- install extra-1.7.16 optparse-applicative-0.18.1.0 semaphore-compat-1.0.0 - if: matrix.os == 'ubuntu' || matrix.os == 'macos' + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.6.5 BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh + echo "$HOME/.ghcup/bin" >> $GITHUB_PATH + echo "$HOME/.ghcup/ghc/9.6.5/bin" >> $GITHUB_PATH + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + if: matrix.os == 'ubuntu' || matrix.os == 'macos' - name: Run CI.hs (windows) shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' run: |- - PATH=/c/cabal/bin:/c/ghcup/ghc/9.6.5/bin:/c/ghcup/bin:/c/msys64/usr/bin:/c/mingw64/bin:"/c/program files/git/bin":"$PATH" - export PATH - MSYSTEM=CLANG64; export MSYSTEM pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm - runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=/c/cabal/store/$(ls /c/cabal/store)/package.db CI.hs --ghc-flavor ghc-9.8.2 + cabal run exe:ghc-lib-build-tool --constraint='ghc-lib-gen +semaphore-compat' -- --ghc-flavor ghc-9.8.2 if: matrix.os == 'windows' - name: Run CI.hs (unix) shell: bash - run: |- - PATH="$HOME/.cabal/bin":"$HOME/.ghcup/ghc/9.6.5/bin":"$HOME/.ghcup/bin":"$PATH" - export PATH - runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=$HOME/.cabal/store/$(ls $HOME/.cabal/store)/package.db CI.hs --ghc-flavor ghc-9.8.2 + run: cabal run exe:ghc-lib-build-tool --constraint='ghc-lib-gen +semaphore-compat' -- --ghc-flavor ghc-9.8.2 if: matrix.os == 'ubuntu' || matrix.os == 'macos' diff --git a/.github/workflows/ghc-lib-ghc-master-ghc-9.10.1.yml b/.github/workflows/ghc-lib-ghc-master-ghc-9.10.1.yml index 7cb01544..9f9888cd 100644 --- a/.github/workflows/ghc-lib-ghc-master-ghc-9.10.1.yml +++ b/.github/workflows/ghc-lib-ghc-master-ghc-9.10.1.yml @@ -1,6 +1,7 @@ name: ghc-lib-ghc-master-ghc-9.10.1 on: push: + pull_request: jobs: runhaskell: name: ${{ matrix.os }} @@ -14,53 +15,37 @@ jobs: - name: Install build tools (macOS) run: brew install automake if: matrix.os == 'macos' - - name: Install msys2 (windows) + - name: Configure msys2 (windows) shell: bash run: |- - cd /c - curl -L https://github.com/commercialhaskell/stackage-content/releases/download/msys2-20230526/msys2-20230526-x86_64.tar.xz -o msys2-20230526-x86_64.tar.xz - tar xvf ./msys2-20230526-x86_64.tar.xz > /dev/null + echo "MSYSTEM=CLANG64" >> $GITHUB_ENV + echo "/c/mingw64/usr/bin" >> $GITHUB_PATH + echo "/c/msys64/usr/bin" >> $GITHUB_PATH if: matrix.os == 'windows' - - name: Install ghcup + - name: Install ghcup (windows) shell: bash run: |- - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \ - BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \ - BOOTSTRAP_HASKELL_GHC_VERSION=9.10.1 \ - BOOTSTRAP_HASKELL_CABAL_VERSION=latest \ - BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 \ - BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 \ - BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh - - name: Setup cabal (windows) - shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' - run: |- - PATH=/c/cabal/bin:/c/.ghcup/ghc-9.10.1/bin:/c/.ghcup/bin:$PATH - export PATH - cabal update - cabal install alex happy - cabal --store-dir="c:\\cabal\\store" --lib --force-reinstalls --package-env=- install extra-1.7.16 optparse-applicative-0.18.1.0 + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.10.1 BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh + echo "/c/ghcup/bin" >> $GITHUB_PATH + echo "/c/ghcup/ghc/9.10.1/bin" >> $GITHUB_PATH + echo "/c/cabal/bin" >> $GITHUB_PATH if: matrix.os == 'windows' - - name: Setup cabal(unix) + - name: Install ghcup (unix) shell: bash run: |- - PATH="$HOME/.cabal/bin":"$HOME/.ghcup/ghc/9.10.1/bin":"$HOME/.ghcup/bin":"$PATH" - export PATH - cabal install alex happy - cabal --store-dir=$HOME/.cabal/store --lib --force-reinstalls --package-env=- install extra-1.7.16 optparse-applicative-0.18.1.0 - if: matrix.os == 'ubuntu' || matrix.os == 'macos' + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.10.1 BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh + ls "$HOME"/.ghcup/bin + echo "$HOME/.ghcup/bin" >> $GITHUB_PATH + echo "$HOME/.ghcup/ghc/9.10.1/bin" >> $GITHUB_PATH + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + if: matrix.os == 'ubuntu' || matrix.os == 'macos' - name: Run CI.hs (windows) shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' run: |- - PATH=/c/cabal/bin:/c/ghcup/ghc/9.10.1/bin:/c/ghcup/bin:/c/mingw64/bin:/c/msys64/usr/bin:"/c/program files/git/bin":"$PATH" - export PATH - MSYSTEM=CLANG64; export MSYSTEM pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm - runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=/c/cabal/store/$(ls /c/cabal/store)/package.db CI.hs --ghc-flavor ghc-master + cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-master if: matrix.os == 'windows' - name: Run CI.hs (unix) shell: bash - run: |- - PATH="$HOME/.cabal/bin":"$HOME/.ghcup/ghc/9.10.1/bin":"$HOME/.ghcup/bin":"$PATH" - export PATH - runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=$HOME/.cabal/store/$(ls $HOME/.cabal/store)/package.db CI.hs --ghc-flavor ghc-master + run: cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-master if: matrix.os == 'ubuntu' || matrix.os == 'macos' diff --git a/CI.hs b/CI.hs index 91509d43..278f48ba 100755 --- a/CI.hs +++ b/CI.hs @@ -76,7 +76,7 @@ data DaFlavor = DaFlavor -- Last tested gitlab.haskell.org/ghc/ghc.git at current :: String -current = "41f1354dafe35aa6023d6c2553793208afa3fc31" -- 2024-07-14 +current = "12d3b66cedd3c80e7c1e030238c92d26631cab8d" -- 2024-07-17 -- Command line argument generators. @@ -365,7 +365,6 @@ buildDists pkg_ghclib_parser = "ghc-lib-parser-" ++ version ghcFlavorArg = ghcFlavorOpt ghcFlavor - system_ "cabal update" system_ "cabal build exe:ghc-lib-gen" system_ $ "cabal run exe:ghc-lib-gen -- ghc ../patches --ghc-lib-parser " ++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor ++ " " ++ stackResolverOpt resolver patchVersion version "ghc/ghc-lib-parser.cabal" @@ -412,7 +411,7 @@ buildDists writeFile "cabal.project" ( unlines $ - [ "packages: " + [ "packages: " , " ghc-lib-parser/ghc-lib-parser.cabal" , " ghc-lib/ghc-lib.cabal" , " examples/ghc-lib-test-utils/ghc-lib-test-utils.cabal" @@ -440,7 +439,7 @@ buildDists writeCabalCmdFile exe = do let filename = exe cmd = "cabal run exe:" ++ exe ++ " --project-dir ../.. -- " - writeFile filename cmd + writeFile filename cmd pure filename ghcOptionsWithHaddock :: Maybe String -> String diff --git a/README.md b/README.md index 063a9c1b..fb57116a 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ By far the easist way to produce `ghc-lib-parser` and `ghc-lib` packages is to e # Setup git clone git@github.com:digital-asset/ghc-lib.git cd ghc-lib -stack runhaskell --package extra --package optparse-applicative CI.hs -- --ghc-flavor=ghc-8.8.1 +cabal run exe:ghc-lib-build-tool -- --ghc-flavor=ghc-8.8.1 ``` ## Releasing `ghc-lib` (notes for maintainers) @@ -70,14 +70,13 @@ general case: the `--ghc-flavor` flag is replaced with an "enabling" flag `--da` and three more specific flags. A full call example would be: ``` -stack runhaskell --package extra \ - --package optparse-applicative \ - CI.hs -- --da \ - --merge-base-sha=ghc-8.8.1-release \ - --patch=upstream/da-master-8.8.1 \ - --patch=upstream/da-unit-ids-8.8.1 \ - --gen-flavor=da-ghc-8.8.1 \ - --upstream=https://github.com/digital-asset/ghc.git +cabal run exe:ghc-lib-build-tool -- \ + --da \ + --merge-base-sha=ghc-8.8.1-release \ + --patch=upstream/da-master-8.8.1 \ + --patch=upstream/da-unit-ids-8.8.1 \ + --gen-flavor=da-ghc-8.8.1 \ + --upstream=https://github.com/digital-asset/ghc.git ``` The DAML-specific process only differs from the normal one in that it patches diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index cf66a295..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,212 +0,0 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - -trigger: - batch: false - branches: - include: - - master - -# Enable PR triggers that target the master branch -pr: - autoCancel: true # cancel previous builds on push - branches: - include: - - master - -strategy: - # Limit number of executors used so other pipelines can run too - maxParallel: 10 - matrix: - # Notes: - # Tags are encoded in the following way: - # '-' '-' - # Not every combination is tested - # - We do sampling to keep the number of builds reasonable; - # - Minimum GHC needed to bootstrap: - # +--------------+-------------+ - # | GHC flavor | version | - # +==============+=============+ - # | ghc-8.8.* | >= 8.4.4 | - # | ghc-8.10.* | >= 8.6.5 | - # | ghc-9.0.* | >= 8.8.1 | - # | ghc-9.2.* | >= 8.10.1 | - # | ghc-9.4.1 | >= 9.0.1 | - # | ghc-9.6.2 | >= 9.2.2 | (9.2.1 is invalid) - # | > ghc-9.6.2 | >= 9.2.2 | - # +--------------+-------------+ - # (the general rule is only the last two compiler versions are - # supported). - - # +---------+-----------------+------------+ - # | OS | ghc-lib flavor | GHC | - # +=========+=================+============+ - # | linux | ghc-master | ghc-9.10.1 | - # | macOS | ghc-master | ghc-9.10.1 | - # | windows | ghc-master | ghc-9.10.1 | - # +---------+-----------------+------------+ - linux-ghc-master-9.10.1: - image: "ubuntu-22.04" - mode: "--ghc-flavor ghc-master" - cabal-with-ghc: "9.10.1" - runghc-libs: "extra-1.7.16 optparse-applicative-0.18.1.0 semaphore-compat-1.0.0" - mac-ghc-master-9.10.1: - image: "macOS-latest" - mode: "--ghc-flavor ghc-master" - cabal-with-ghc: "9.10.1" - runghc-libs: "extra-1.7.16 optparse-applicative-0.18.1.0 semaphore-compat-1.0.0" - windows-ghc-master-9.10.1: - image: "windows-latest" - mode: "--ghc-flavor ghc-master" - cabal-with-ghc: "9.10.1" - runghc-libs: "extra-1.7.16 optparse-applicative-0.18.1.0 semaphore-compat-1.0.0" - - # +---------+-----------------+------------+ - # | OS | ghc-lib flavor | GHC | - # +=========+=================+============+ - # | linux | ghc-9.10.1 | ghc-9.8.2 | - # | macOS | ghc-9.10.1 | ghc-9.8.2 | - # | windows | ghc-9.10.1 | ghc-9.8.2 | - # +---------+-----------------+------------+ - linux-ghc-9.10.1-9.8.2: - image: "ubuntu-22.04" - mode: "--ghc-flavor ghc-9.10.1" - cabal-with-ghc: "9.8.2" - runghc-libs: "extra-1.7.16 optparse-applicative-0.18.1.0" - mac-ghc-9.10.1-9.8.2: - image: "macOS-latest" - mode: "--ghc-flavor ghc-9.10.1" - cabal-with-ghc: "9.8.2" - runghc-libs: "extra-1.7.16 optparse-applicative-0.18.1.0" - windows-ghc-9.10.1-9.8.2: - image: "windows-latest" - mode: "--ghc-flavor ghc-9.10.1" - cabal-with-ghc: "9.8.2" - runghc-libs: "extra-1.7.16 optparse-applicative-0.18.1.0" - - # +---------+-----------------+------------+ - # | OS | ghc-lib flavor | GHC | - # +=========+=================+============+ - # | linux | ghc-9.8.2 | ghc-9.6.5 | - # | macOS | ghc-9.8.2 | ghc-9.6.5 | - # | windows | ghc-9.8.2 | ghc-9.6.5 | - # +---------+-----------------+------------+ - linux-ghc-9.8.2-9.6.5: - image: "ubuntu-22.04" - mode: "--ghc-flavor ghc-9.8.2" - cabal-with-ghc: "9.6.5" - runghc-libs: "extra-1.7.16 optparse-applicative-0.18.1.0 semaphore-compat-1.0.0" - mac-ghc-9.8.2-9.6.5: - image: "macOS-latest" - mode: "--ghc-flavor ghc-9.8.2" - cabal-with-ghc: "9.6.5" - runghc-libs: "extra-1.7.16 optparse-applicative-0.18.1.0 semaphore-compat-1.0.0" - windows-ghc-9.8.2-9.6.5: - image: "windows-latest" - mode: "--ghc-flavor ghc-9.8.2" - cabal-with-ghc: "9.6.5" - runghc-libs: "extra-1.7.16 optparse-applicative-0.18.1.0 semaphore-compat-1.0.0" - - # +---------+-----------------+------------+ - # | OS | ghc-lib flavor | GHC | - # +=========+=================+============+ - # | linux | da-ghc-8.8.1 | ghc-8.4.3 | - # | windows | da-ghc-8.8.1 | ghc-8.4.3 | - # | macOS | da-ghc-8.8.1 | ghc-8.4.3 | - # +---------+-----------------+------------+ - linux-da-ghc-8.8.1-8.4.3: - image: "ubuntu-22.04" - mode: "--da" - cabal-with-ghc: "8.4.3" - runghc-libs: "extra-1.6.13 optparse-applicative-0.14.3.0" - windows-da-ghc-8.8.1-8.4.3: - image: "windows-latest" - mode: "--da" - cabal-with-ghc: "8.4.3" - runghc-libs: "extra-1.6.13 optparse-applicative-0.14.3.0" - mac-da-ghc-8.8.1-8.4.3: - image: "macOS-latest" - mode: "--da" - cabal-with-ghc: "8.4.3" - runghc-libs: "extra-1.6.13 optparse-applicative-0.14.3.0" - -pool: {vmImage: '$(image)'} - -steps: - - bash: | - if [ -d patches ]; then - /usr/bin/find patches -name "*.patch" -exec dos2unix {} \; - fi - condition: eq( variables['Agent.OS'], 'Windows_NT' ) - - bash: | - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - brew install automake - condition: eq( variables['Agent.OS'], 'Darwin' ) - displayName: install automate (macos) - - bash: | - curl -L https://github.com/commercialhaskell/stackage-content/releases/download/msys2-20230526/msys2-20230526-x86_64.tar.xz -o msys2-20230526-x86_64.tar.xz - tar xvf msys2-20230526-x86_64.tar.xz > /dev/null - GHCUP_MSYS2=$(pwd)/msys64 - PATH="$GHCUP_MSYS2"/usr/bin:/c/mingw64/bin:"/c/program files/git/bin":"$PATH" - export PATH - $GHCUP_MSYS2/usr/bin/bash --noprofile --norc -e -o pipefail -c "pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm" - condition: eq( variables['Agent.OS'], 'Windows_NT' ) - displayName: install msys2 - - bash: | - curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=$(cabal-with-ghc) BOOTSTRAP_HASKELL_CABAL_VERSION=latest BOOTSTRAP_HASKELL_INSTALL_NO_STACK=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=N sh - displayName: install ghcup - - bash: | - set -euo pipefail - - version=$(curl -Is https://github.com/ndmitchell/hlint/releases/latest | grep location: | sed 's|.*/||' | tr -d '\n\r') - echo "VERSION: $version" - - temp=$(mktemp -d) - curl -sSL https://github.com/ndmitchell/hlint/releases/download/$version/hlint-${version#v}-x86_64-linux.tar.gz > $temp/tarball - - tar -xzf $temp/tarball -C$temp - - hlint() ( - echo - echo DEBUG: hlint "$@" - $temp/hlint-${version#v}/hlint "$@" - ) - hlint CI.hs - hlint ghc-lib-gen - hlint examples/ghc-lib-test-utils/src - series=( GHC_8_8 GHC_8_10 GHC_9_0 GHC_9_2 GHC_9_4 GHC_9_6 GHC_9_8 GHC_9_10 ) - for s in "${series[@]}"; do - hlint examples/ghc-lib-test-mini-hlint/src --cpp-include examples/ghc-lib-test-mini-hlint/extra-source-files --cpp-define "$s" - hlint examples/ghc-lib-test-mini-compile/src --cpp-include examples/ghc-lib-test-mini-compile/extra-source-files --cpp-define "$s" - done - displayName: run hlint - condition: eq( variables['Agent.OS'], 'Linux' ) - - bash: | - PATH=/c/cabal/bin:/c/.ghcup/ghc-$(cabal-with-ghc)/bin:/c/.ghcup/bin:$PATH - export PATH - cabal install alex happy - cabal --store-dir="c:\\cabal\\store" --lib --force-reinstalls --package-env=- install $(runghc-libs) - condition: eq( variables['Agent.OS'], 'Windows_NT' ) - displayName: setup cabal (windows) - - bash: | - PATH=$HOME/.cabal/bin:$HOME/.ghcup/ghc/9.6.5/bin:$HOME/.ghcup/bin:"$GHCUP_MSYS2"/usr/bin:/c/mingw64/bin:"/c/program files/git/bin":"$PATH" - export PATH - cabal install alex happy - cabal --store-dir=$HOME/.cabal/store --lib --force-reinstalls --package-env=- install $(runghc-libs) - condition: or(eq(variables['Agent.OS'], 'Darwin'), eq(variables['Agent.OS'], 'Linux')) - displayName: setup cabal (unix) - - bash: | - GHCUP_MSYS2=$(pwd)/msys64; - PATH=/c/cabal/bin:/c/ghcup/ghc/$(cabal-with-ghc)/bin:/c/ghcup/bin:"$GHCUP_MSYS2"/usr/bin:/c/mingw64/bin:"/c/program files/git/bin":"$PATH" - export PATH - $GHCUP_MSYS2/usr/bin/bash --noprofile --norc -e -o pipefail -c "runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=/c/cabal/store/$(ls /c/cabal/store)/package.db CI.hs $(mode)" - condition: eq( variables['Agent.OS'], 'Windows_NT' ) - displayName: run CI.hs (windows) - - bash: | - PATH="$HOME/.cabal/bin":"$HOME/.ghcup/ghc/$(cabal-with-ghc)/bin":"$HOME/.ghcup/bin":"$PATH" - export PATH - runghc --ghc-arg=-clear-package-db --ghc-arg=-global-package-db --ghc-arg=-user-package-db --ghc-arg=-package-db --ghc-arg=$HOME/.cabal/store/$(ls $HOME/.cabal/store)/package.db CI.hs $(mode) - condition: or(eq(variables['Agent.OS'], 'Darwin'), eq(variables['Agent.OS'], 'Linux')) - displayName: run CI.hs (unix) diff --git a/ghc-lib-gen.cabal b/ghc-lib-gen.cabal index 979474a8..30d7e3f3 100644 --- a/ghc-lib-gen.cabal +++ b/ghc-lib-gen.cabal @@ -13,6 +13,11 @@ copyright: Digital Asset 2018-2024 category: Development build-type: Simple +flag semaphore-compat + default: False + manual: True + description: Install semaphore-compat from Hackage + common base default-language: Haskell2010 ghc-options: @@ -31,16 +36,26 @@ common lib library import: lib hs-source-dirs: ghc-lib-gen/src - exposed-modules: Ghclibgen - GhclibgenFlavor - GhclibgenOpts + exposed-modules: + Ghclibgen + GhclibgenFlavor + GhclibgenOpts other-modules: Paths_ghc_lib_gen autogen-modules: Paths_ghc_lib_gen -common cli - import: base - build-depends: directory, optparse-applicative, ghc-lib-gen - executable ghc-lib-gen - import: cli + import: base + build-depends: + directory, optparse-applicative, ghc-lib-gen + if flag(semaphore-compat) + build-depends: semaphore-compat main-is: ghc-lib-gen/src/Main.hs + +executable ghc-lib-build-tool + import: base + build-tool-depends: alex:alex, happy:happy + build-depends: + directory, filepath, time, extra, optparse-applicative + if flag(semaphore-compat) + build-depends: semaphore-compat + main-is: CI.hs diff --git a/ghc-lib-gen/src/Ghclibgen.hs b/ghc-lib-gen/src/Ghclibgen.hs index 67d0741c..7ddd8982 100644 --- a/ghc-lib-gen/src/Ghclibgen.hs +++ b/ghc-lib-gen/src/Ghclibgen.hs @@ -288,11 +288,14 @@ ghcNumericVersion = do systemOutput_ "bash -c \"echo -n $(ghc --numeric-version)\"" cabalPackageDb :: String -> IO String -cabalPackageDb _ghcNumericVersion = do - if isWindows then - systemOutput_ "bash -c \"echo -n /c/cabal/store/$(ls /c/cabal/store | grep $(ghc --numeric-version))/package.db\"" - else - systemOutput_ "bash -c \"echo -n $HOME/.cabal/store/$(ls $HOME/.cabal/store | grep $(ghc --numeric-version))/package.db\"" +cabalPackageDb ghcNumericVersion = do + cabalStoreDir <- + if not isWindows then + systemOutput_ "bash -c \"cabal path --store-dir\"" + else + systemOutput_ "bash -c \"echo -n $(cygpath -u $(cabal path --store-dir))\"" + ghcDir <- systemOutput_ $ "bash -c \"echo -n $(ls " ++ cabalStoreDir ++ " | grep " ++ ghcNumericVersion ++ ")\"" + pure $ cabalStoreDir ++ "/" ++ ghcDir ++ "/package.db" ghcPackagePath :: String -> String -> IO String ghcPackagePath cabalPackageDb ghcNumericVersion = @@ -349,18 +352,11 @@ calcModuleDeps includeDirs _hsSrcDirs hsSrcIncludes ghcFlavor ghcPackagePath sem , "-package base" ] ++ [ "-package exceptions" | series == GHC_9_0 ] ++ - [ flag | series >= GHC_9_8 - , not semaphoreCompatBootExists - , flag <- - [ "-ignore-package os-string" ] ++ - [ "-package filepath" ]++ - [ "-package " ++ if not isWindows then "unix" else "Win32" ] - ] ++ - ["-package semaphore-compat" | series >= GHC_9_8] ++ + [ "-package semaphore-compat" | series >= GHC_9_8 ] ++ hsSrcIncludes ++ [ rootModulePath ] cmd' = - if semaphoreCompatBootExists then + if series < GHC_9_8 || semaphoreCompatBootExists then cmd else "bash -c \"" ++ ghcPackagePath ++ " " ++ cmd ++ "\""