Skip to content

Commit

Permalink
Upgrade dependencies to latest lts (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
f-f authored Feb 8, 2022
1 parent 9ef6c24 commit e999773
Show file tree
Hide file tree
Showing 11 changed files with 370 additions and 360 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.20.5] - 2022-02-08

Features:
- Drop need for `psci-support` to be defined in `dependencies` field (#817)

## [0.20.4] - 2022-01-29
Other improvements:
- Upgrade to latest Dhall version (#848, #851)

## [0.20.4] - 2022-01-31

Bugfixes:
- Don't warn on unused deps when building with `--deps-only` (#794)
Expand Down
2 changes: 1 addition & 1 deletion spago.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ library
, bytestring
, containers
, cryptonite
, dhall >=1.38.0
, dhall >=1.39.0
, directory >=1.3.4.0
, either
, file-embed
Expand Down
57 changes: 30 additions & 27 deletions src/Spago/Dhall.hs
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedLists #-}

module Spago.Dhall
( module Spago.Dhall
, module Dhall
) where

import Spago.Prelude

import qualified Control.Monad.Trans.State.Strict as State
import qualified Data.Text as Text
import qualified Data.Text.Prettyprint.Doc as Pretty
import qualified Data.Text.Prettyprint.Doc.Render.Text as PrettyText
import Dhall
import Dhall.Core as Dhall hiding (pretty)
( module Spago.Dhall,
module Dhall,
)
where

import qualified Control.Monad.Trans.State.Strict as State
import qualified Data.Text as Text
import Dhall
import Dhall.Core as Dhall hiding (pretty)
import qualified Dhall.Format
import qualified Dhall.Import
import qualified Dhall.Map
import qualified Dhall.Parser as Parser
import qualified Dhall.Pretty
import Dhall.TypeCheck (typeOf)
import Dhall.Util as Dhall
import qualified Dhall.Parser as Parser
import Dhall.TypeCheck (typeOf)
import Dhall.Util as Dhall hiding (input)
import qualified Lens.Family
import qualified System.FilePath as FilePath
import qualified Prettyprinter as Pretty
import qualified Prettyprinter.Render.Text as PrettyText
import Spago.Prelude
import qualified System.FilePath as FilePath
import qualified Dhall.Pretty

type DhallExpr a = Dhall.Expr Parser.Src a


-- | Format a Dhall file in ASCII
-- We first check if it's already formatted, if not we reformat it.
format :: MonadIO m => Text -> m ()
format pathText = liftIO $
try (f Dhall.Check) >>= \case
Left (_e :: SomeException) ->
f Dhall.Write
Right _ -> pure ()
format pathText =
liftIO $
try (f Dhall.Check) >>= \case
Left (_e :: SomeException) ->
f Dhall.Write
Right _ -> pure ()
where
f = Dhall.Format.format
. Dhall.Format.Format
f =
Dhall.Format.format
. Dhall.Format.Format
(Just Dhall.Pretty.ASCII)
Dhall.NoCensor
(Dhall.PossiblyTransitiveInputFile (Text.unpack pathText) Dhall.NonTransitive)

Dhall.NonTransitive
[Dhall.InputFile (Text.unpack pathText)]

-- | Prettyprint a Dhall expression adding a comment on top
prettyWithHeader :: Pretty.Pretty a => Dhall.Header -> DhallExpr a -> Dhall.Text
Expand Down
4 changes: 3 additions & 1 deletion src/Spago/PackageSet.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE OverloadedLists #-}
module Spago.PackageSet
( updatePackageSetVersion
, getLatestSetForCompilerVersion
Expand Down Expand Up @@ -273,7 +274,8 @@ freeze path = do
liftIO $
Dhall.Freeze.freeze
Dhall.Write
(Dhall.PossiblyTransitiveInputFile path Dhall.NonTransitive)
Dhall.NonTransitive
[Dhall.InputFile path]
Dhall.Freeze.OnlyRemoteImports
Dhall.Freeze.Secure
(Just Dhall.Pretty.ASCII)
Expand Down
6 changes: 3 additions & 3 deletions src/Spago/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ module Spago.Prelude


import qualified Data.Text as Text
import qualified Data.Text.Prettyprint.Doc as Pretty
import qualified Data.Text.Prettyprint.Doc.Render.Text as PrettyText
import qualified Prettyprinter as Pretty
import qualified Prettyprinter.Render.Text as PrettyText
import qualified Data.Time as Time
import Dhall (Text)
import qualified Dhall.Core
Expand All @@ -101,7 +101,7 @@ import Data.Foldable as X
import Data.Generics.Product (the, HasType(..))
import Data.Maybe as X
import Data.Sequence (Seq (..))
import Data.Text.Prettyprint.Doc (Pretty)
import Prettyprinter (Pretty)
import Dhall.Optics (transformMOf)
import Lens.Family ((^..))
import RIO as X hiding (FilePath, first, force, second, HasLogFunc, logDebug, logError, logInfo, logWarn, (^..))
Expand Down
10 changes: 4 additions & 6 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
resolver: lts-17.9
resolver: lts-18.24
packages:
- .
- .
extra-deps:
- dhall-1.38.1
- semver-range-0.2.8
- with-utf8-1.0.2.2
- semver-range-0.2.8
- with-utf8-1.0.2.2
allow-newer: true
nix:
packages: [zlib]
Expand All @@ -17,4 +16,3 @@ flags:
examples: false
cryptonite:
use_target_attributes: false

3 changes: 2 additions & 1 deletion templates/packages.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ in upstream
-------------------------------
-}
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.14.1-20210419/packages.dhall sha256:d9a082ffb5c0fabf689574f0680e901ca6f924e01acdbece5eeedd951731375a
https://github.com/purescript/package-sets/releases/download/psc-0.14.1-20210419/packages.dhall
sha256:d9a082ffb5c0fabf689574f0680e901ca6f924e01acdbece5eeedd951731375a

in upstream
10 changes: 5 additions & 5 deletions test/BumpVersionSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ setOverrides overrides = do
commitAll

randomSemVer :: Gen SemVer
randomSemVer = SemVer <$> arbitrary <*> arbitrary <*> arbitrary <*> pure [] <*> pure []
randomSemVer = SemVer <$> arbitrary <*> arbitrary <*> arbitrary <*> pure [] <*> pure Nothing

spec :: Spec
spec = describe "spago bump-version" $ do
Expand Down Expand Up @@ -107,18 +107,18 @@ spec = describe "spago bump-version" $ do
parseVersionBump "patch" `shouldBe` Just Patch

it "should parse version starting with 'v'" $
parseVersionBump "v1.2.3" `shouldBe` Just (Exact (SemVer 1 2 3 [] []))
parseVersionBump "v1.2.3" `shouldBe` Just (Exact (SemVer 1 2 3 [] Nothing))

it "should parse version not starting with 'v'" $
parseVersionBump "1.2.3" `shouldBe` Just (Exact (SemVer 1 2 3 [] []))
parseVersionBump "1.2.3" `shouldBe` Just (Exact (SemVer 1 2 3 [] Nothing))

-- TODO is this desired behavior, or should we just drop ONE 'v'? I'd agree it's edge case, but still :-)
it "should drop multiple 'v's from the beginning" $
parseVersionBump "vvvvvvvv1.2.3" `shouldBe` Just (Exact (SemVer 1 2 3 [] []))
parseVersionBump "vvvvvvvv1.2.3" `shouldBe` Just (Exact (SemVer 1 2 3 [] Nothing))

-- TODO should this work or should we strip these in parser implementation?
it "should parse versions with PREREL and META tags" $
parseVersionBump "1.2.3-r1+git123" `shouldBe` Just (Exact (SemVer 1 2 3 [[Str "r",Digits 1]] [[Str "git", Digits 123]]))
parseVersionBump "1.2.3-r1+git123" `shouldBe` Just (Exact (SemVer 1 2 3 [[Str "r", Digits 1]] (Just "git123")))

it "should not parse version which is not semantic" $ do
parseVersionBump "" `shouldBe` Nothing
Expand Down
2 changes: 1 addition & 1 deletion test/SpagoSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ spec = around_ setup $ do
$ Text.lines packages
writeTextFile "packages.dhall" "https://github.com/purescript/package-sets/releases/download/psc-0.13.4-20191025/packages.dhall sha256:f9eb600e5c2a439c3ac9543b1f36590696342baedab2d54ae0aa03c9447ce7d4"
spago ["-v", "upgrade-set"] >>= shouldBeSuccess
newPackages <- Text.strip <$> readTextFile "packages.dhall"
newPackages <- Text.strip . head . Text.lines <$> readTextFile "packages.dhall"
newPackages `shouldBe` packageSetUrl

it "Spago should migrate a package set from an alternative repository from src/packages.dhall" $ do
Expand Down
Loading

0 comments on commit e999773

Please sign in to comment.