diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 428bf2cc72..d6e3eb6c5e 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -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 diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index a3e32cd33c..2ba2c45f11 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} container: ${{ matrix.container }} env: - GHC_VERSION: '9.4.8' + GHC_VERSION: '9.8.2' defaults: @@ -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: @@ -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. @@ -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" diff --git a/.github/workflows/integrations-test.yml b/.github/workflows/integrations-test.yml index 4958a623b5..b3ec6ee101 100644 --- a/.github/workflows/integrations-test.yml +++ b/.github/workflows/integrations-test.yml @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 383edf7ee1..1631230ffc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 @@ -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 @@ -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 diff --git a/Changelog.md b/Changelog.md index a795f465be..4989fe88c8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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 diff --git a/Makefile b/Makefile index b989f97974..8185cc5616 100644 --- a/Makefile +++ b/Makefile @@ -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" diff --git a/cabal.project.ci.linux b/cabal.project.ci.linux index 228f2b3ea9..daf7ea4957 100644 --- a/cabal.project.ci.linux +++ b/cabal.project.ci.linux @@ -9,4 +9,4 @@ packages: . import: ./cabal.project.common package spectrometer - ghc-options: -Werror + ghc-options: -Werror -Wwarn=x-partial diff --git a/cabal.project.ci.macos b/cabal.project.ci.macos index a82bc28729..c2a4cb0bec 100644 --- a/cabal.project.ci.macos +++ b/cabal.project.ci.macos @@ -7,4 +7,4 @@ packages: . import: ./cabal.project.common package spectrometer - ghc-options: -Werror + ghc-options: -Werror -Wwarn=x-partial diff --git a/cabal.project.ci.windows b/cabal.project.ci.windows index 228f2b3ea9..daf7ea4957 100644 --- a/cabal.project.ci.windows +++ b/cabal.project.ci.windows @@ -9,4 +9,4 @@ packages: . import: ./cabal.project.common package spectrometer - ghc-options: -Werror + ghc-options: -Werror -Wwarn=x-partial diff --git a/cabal.project.common b/cabal.project.common index 15f6f747b4..8c7cf41d7a 100644 --- a/cabal.project.common +++ b/cabal.project.common @@ -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 @@ -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 diff --git a/docs/contributing/HACKING.md b/docs/contributing/HACKING.md index 83d6752689..8c66b35e9f 100644 --- a/docs/contributing/HACKING.md +++ b/docs/contributing/HACKING.md @@ -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 -$ ghcup set ghc 9.4 +$ ghcup set ghc 9.8 $ cabal update $ cabal build ``` @@ -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` diff --git a/docs/contributing/STYLE-GUIDE.md b/docs/contributing/STYLE-GUIDE.md index f373c9eebb..63f1cbe8f8 100644 --- a/docs/contributing/STYLE-GUIDE.md +++ b/docs/contributing/STYLE-GUIDE.md @@ -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 diff --git a/spectrometer.cabal b/spectrometer.cabal index 2a1ea978b0..8264882336 100644 --- a/spectrometer.cabal +++ b/spectrometer.cabal @@ -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. @@ -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 @@ -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 diff --git a/src/App/Fossa/Reachability/Gradle.hs b/src/App/Fossa/Reachability/Gradle.hs index 8e9d1fb491..0df8f94f6f 100644 --- a/src/App/Fossa/Reachability/Gradle.hs +++ b/src/App/Fossa/Reachability/Gradle.hs @@ -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) diff --git a/src/App/Fossa/Reachability/Maven.hs b/src/App/Fossa/Reachability/Maven.hs index da30cc8637..3dee031702 100644 --- a/src/App/Fossa/Reachability/Maven.hs +++ b/src/App/Fossa/Reachability/Maven.hs @@ -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)) diff --git a/src/Control/Effect/Record/TH.hs b/src/Control/Effect/Record/TH.hs index 433779546a..f0d13e6b0e 100644 --- a/src/Control/Effect/Record/TH.hs +++ b/src/Control/Effect/Record/TH.hs @@ -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, @@ -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 diff --git a/src/Control/Effect/Replay/TH.hs b/src/Control/Effect/Replay/TH.hs index 86a9e4eac9..30ff989b59 100644 --- a/src/Control/Effect/Replay/TH.hs +++ b/src/Control/Effect/Replay/TH.hs @@ -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, @@ -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 diff --git a/src/Data/FileEmbed/Extra.hs b/src/Data/FileEmbed/Extra.hs index 9c4191bf04..3cca4b04b6 100644 --- a/src/Data/FileEmbed/Extra.hs +++ b/src/Data/FileEmbed/Extra.hs @@ -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 () diff --git a/src/Data/Rpm/DbHeaderBlob/Internal.hs b/src/Data/Rpm/DbHeaderBlob/Internal.hs index c44730ab11..63f28aa372 100644 --- a/src/Data/Rpm/DbHeaderBlob/Internal.hs +++ b/src/Data/Rpm/DbHeaderBlob/Internal.hs @@ -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) @@ -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 = diff --git a/src/Strategy/Cargo.hs b/src/Strategy/Cargo.hs index 801985a2c1..ebbab175e6 100644 --- a/src/Strategy/Cargo.hs +++ b/src/Strategy/Cargo.hs @@ -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 diff --git a/test/App/Fossa/Report/AttributionSpec.hs b/test/App/Fossa/Report/AttributionSpec.hs index 7fbca5b418..8971259222 100644 --- a/test/App/Fossa/Report/AttributionSpec.hs +++ b/test/App/Fossa/Report/AttributionSpec.hs @@ -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) @@ -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 diff --git a/test/Test/Fixtures.hs b/test/Test/Fixtures.hs index 3ab06d5e79..300f9f81c3 100644 --- a/test/Test/Fixtures.hs +++ b/test/Test/Fixtures.hs @@ -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) @@ -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