Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghc 9.8 upgrade #1460

Merged
merged 28 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
192e7b2
Bump cabal index state.
csasarak Jul 12, 2024
aa84509
Make tls/crypton work.
csasarak Jul 15, 2024
6d85b77
Thread a connection manager which allows EMS around.
csasarak Jul 15, 2024
479ae0f
Merge remote-tracking branch 'origin/master' into bump-cabal-index-state
csasarak Jul 18, 2024
d55ca7d
Merge branch 'master' into bump-cabal-index-state
csasarak Jul 19, 2024
400ea03
Bump again.
csasarak Jul 23, 2024
92a58ac
Merge remote-tracking branch 'origin/master' into bump-cabal-index-state
csasarak Aug 14, 2024
e76c47e
Another bump.
csasarak Aug 14, 2024
8783204
Merge branch 'master' into bump-cabal-index-state
csasarak Aug 14, 2024
580d7ef
Commentary for reverting the AllowEMS change.
csasarak Aug 15, 2024
452ed82
Make fourmolu happy.
csasarak Aug 15, 2024
13147f8
Bump versions/packages for compatibility with GHC 9.8.
csasarak Aug 15, 2024
04a2e53
Fmt fix...
csasarak Aug 15, 2024
7aeac99
Compatible liftA2
csasarak Aug 15, 2024
d9c3fe6
Format 😢
csasarak Aug 15, 2024
665781c
Attempt a build. Still need to do haskell-dev-tools eventually.
csasarak Aug 16, 2024
942a5d6
Turn x-partial into a warning for unit tests.
csasarak Aug 16, 2024
8dab111
Attempt to addressing breaking warnings/errors.
csasarak Aug 16, 2024
be72e25
Turn off the new x-partial warnings.
csasarak Aug 16, 2024
c19ea7a
Format cabal file.
csasarak Aug 16, 2024
0cf7413
Merge remote-tracking branch 'origin/master' into ghc-9.8-upgrade
csasarak Aug 16, 2024
68fed31
Update docs, workflows and makefiles to use ghc-9.8.
csasarak Aug 16, 2024
1b50a56
Merge remote-tracking branch 'origin/master' into ghc-9.8-upgrade
csasarak Aug 16, 2024
d445aa2
Lint with new haskell-dev-tools.
csasarak Aug 16, 2024
4b7600b
Merge remote-tracking branch 'origin/master' into ghc-9.8-upgrade
csasarak Aug 16, 2024
13ef532
Make a release.
csasarak Aug 19, 2024
2bd61bb
learnyouahaskell.com seems to be down.
csasarak Aug 19, 2024
83301aa
Fix benches.
csasarak Aug 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
benchmarks:
name: benchmarks
runs-on: ubuntu-latest
container: fossa/haskell-static-alpine:ghc-9.4.8
container: fossa/haskell-static-alpine:ghc-9.8.2

steps:
- uses: dtolnay/rust-toolchain@stable
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
GHC_VERSION: '9.4.8'
GHC_VERSION: '9.8.2'


defaults:
Expand All @@ -23,25 +23,25 @@ jobs:
include:
- os: ubuntu-latest
os-name: Linux
container: fossa/haskell-static-alpine:ghc-9.4.8
container: fossa/haskell-static-alpine:ghc-9.8.2
project-file: cabal.project.ci.linux
ghc: '9.4.8'
ghc: '9.8.2'

# macos-latest pointed at macos-12 this before it was changed to ARM.
- os: macos-12
os-name: macOS-intel
project-file: cabal.project.ci.macos
ghc: '9.4.8'
ghc: '9.8.2'

- os: windows-latest
os-name: Windows
project-file: cabal.project.ci.windows
ghc: '9.4.8'
ghc: '9.8.2'

- os: macos-latest
os-name: macOS-arm64
project-file: cabal.project.ci.macos
ghc: '9.4.8'
ghc: '9.8.2'

steps:

Expand All @@ -62,7 +62,7 @@ jobs:
if: ${{ !contains(matrix.os, 'ubuntu') }}
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.10.2.1'
cabal-version: '3.10.3.0'

# Set up Rust.
# This action installs the 'minimal' profile.
Expand Down Expand Up @@ -315,8 +315,8 @@ jobs:
echo ${GITHUB_SHA:0:12}

VERSION=$(echo $(Linux-binaries/fossa --version))
EXPECTED="fossa-cli version ${{ steps.get-version.outputs.VERSION }} (revision ${GITHUB_SHA:0:12} compiled with ghc-9.4)"
echo " VERSION: $VERSION"
EXPECTED="fossa-cli version ${{ steps.get-version.outputs.VERSION }} (revision ${GITHUB_SHA:0:12} compiled with ghc-9.8)"
echo "VERSION: $VERSION"
echo "EXPECTED: $EXPECTED"

[ "$GITHUB_REF_TYPE" = "tag" ] && echo "Ref type OK"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integrations-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
name: integration-test
runs-on: "fossa-cli-integration-runner"
# Be sure to update the env below too
container: fossa/haskell-static-alpine:ghc-9.4.8
container: fossa/haskell-static-alpine:ghc-9.8.2

env:
GHC_VERSION: '9.4.8'
GHC_VERSION: '9.8.2'

steps:
- uses: dtolnay/rust-toolchain@stable
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
linter-check:
name: linter-check
runs-on: ubuntu-latest
container: ghcr.io/fossas/haskell-dev-tools:9.4.8
container: ghcr.io/fossas/haskell-dev-tools:9.8.2

steps:
- uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
format-check:
name: formatter-check
runs-on: ubuntu-latest
container: ghcr.io/fossas/haskell-dev-tools:9.4.8
container: ghcr.io/fossas/haskell-dev-tools:9.8.2

steps:
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -56,7 +56,7 @@ jobs:
cabal-format-check:
name: cabal-format-check
runs-on: ubuntu-latest
container: ghcr.io/fossas/haskell-dev-tools:9.4.8
container: ghcr.io/fossas/haskell-dev-tools:9.8.2

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# FOSSA CLI Changelog

## Unreleased
## 3.9.31

- Resolve an issue parsing toml configuration files. ([#1459](https://github.com/fossas/fossa-cli/pull/1459))
- Gradle: ignore deprecated configurations ([#1457](https://github.com/fossas/fossa-cli/pull/1457))
- Upgrade the GHC we use to build the CLI. ([#1460](https://github.com/fossas/fossa-cli/pull/1460))

## 3.9.30

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ current_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

FMT_OPTS := -co -XTypeApplications -o -XImportQualifiedPost
FIND_OPTS := src test integration-test -type f -name '*.hs'
GHC_VERSION := 9.4.8
GHC_VERSION := 9.8.2
DEV_TOOLS := ghcr.io/fossas/haskell-dev-tools:${GHC_VERSION}
MOUNTED_DEV_TOOLS_OPTS := --rm
MOUNTED_DEV_TOOLS_OPTS += --mount "type=bind,source=${current_dir},target=/fossa-cli"
Expand Down
2 changes: 1 addition & 1 deletion cabal.project.ci.linux
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ packages: .
import: ./cabal.project.common

package spectrometer
ghc-options: -Werror
ghc-options: -Werror -Wwarn=x-partial
2 changes: 1 addition & 1 deletion cabal.project.ci.macos
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ packages: .
import: ./cabal.project.common

package spectrometer
ghc-options: -Werror
ghc-options: -Werror -Wwarn=x-partial
2 changes: 1 addition & 1 deletion cabal.project.ci.windows
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ packages: .
import: ./cabal.project.common

package spectrometer
ghc-options: -Werror
ghc-options: -Werror -Wwarn=x-partial
12 changes: 11 additions & 1 deletion cabal.project.common
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ allow-newer:
-- was in 2018, so we may have to fork when breakage occurs
, codec-rpm:attoparsec

-- transformers has a few breaking changes from 0.5 -> 0.6.
-- But the removed symbols were already deprecated in 0.5.
-- fused-effects-exceptions has a PR out: https://github.com/fused-effects/fused-effects-exceptions/pull/22
-- When that merges you should be able to remove it from here.
-- lzma-conduit seems kind of moribund.
-- I've left an issue checking for signs of life: https://github.com/alphaHeavy/lzma-conduit/issues/27
-- I'll make a PR if someone responds. The lib is small enough we could just vendor it if not.
, lzma-conduit:transformers
, fused-effects-exceptions:transformers

-- the semver package only exposes lens-style accessors for its Version type;
-- normal accessors are in an un-exposed Internal module. on master, the
-- Internal module is exposed, but a new release hasn't been cut to hackage yet
Expand Down Expand Up @@ -55,6 +65,6 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/fossas/codec-rpm
tag: 0f7431423d47fdf36945e4ff31fbee76005b7e68
tag: 55e6cc0c0b7906ca257cb7c6268b2d99592bb30f

index-state: hackage.haskell.org 2024-08-14T18:49:08Z
14 changes: 7 additions & 7 deletions docs/contributing/HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ On Macs you need to have installed the developer tooling using `xcode-select --i
Use [ghcup][ghcup] to install the `cabal` cli tool and the ghc version we're using:

```sh
$ ghcup install ghc 9.4
$ ghcup install ghc 9.8
<long running output, about 4 min on my machine>
$ ghcup set ghc 9.4
$ ghcup set ghc 9.8
$ cabal update
$ cabal build
```
Expand All @@ -29,16 +29,16 @@ In previous GHC versions (8.10), `llvm` was required

Ok, the quickstart worked for you, but why, and how?

> `ghcup install ghc 9.4`
> `ghcup install ghc 9.8`

When you install `ghcup`, `ghc` and `cabal-install` are installed automatically as part of the initial installation (see [Tools](#tools) for descriptions of `ghc` and `cabal-install`).
The `ghc` version that is automatically installed may not be the correct version we use (though it may work just fine). So we install the correct version with `ghcup install ghc 9.4`.
The `ghc` version that is automatically installed may not be the correct version we use (though it may work just fine). So we install the correct version with `ghcup install ghc 9.8`.
Currently, the best place to check the correct version is our CI build files (try `.github/workflows/build.yml`).

> `ghcup set ghc 9.4`
> `ghcup set ghc 9.8`

`ghcup` works by setting symlinks to the "active" version of the tool you're using. Here, we're telling `ghcup` to set GHC 9.4 as the active GHC version.
Now, when you run `ghc`, you'll be running GHC 9.4.
`ghcup` works by setting symlinks to the "active" version of the tool you're using. Here, we're telling `ghcup` to set GHC 9.8 as the active GHC version.
Now, when you run `ghc`, you'll be running GHC 9.8.

> `cabal update`

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/STYLE-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ If your match guards are any less readable than the introductory examples in
[Learn you a haskell][guards], then you should stick to `case` and `if`
expressions within the function body.

[guards]: http://learnyouahaskell.com/syntax-in-functions#guards-guards
[guards]: https://learnyouahaskell.github.io/syntax-in-functions.html#guards-guards

### Don't go crazy with point-free definitions

Expand Down
7 changes: 4 additions & 3 deletions spectrometer.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ common lang
-Wall -Wincomplete-uni-patterns -Wcompat
-Wincomplete-record-updates -Wmissing-home-modules
-Wmissing-export-lists -Wredundant-constraints
-Wno-unrecognised-warning-flags

-- TODO: Switch `semver` back to `versions` since https://github.com/fosskers/versions/issues/47 is fixed. This package maintainer seems much more responsive. Contrast https://github.com/brendanhay/semver/issues/12.
-- codec-rpm is installed via cabal.project, so this number is an expected future version.
Expand Down Expand Up @@ -104,7 +105,7 @@ common deps
, crypton ^>=1.0.0
, crypton-connection ^>=0.4.1
, data-default-class ^>=0.1.2.0
, deepseq ^>=1.4.8
, deepseq ^>=1.4.8 || ^>=1.5
, direct-sqlite ^>=2.3.27
, directory ^>=1.3.6.1
, either ^>=5.0.2
Expand All @@ -124,9 +125,9 @@ common deps
, http-types ^>=0.12.3
, lzma ^>=0.0.1.0
, lzma-conduit ^>=1.2.1
, megaparsec ^>=9.4.0
, megaparsec ^>=9.4 || ^>=9.6
, modern-uri ^>=0.3.6
, mtl ^>=2.2.2
, mtl ^>=2.2 || ^>=2.3
, network ^>=3.1.2.0
, network-uri ^>=2.6.4.0
, optparse-applicative ^>=0.18.0.0
Expand Down
2 changes: 1 addition & 1 deletion src/App/Fossa/Reachability/Gradle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Control.Carrier.Reader (Reader, runReader)
import Control.Effect.Diagnostics (Diagnostics, ToDiagnostic, context, errCtx, errHelp, errSupport, renderDiagnostic)
import Control.Effect.Lift (sendIO)
import Control.Effect.Path (withSystemTempDir)
import Control.Monad.List (filterM)
import Control.Monad (filterM)
import Data.ByteString qualified as BS
import Data.ByteString.Lazy qualified as BL
import Data.Error (createErrataWithHeaderOnly)
Expand Down
3 changes: 1 addition & 2 deletions src/App/Fossa/Reachability/Maven.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import App.Fossa.Reachability.Jar (callGraphFromJars, isValidJar)
import App.Fossa.Reachability.Types (CallGraphAnalysis (..))
import Control.Carrier.Lift (Lift)
import Control.Effect.Diagnostics (Diagnostics, context, fromEither, recover)
import Control.Monad (join)
import Control.Monad.List (filterM)
import Control.Monad (filterM, join)
import Data.Map qualified as Map
import Data.Maybe (catMaybes, fromMaybe)
import Data.String.Conversion (ToText (toText))
Expand Down
4 changes: 4 additions & 0 deletions src/Control/Effect/Record/TH.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
-- Some partial functions are used safely in this module, so don't warn or error.
{-# OPTIONS_GHC -Wno-x-partial #-}

module Control.Effect.Record.TH (
deriveRecordable,
Expand Down Expand Up @@ -51,6 +53,8 @@ conNm (NormalC nm _) = nm
conNm (RecC nm _) = nm
conNm (InfixC _ nm _) = nm
conNm (ForallC _ _ con) = conNm con
-- 'head' is safe here because that field is documented to be non-empty:
-- https://hackage.haskell.org/package/template-haskell-2.22.0.0/docs/Language-Haskell-TH.html#v:GadtC
conNm (GadtC nms _ _) = head nms
conNm (RecGadtC nms _ _) = head nms

Expand Down
5 changes: 5 additions & 0 deletions src/Control/Effect/Replay/TH.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{-# LANGUAGE TemplateHaskell #-}
-- Some partial functions are used safely in this module.
-- This turns their use into a warning, not an error.
{-# OPTIONS_GHC -Wno-x-partial #-}

module Control.Effect.Replay.TH (
deriveReplayable,
Expand Down Expand Up @@ -89,6 +92,8 @@ conNm (NormalC nm _) = nm
conNm (RecC nm _) = nm
conNm (InfixC _ nm _) = nm
conNm (ForallC _ _ con) = conNm con
-- 'head' is safe here because that field is documented to be non-empty:
-- https://hackage.haskell.org/package/template-haskell-2.22.0.0/docs/Language-Haskell-TH.html#v:GadtC
conNm (GadtC nms _ _) = head nms
conNm (RecGadtC nms _ _) = head nms

Expand Down
4 changes: 1 addition & 3 deletions src/Data/FileEmbed/Extra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ embedFile' fp = runIO logEmbedFile *> embedFile fp
let isRel = isRelative fp
putStrLn $ "Relative?: " <> show isRel

-- `tail` is safe here because `iterate` returns an infinite list and
-- therefore must always have at least 1 element.
let dirs = take (length (splitPath fp) - if isRel then 0 else 1) $ tail $ iterate takeDirectory fp
let dirs = take (length (splitPath fp) - if isRel then 0 else 1) $ drop 1 $ iterate takeDirectory fp
traverse_ ls dirs

ls :: FilePath -> IO ()
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Rpm/DbHeaderBlob/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Data.Rpm.DbHeaderBlob.Internal (
regionTagType,
) where

import Control.Applicative (liftA2)
import Control.Applicative qualified as Ap
import Control.Monad (foldM, replicateM, unless, when)
import Data.Bifunctor (bimap, first)
import Data.Binary.Get (ByteOffset, Get, getInt32be, getWord32be, label, runGetOrFail)
Expand Down Expand Up @@ -436,7 +436,7 @@ bsSubString start end = BLS.take (fromIntegral $ end - start) . BLS.drop (fromIn

readEntries :: IndexCount -> Get (NonEmpty EntryMetadata)
readEntries indexLength =
liftA2 (:|) readEntry $ replicateM (fromIntegral (indexLength - 1)) readEntry
Ap.liftA2 (:|) readEntry $ replicateM (fromIntegral (indexLength - 1)) readEntry

readEntry :: Get EntryMetadata
readEntry =
Expand Down
2 changes: 1 addition & 1 deletion src/Strategy/Cargo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ parsePkgSpec = eatSpaces (try longSpec <|> simplePkgSpec')
--
-- Package Spec: https://doc.rust-lang.org/cargo/reference/pkgid-spec.html
parsePkgId :: MonadFail m => Text.Text -> m PackageId
parsePkgId t = either fail pure $ oldPkgIdParser' t <|> parseNewSpec
parsePkgId t = either fail pure $ oldPkgIdParser' t <> parseNewSpec
where
oldPkgIdParser' = first toString . oldPkgIdParser

Expand Down
4 changes: 2 additions & 2 deletions test/App/Fossa/Report/AttributionSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module App.Fossa.Report.AttributionSpec (
) where

import App.Fossa.Report.Attribution
import Control.Applicative (liftA2)
import Control.Applicative qualified as Ap
import Data.Aeson
import Data.Map.Strict (Map)
import Data.Text (Text)
Expand Down Expand Up @@ -52,7 +52,7 @@ genAttribution =
<*> Gen.maybe genCopyrightMap

tuplify :: Monad m => m a -> m b -> m (a, b)
tuplify = liftA2 (,)
tuplify = Ap.liftA2 (,)

genLicenseMap :: Gen (Map LicenseName LicenseContents)
genLicenseMap = do
Expand Down
4 changes: 2 additions & 2 deletions test/Test/Fixtures.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ import App.Fossa.VendoredDependency (VendoredDependency (..))
import App.Types (OverrideDynamicAnalysisBinary (..))
import App.Types qualified as App
import Control.Effect.FossaApiClient qualified as App
import Control.Monad.RWS qualified as Set
import Control.Timeout (Duration (MilliSeconds))
import Data.ByteString.Lazy qualified as LB
import Data.Flag (toFlag)
import Data.List.NonEmpty (NonEmpty)
import Data.List.NonEmpty qualified as NE
import Data.Map.Strict qualified as Map
import Data.Set qualified as Set
import Data.Text (Text)
import Data.Text.Encoding qualified as TL
import Data.Text.Extra (showT)
Expand Down Expand Up @@ -511,7 +511,7 @@ vsiOptions :: VSI.VSIModeOptions
vsiOptions =
VSI.VSIModeOptions
{ vsiAnalysisEnabled = toFlag VSI.VSIAnalysis False
, vsiSkipSet = VSI.SkipResolution Set.mempty
, vsiSkipSet = VSI.SkipResolution Set.empty
, iatAssertion = VSI.IATAssertion Nothing
, dynamicLinkingTarget = VSI.DynamicLinkInspect Nothing
, binaryDiscoveryEnabled = toFlag VSI.BinaryDiscovery False
Expand Down
Loading