Skip to content

Commit

Permalink
Add support for ghc 9.0.2 (#2567)
Browse files Browse the repository at this point in the history
* Extract out ci build setup

* Add required shell property

* Add support for ghc-9.0.2

* Test ghc 9.0.2

* Add unix boot package

* Use primitive-unlifted < 1.0

* Use primitive-unlifted < 1.0 for stack

* Ude 9.0.1 for hackage

We cant use 9.0.2 until all deps do not need allow-newer

* Use a unified cabal-ghc90.project

And bump up index state to get lastest hie-bios

* Use last snapshot with ghc-9.0.2 support

* Use new cabal-ghc90.project in build

* Add stm-containers

* Add specific tweaks for ghc-9.0.2

* Use the las ghc-boot-9.0

* Fix test adding allow-newer

Co-Authored-By: @michaelpj

* Use unix-compat from hackage

* Use unix-compat from hackage

* Make consistent lastest stack.yamls

* Clean up cabal.project

* more cleanups

* Update tweaks in hackage ci

* Correct comment

* Correct fourmolu condition

* Correct fourmolu condition in tests

* Removing the all target from caching

It builds all project packages even if we they are not buildables
(and are not included in hls due to flags)
Its goal was build all tests and benchmarks but --enable-tests
ans --enable-benchmarks should work
Last one does not: haskell/cabal#6259

* exclude Brittany 0.14.0.1

* Update snapshot to get new lsp

* document flag

* Document and build ghcide benchmark

* Doc and use ghc-9.0.2 in hackage

* Add ghc-9.2.1 to tested-with

* Use 9.0.2 in gitlab

* Use last *molus

* Use same versions as cabal build

* Use cabal freeze versions

* Add dep for ghcide tests

* one by one

* Unnecessary change

* Remove unnecessary flag

* Corrections

* Move blocks

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
jneira and mergify[bot] committed Jan 17, 2022
1 parent b01a94a commit 3f46851
Show file tree
Hide file tree
Showing 19 changed files with 246 additions and 101 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Expand Up @@ -100,6 +100,11 @@ jobs:
- STACK_FILE: "stack-9.0.1.yaml"
<<: *defaults

ghc-9.0.2:
environment:
- STACK_FILE: "stack-9.0.2.yaml"
<<: *defaults

ghc-default:
environment:
- STACK_FILE: "stack.yaml"
Expand All @@ -115,4 +120,5 @@ workflows:
- ghc-8.10.6
- ghc-8.10.7
- ghc-9.0.1
- ghc-9.0.2
- ghc-default
11 changes: 8 additions & 3 deletions .github/actions/setup-build/action.yml
Expand Up @@ -26,6 +26,7 @@ runs:
run: |
echo "CABAL_PKGS_DIR=C:\\cabal\\packages" >> $GITHUB_ENV
shell: bash

- if: ( inputs.os == 'Linux' ) || ( inputs.os == 'macOS' )
name: (Linux,macOS) Platform config
run: |
Expand All @@ -43,9 +44,13 @@ runs:
# (most probably sticky bit is set on $HOME)
# `&&` insures `rm -f` return is positive.
# Many platforms aslo have `alias cp='cp -i'`.
ALT_PROJECT_FILE=cabal-ghc${GHCVER//./}.project
if [[ -f "$ALT_PROJECT_FILE" ]]; then
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE" cabal.project
GHCVER2=${GHCVER//./}
ALT_PROJECT_FILE_MINOR=cabal-ghc${GHCVER2}.project
ALT_PROJECT_FILE_MAJOR=cabal-ghc${GHCVER2:0:2}.project
if [[ -f "$ALT_PROJECT_FILE_MINOR" ]]; then
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MINOR" cabal.project
elif [[ -f "$ALT_PROJECT_FILE_MAJOR" ]]; then
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MAJOR" cabal.project
fi
shell: bash

Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/build.yml
Expand Up @@ -20,6 +20,7 @@ jobs:
matrix:
ghc:
[ "9.2.1"
, "9.0.2"
, "9.0.1"
, "8.10.7"
, "8.10.6"
Expand Down Expand Up @@ -54,12 +55,18 @@ jobs:
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
fi
- name: (GHC 9.0) Use modified cabal.project for GHC 9.0
if: ${{ matrix.ghc == '9.0.1' }}
run: cp cabal-ghc901.project cabal.project
- name: Use modified cabal.project for ghc9.2
if: ${{ matrix.ghc == '9.2.1' }}
run: cp cabal-ghc921.project cabal.project
- name: Use modified cabal.project
env:
GHCVER: ${{ matrix.ghc }}
run: |
GHCVER2=${GHCVER//./}
ALT_PROJECT_FILE_MINOR=cabal-ghc${GHCVER2}.project
ALT_PROJECT_FILE_MAJOR=cabal-ghc${GHCVER2:0:2}.project
if [[ -f "$ALT_PROJECT_FILE_MINOR" ]]; then
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MINOR" cabal.project
elif [[ -f "$ALT_PROJECT_FILE_MAJOR" ]]; then
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MAJOR" cabal.project
fi
- name: Shorten binary names
run: |
Expand Down
35 changes: 20 additions & 15 deletions .github/workflows/caching.yml
Expand Up @@ -44,8 +44,10 @@ on:
# & so it gets shared across all PRs.
- cron: "25 2/8 * * *"

# Not using a explicit target to build the top level haskell-language-server package
# which make build the rest of subpackages *libs* (but shake-bench)
env:
cabalBuild: "v2-build all --keep-going"
cabalBuild: "v2-build --keep-going"

jobs:

Expand Down Expand Up @@ -77,6 +79,7 @@ jobs:
fail-fast: false
matrix:
ghc: [ "9.2.1"
, "9.0.2"
, "9.0.1"
, "8.10.7"
, "8.10.6"
Expand All @@ -96,24 +99,26 @@ jobs:
ghc: ${{ matrix.ghc }}
os: ${{ runner.os }}

# Download sources for feeding build sources cache
# Fetching from github cache is faster than doing it from hackage
# Sources does not change per ghc and ghc version son only doing it
# for one matrix job (it is arbitrary)
- if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7'
name: Download sources for bench
# Downloaded separately, to match the tested work/PR workflow guarantees
name: Download sources
run: |
cabal $cabalBuild --only-download --enable-benchmarks
cabal $cabalBuild --only-download --enable-benchmarks --enable-tests
# This build agenda is not to have successful code but produce cache as much as possible
- if: steps.compiled-deps.outputs.cache-hit != 'true'
name: Download the rest of the sources
# Downloaded separately, to match the tested work/PR workflow guarantees
name: Build haskell-language-server
run: |
cabal $cabalBuild --only-download --enable-tests
# repeating builds to workaround segfaults in windows and ghc-8.8.4
cabal $cabalBuild || cabal $cabalBuild || cabal $cabalBuild
# repeating builds to workaround segfaults in windows and ghc-8.8.4
# This build agenda in not to have successful code,
# but to cache what can be cached, so step is fault tolerant & would always succseed.
# 2021-12-11: NOTE: Building all targets, since
# current Cabal does not allow `all --enable-tests --enable-benchmarks --only-dependencies`
- if: steps.compiled-deps.outputs.cache-hit != 'true'
name: Build all targets; try 3 times
# We build ghcide with benchs and test enabled to include its dependencies in the cache
# (including shake-bench)
# Only for the same ghc and os used in the bench workflow, so we save cache space
- if: steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7'
name: Build ghcide benchmark
run: |
cabal $cabalBuild || cabal $cabalBuild || cabal $cabalBuild
cabal $cabalBuild ghcide --enable-benchmarks --enable-tests
40 changes: 16 additions & 24 deletions .github/workflows/hackage.yml
Expand Up @@ -34,18 +34,15 @@ jobs:
"hls-call-hierarchy-plugin", "hls-alternate-number-format-plugin",
"hls-qualify-imported-names-plugin",
"haskell-language-server"]
ghc: [ "9.0.1",
"8.10.7",
"8.8.4",
"8.6.5"]
ghc: [ "9.0.2"
, "8.10.7"
, "8.8.4"
, "8.6.5"
]
exclude:
- ghc: "9.0.1"
package: "hls-brittany-plugin"
- ghc: "9.0.1"
- ghc: "9.0.2"
package: "hls-stylish-haskell-plugin"
- ghc: "9.0.1"
package: "hls-class-plugin"
- ghc: "9.0.1"
- ghc: "9.0.2"
package: "hls-tactics-plugin"

steps:
Expand Down Expand Up @@ -103,22 +100,18 @@ jobs:
cd $(ls -d ./incoming/${{ matrix.package }}-*)
echo "packages: . ../../* ../../plugins/*" > cabal.project
- name: "Add temporary needed allow-newer"
if: steps.get-hackage-version.outputs.exists != 'true'
run: |
# TODO: remove when not needed
cd $(ls -d ./incoming/${{ matrix.package }}-*)
echo "allow-newer: Chart-diagrams:diagrams-core, SVGFonts:diagrams-core," >> cabal.project
# These tweaks are already in cabal-901.project but we dont want to use the entire file,
# Only the tricks needed by the solver which we know will not make the hackage build fail.
# The solver takes in account all project packages, even if they are not gonna be effectively built
# (like brittany or stylish-haskell for ghc-9.0)
- name: "Add temporary needed allow-newer for ghc-9.0"
if: steps.get-hackage-version.outputs.exists != 'true' && matrix.ghc == '9.0.1'
if: steps.get-hackage-version.outputs.exists != 'true' && matrix.ghc == '9.0.2'
run: |
# TODO: remove when not needed
cd $(ls -d ./incoming/${{ matrix.package }}-*)
# For brittany
echo " brittany:base, brittany:ghc, brittany:ghc-boot-th, butcher:base, multistate:base, data-tree-print:base," >> cabal.project
# For floskell and stylish-haskell
echo " floskell:base, floskell:ghc-prim, stylish-haskell:Cabal,stylish-haskell:ghc-lib-parser," >> cabal.project
echo " butcher:base, multistate:base, data-tree-print:base," >> cabal.project
# For stylish-haskell
echo " stylish-haskell:Cabal,stylish-haskell:ghc-lib-parser,stylish-haskell:aeson" >> cabal.project
- name: "Build main package components in isolation"
if: steps.get-hackage-version.outputs.exists != 'true'
Expand All @@ -130,8 +123,7 @@ jobs:
if: steps.get-hackage-version.outputs.exists != 'true'
run: |
cd $(ls -d ./incoming/${{ matrix.package }}-*)
# cabal-3.4.0.0 run out of backjumps with tests and benchs enabled
cabal build --enable-tests --enable-benchmarks --max-backjumps 8000
cabal build --enable-tests --enable-benchmarks
- name: "Generate haddock for hackage"
if: steps.get-hackage-version.outputs.exists != 'true'
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/test.yml
Expand Up @@ -57,6 +57,7 @@ jobs:
fail-fast: true
matrix:
ghc: [ "9.2.1"
, "9.0.2"
, "9.0.1"
, "8.10.7"
, "8.10.6"
Expand All @@ -72,7 +73,7 @@ jobs:
ghc: '9.2.1'
test: true
- os: ubuntu-latest
ghc: '9.0.1'
ghc: '9.0.2'
test: true
- os: ubuntu-latest
ghc: '8.10.7'
Expand All @@ -87,14 +88,21 @@ jobs:
ghc: '9.2.1'
test: true
- os: windows-latest
ghc: '9.0.1'
ghc: '9.0.2'
test: true
- os: windows-latest
ghc: '8.10.7'
test: true
- os: windows-latest
ghc: '8.6.5'
test: true
# only build rest of supported ghc versions for windows
- os: windows-latest
ghc: '9.0.1'
- os: windows-latest
ghc: '8.10.6'
- os: windows-latest
ghc: '8.8.4'

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -174,7 +182,7 @@ jobs:
name: Test hls-splice-plugin
run: cabal test hls-splice-plugin --test-options="$TEST_OPTS" || cabal test hls-splice-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-splice-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.2.1'
- if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.0.2' && matrix.ghc != '9.2.1'
name: Test hls-stylish-haskell-plugin
run: cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS" || cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS"

Expand All @@ -186,7 +194,7 @@ jobs:
name: Test hls-fourmolu-plugin
run: cabal test hls-fourmolu-plugin --test-options="$TEST_OPTS" || cabal test hls-fourmolu-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-fourmolu-plugin --test-options="$TEST_OPTS"

- if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.2.1' && !(matrix.os == 'ubuntu-latest' && matrix.ghc == '8.6.5')
- if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.0.2' && matrix.ghc != '9.2.1' && !(matrix.os == 'ubuntu-latest' && matrix.ghc == '8.6.5')
name: Test hls-tactics-plugin test suite
run: cabal test hls-tactics-plugin --test-options="$TEST_OPTS" || cabal test hls-tactics-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-tactics-plugin --test-options="$TEST_OPTS"

Expand Down
5 changes: 2 additions & 3 deletions .gitlab-ci.yml
Expand Up @@ -16,8 +16,8 @@ variables:
CABAL_PROJECT: cabal.project
- GHC_VERSION: 8.10.7
CABAL_PROJECT: cabal.project
- GHC_VERSION: 9.0.1
CABAL_PROJECT: cabal-ghc901.project
- GHC_VERSION: 9.0.2
CABAL_PROJECT: cabal-ghc90.project

.m1_matrix: &m1_matrix
matrix:
Expand Down Expand Up @@ -284,4 +284,3 @@ tar-x86_64-windows:
variables:
TARBALL_ARCHIVE_SUFFIX: x86_64-windows
TARBALL_EXT: zip

29 changes: 14 additions & 15 deletions cabal-ghc901.project → cabal-ghc90.project
Expand Up @@ -27,8 +27,6 @@ packages:
./plugins/hls-call-hierarchy-plugin
./plugins/hls-alternate-number-format-plugin

with-compiler: ghc-9.0.1

tests: true

package *
Expand All @@ -37,7 +35,7 @@ package *

write-ghc-environment-files: never

index-state: 2022-01-10T17:57:05Z
index-state: 2022-01-11T22:05:45Z

constraints:
-- These plugins don't work on GHC9 yet
Expand All @@ -49,17 +47,18 @@ constraints:
-- this way we track explicitly all transitive dependencies which need support for ghc-9
allow-newer:

-- brittany: update ghc bounds in hls.cabal when those are removed
-- https://github.com/lspitzner/multistate/pull/8
multistate:base,
-- https://github.com/lspitzner/data-tree-print/pull/3
data-tree-print:base,
-- https://github.com/lspitzner/butcher/pull/8
butcher:base,
-- brittany: update ghc bounds in hls.cabal when those are removed
-- https://github.com/lspitzner/multistate/pull/8
multistate:base,
-- https://github.com/lspitzner/data-tree-print/pull/3
data-tree-print:base,
-- https://github.com/lspitzner/butcher/pull/8
butcher:base,

stylish-haskell:Cabal,
stylish-haskell:ghc-lib-parser,
stylish-haskell:aeson,
stylish-haskell:Cabal,
stylish-haskell:ghc-lib-parser,
stylish-haskell:aeson,

floskell:base,
floskell:ghc-prim,
-- ghc-9.0.2 specific
-- for ghcide:test via ghc-typelits-knownnat
ghc-typelits-natnormalise:ghc-bignum
2 changes: 1 addition & 1 deletion cabal.project
Expand Up @@ -40,7 +40,7 @@ package *

write-ghc-environment-files: never

index-state: 2022-01-10T17:57:05Z
index-state: 2022-01-11T22:05:45Z

constraints:
hyphenation +embed
Expand Down
3 changes: 2 additions & 1 deletion docs/supported-versions.md
Expand Up @@ -6,7 +6,8 @@ The current support for different GHC versions is given in the following table.

| GHC version | Last supporting HLS version | Deprecation status |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| 9.2.0 | incoming [partial](https://github.com/haskell/haskell-language-server/issues/2179) | |
| 9.2.0 | incoming [partial](https://github.com/haskell/haskell-language-server/issues/2179) | |
| 9.0.2 | [current](https://github.com/haskell/haskell-language-server/releases/latest) ([partial](https://github.com/haskell/haskell-language-server/issues/297)) | |
| 9.0.1 | [current](https://github.com/haskell/haskell-language-server/releases/latest) ([partial](https://github.com/haskell/haskell-language-server/issues/297)) | |
| 8.10.7 | [current](https://github.com/haskell/haskell-language-server/releases/latest) | |
| 8.10.6 | [current](https://github.com/haskell/haskell-language-server/releases/latest) | will be deprecated after LTS and HLS full support for ghc-9.0 |
Expand Down
2 changes: 1 addition & 1 deletion ghcide/ghcide.cabal
Expand Up @@ -13,7 +13,7 @@ description:
A library for building Haskell IDE's on top of the GHC API.
homepage: https://github.com/haskell/haskell-language-server/tree/master/ghcide#readme
bug-reports: https://github.com/haskell/haskell-language-server/issues
tested-with: GHC == 8.6.5 || == 8.8.4 || == 8.10.6 || == 8.10.7 || == 9.0.1
tested-with: GHC == 8.6.5 || == 8.8.4 || == 8.10.6 || == 8.10.7 || == 9.0.1 || == 9.0.2 || == 9.2.1
extra-source-files: README.md CHANGELOG.md
test/data/**/*.project
test/data/**/*.cabal
Expand Down
3 changes: 3 additions & 0 deletions ghcide/test/data/plugin-knownnat/cabal.project
@@ -1 +1,4 @@
packages: .

-- Needed for ghc >= 9.0.2 and ghc-typelits-natnormalise == 0.7.6
allow-newer: ghc-typelits-natnormalise:ghc-bignum
2 changes: 1 addition & 1 deletion ghcide/test/exe/Main.hs
Expand Up @@ -590,7 +590,7 @@ diagnosticTests = testGroup "diagnostics"
]
_ <- createDoc "Foo.hs" "haskell" fooContent
if ghcVersion >= GHC90 then
-- Haddock parse errors are ignored on ghc-9.0.1
-- Haddock parse errors are ignored on ghc-9.0
pure ()
else
expectDiagnostics
Expand Down
7 changes: 5 additions & 2 deletions haskell-language-server.cabal
Expand Up @@ -14,7 +14,7 @@ copyright: The Haskell IDE Team
license: Apache-2.0
license-file: LICENSE
build-type: Simple
tested-with: GHC == 8.6.5 || == 8.8.4 || == 8.10.6 || == 8.10.7 || == 9.0.1
tested-with: GHC == 8.6.5 || == 8.8.4 || == 8.10.6 || == 8.10.7 || == 9.0.1 || == 9.0.2 || == 9.2.1
extra-source-files:
README.md
ChangeLog.md
Expand Down Expand Up @@ -93,6 +93,9 @@ library
-- - Bulk flags should be default:False
-- - Individual flags should be default:True

-- The intent of this flag is being able to keep the ghc condition for hackage
-- but skip it via flags in cabal.project as plugins for new ghcs usually
-- are buildable using cabal.project tweaks
flag ignore-plugins-ghc-bounds
description: Force the inclusion of plugins even if they are not buildable by default with a specific ghc version
default: False
Expand Down Expand Up @@ -475,7 +478,7 @@ test-suite func-test
-- formatters
if flag(floskell) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
cpp-options: -Dfloskell
if flag(fourmolu) && flag(ignore-plugins-ghc-bounds)
if flag(fourmolu)
cpp-options: -Dfourmolu
if flag(ormolu)
cpp-options: -Dormolu
Expand Down

0 comments on commit 3f46851

Please sign in to comment.