From c3829a696e76917472cde7b4d77144e5cd114a7f Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 13:58:12 +0200 Subject: [PATCH 01/22] Updated hnix dependencies in all Stack configurations Also added `mkParsec` method to MonadParsec instance for megaparsec>=9.4 --- dhall/src/Dhall/Parser/Combinators.hs | 4 ++++ stack.ghc-8.10.yaml | 6 +++--- stack.ghc-9.2.yaml | 7 +++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dhall/src/Dhall/Parser/Combinators.hs b/dhall/src/Dhall/Parser/Combinators.hs index c8a035cfb..d0a72e826 100644 --- a/dhall/src/Dhall/Parser/Combinators.hs +++ b/dhall/src/Dhall/Parser/Combinators.hs @@ -169,6 +169,10 @@ instance Text.Megaparsec.MonadParsec Void Text Parser where updateParserState f = Parser (Text.Megaparsec.updateParserState f) +#if MIN_VERSION_megaparsec(9,4,0) + mkParsec f = Parser (Text.Megaparsec.mkParsec f) +#endif + instance Semigroup a => Semigroup (Parser a) where (<>) = liftA2 (<>) diff --git a/stack.ghc-8.10.yaml b/stack.ghc-8.10.yaml index 63e06ce97..abfe0549c 100644 --- a/stack.ghc-8.10.yaml +++ b/stack.ghc-8.10.yaml @@ -13,9 +13,9 @@ packages: extra-deps: - co-log-core-0.3.2.0 - hashable-1.3.5.0@sha256:3a2beeafb220f9de706568a7e4a5b3c762cc4c9f25c94d7ef795b8c2d6a691d7,4240 - - hnix-0.16.0 - - hnix-store-core-0.5.0.0 - - hnix-store-remote-0.5.0.0 + - hnix-0.17.0@sha256:57e172f915d70be2dd88c6377caebe8bd63337123ffef42df49b05dc0b1f168b,19224 + - hnix-store-core-0.6.1.0@sha256:0171c3a571ab263c3e3aa3e6daca15602f2030a6862cb032038017e6d0265898,3882 + - hnix-store-remote-0.6.0.0@sha256:a8ea18bb355164bfd357fac12b0c5d32c95ffd455260f8b6c7fcaeddebf5918c,3270 - lsp-2.1.0.0 - lsp-types-2.0.1.0 - lsp-test-0.15.0.1 diff --git a/stack.ghc-9.2.yaml b/stack.ghc-9.2.yaml index 577114f9d..a76e5d303 100644 --- a/stack.ghc-9.2.yaml +++ b/stack.ghc-9.2.yaml @@ -11,12 +11,11 @@ packages: - dhall-toml - dhall-yaml extra-deps: - - github: haskell-nix/hnix - commit: 2adbc502e62e755ca0372c913e6278ebe564d7d2 - chronos-1.1.5 - hashing-0.1.1.0 - - hnix-store-core-0.6.1.0 - - hnix-store-remote-0.6.0.0 + - hnix-0.17.0@sha256:57e172f915d70be2dd88c6377caebe8bd63337123ffef42df49b05dc0b1f168b,19224 + - hnix-store-core-0.6.1.0@sha256:0171c3a571ab263c3e3aa3e6daca15602f2030a6862cb032038017e6d0265898,3882 + - hnix-store-remote-0.6.0.0@sha256:a8ea18bb355164bfd357fac12b0c5d32c95ffd455260f8b6c7fcaeddebf5918c,3270 - logict-0.7.0.3 - lsp-2.1.0.0 - lsp-types-2.0.1.0 From 6d9cc0f3a3c41292ea03539942362770c0110a53 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 14:16:31 +0200 Subject: [PATCH 02/22] Require turtle >=1.6 --- dhall-docs/dhall-docs.cabal | 2 +- dhall-nixpkgs/dhall-nixpkgs.cabal | 2 +- dhall/dhall.cabal | 2 +- stack.ghc-8.10.yaml | 4 ++++ stack.ghc-9.2.yaml | 5 ++++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dhall-docs/dhall-docs.cabal b/dhall-docs/dhall-docs.cabal index bc0223c52..21667169f 100644 --- a/dhall-docs/dhall-docs.cabal +++ b/dhall-docs/dhall-docs.cabal @@ -152,7 +152,7 @@ Test-Suite tasty tasty < 1.5 , tasty-silver < 3.4 , tasty-hunit >= 0.10 && < 0.11, - turtle < 1.7 , + turtle >= 1.6 && < 1.7 , text GHC-Options: -Wall Default-Language: Haskell2010 diff --git a/dhall-nixpkgs/dhall-nixpkgs.cabal b/dhall-nixpkgs/dhall-nixpkgs.cabal index 9075f40e5..6afaf5335 100644 --- a/dhall-nixpkgs/dhall-nixpkgs.cabal +++ b/dhall-nixpkgs/dhall-nixpkgs.cabal @@ -34,7 +34,7 @@ Executable dhall-to-nixpkgs , prettyprinter >= 1.7.0 && < 1.8 , text >= 0.11.1.0 && < 2.1 , transformers >= 0.2.0.0 && < 0.6 - , turtle < 1.6 + , turtle >= 1.6 && < 1.7 , network-uri < 2.8 Default-Language: Haskell2010 GHC-Options: -Wall -threaded diff --git a/dhall/dhall.cabal b/dhall/dhall.cabal index bb05ffe02..5de5b2c77 100644 --- a/dhall/dhall.cabal +++ b/dhall/dhall.cabal @@ -452,7 +452,7 @@ Test-Suite tasty tasty-quickcheck >= 0.9.2 && < 0.11, tasty-silver < 3.4 , temporary >= 1.2.1 && < 1.4 , - turtle < 1.7 , + turtle >= 1.6 && < 1.7 , Default-Language: Haskell2010 Test-Suite doctest diff --git a/stack.ghc-8.10.yaml b/stack.ghc-8.10.yaml index abfe0549c..9e75a7422 100644 --- a/stack.ghc-8.10.yaml +++ b/stack.ghc-8.10.yaml @@ -11,6 +11,7 @@ packages: - dhall-toml - dhall-yaml extra-deps: + - ansi-wl-pprint-1.0.2@sha256:b817853b5310b8e7847469847608b664c3e75b4b30c332f2cb8c0d00751ef9c1,1915 - co-log-core-0.3.2.0 - hashable-1.3.5.0@sha256:3a2beeafb220f9de706568a7e4a5b3c762cc4c9f25c94d7ef795b8c2d6a691d7,4240 - hnix-0.17.0@sha256:57e172f915d70be2dd88c6377caebe8bd63337123ffef42df49b05dc0b1f168b,19224 @@ -20,10 +21,13 @@ extra-deps: - lsp-types-2.0.1.0 - lsp-test-0.15.0.1 - lucid-2.11.0 + - optparse-applicative-0.18.1.0@sha256:b4cf8d9018e5e67cb1f14edb5130b6d05ad8bc1b5f6bd4efaa6ec0b7f28f559d,5132 + - optparse-generic-1.5.2 - relude-1.0.0.1@sha256:35bcdaf14018e79f11e712b0e2314c1aac79976f28f4adc179985457493557d5,11569 - row-types-1.0.1.2@sha256:4d4c7cb95d06a32b28ba977852d52a26b4c1f695ef083a6fd874ab6d79933b64,3071 - semialign-1.2@sha256:9afb6eb7e50db7ca34d7c4108aec0f643dae2caaaa80394b44ffdd643315685c,2721 - text-rope-0.2 + - turtle-1.6.2@sha256:75710c60388e572bc17cbb08a81cbb4537f2207f8dcf187e9b1928d1e0b023a6,5767 - typerep-map-0.5.0.0 nix: packages: diff --git a/stack.ghc-9.2.yaml b/stack.ghc-9.2.yaml index a76e5d303..e6196b280 100644 --- a/stack.ghc-9.2.yaml +++ b/stack.ghc-9.2.yaml @@ -11,6 +11,7 @@ packages: - dhall-toml - dhall-yaml extra-deps: + - ansi-wl-pprint-1.0.2@sha256:b817853b5310b8e7847469847608b664c3e75b4b30c332f2cb8c0d00751ef9c1,1915 - chronos-1.1.5 - hashing-0.1.1.0 - hnix-0.17.0@sha256:57e172f915d70be2dd88c6377caebe8bd63337123ffef42df49b05dc0b1f168b,19224 @@ -20,10 +21,12 @@ extra-deps: - lsp-2.1.0.0 - lsp-types-2.0.1.0 - lsp-test-0.15.0.1 - - optparse-applicative-0.16.1.0 + - optparse-applicative-0.18.1.0@sha256:b4cf8d9018e5e67cb1f14edb5130b6d05ad8bc1b5f6bd4efaa6ec0b7f28f559d,5132 + - optparse-generic-1.5.2 - row-types-1.0.1.2@sha256:4d4c7cb95d06a32b28ba977852d52a26b4c1f695ef083a6fd874ab6d79933b64,3071 - saltine-0.2.1.0 - tomland-1.3.3.2 + - turtle-1.6.2@sha256:75710c60388e572bc17cbb08a81cbb4537f2207f8dcf187e9b1928d1e0b023a6,5767 - typerep-map-0.5.0.0 - validation-selective-0.1.0.2 nix: From 070f63f985ea647142e5d35bede5c66a24d09cc6 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 14:25:38 +0200 Subject: [PATCH 03/22] Removed depecated functions --- dhall/tests/Dhall/Test/Freeze.hs | 5 +---- dhall/tests/Dhall/Test/Import.hs | 11 +++-------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/dhall/tests/Dhall/Test/Freeze.hs b/dhall/tests/Dhall/Test/Freeze.hs index 802513693..2581baf1e 100644 --- a/dhall/tests/Dhall/Test/Freeze.hs +++ b/dhall/tests/Dhall/Test/Freeze.hs @@ -1,8 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} --- FIXME: Re-enable deprecation warnings after removing support for turtle < 1.6. -{-# OPTIONS_GHC -Wno-deprecations #-} - module Dhall.Test.Freeze where import Data.Text (Text) @@ -53,7 +50,7 @@ freezeTest dir intent prefix = parsedInput <- Core.throws (Parser.exprFromText mempty inputText) - actualExpression <- Freeze.freezeExpression (Turtle.encodeString dir) AllImports intent parsedInput + actualExpression <- Freeze.freezeExpression dir AllImports intent parsedInput let actualText = Core.pretty actualExpression <> "\n" diff --git a/dhall/tests/Dhall/Test/Import.hs b/dhall/tests/Dhall/Test/Import.hs index 8a6c0c6bc..84c52caae 100644 --- a/dhall/tests/Dhall/Test/Import.hs +++ b/dhall/tests/Dhall/Test/Import.hs @@ -2,18 +2,13 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeApplications #-} --- FIXME: Re-enable deprecation warnings after removing support for turtle < 1.6. -{-# OPTIONS_GHC -Wno-deprecations #-} - module Dhall.Test.Import where import Control.Exception (SomeException) -import Data.Foldable (fold) import Data.Text (Text, isSuffixOf) import Data.Void (Void) -import Prelude hiding (FilePath) +import System.FilePath (()) import Test.Tasty (TestTree) -import Turtle (FilePath, toText, ()) import qualified Control.Exception as Exception import qualified Control.Monad as Monad @@ -102,7 +97,7 @@ getTests = do ] _ <- Monad.guard (path `notElem` expectedSuccesses) - _ <- Monad.guard (not ("ENV.dhall" `isSuffixOf` (fold (toText path)))) + _ <- Monad.guard (not ("ENV.dhall" `isSuffixOf` Text.pack path)) return path ) let testTree = @@ -176,7 +171,7 @@ successTest prefix = do not (null (Turtle.match (Turtle.ends path') (Test.Util.toDhallPath prefix))) let buildNewCache = do - tempdir <- fmap Turtle.decodeString (Turtle.managed (Temp.withSystemTempDirectory "dhall-cache")) + tempdir <- Turtle.managed (Temp.withSystemTempDirectory "dhall-cache") Turtle.liftIO (Turtle.cptree originalCache tempdir) return tempdir From 63ffe6ffbb6acca7c12b95a181f6a67fe07ece33 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 15:23:14 +0200 Subject: [PATCH 04/22] Use normalized filepaths in tests --- dhall/tests/Dhall/Test/Diff.hs | 2 -- dhall/tests/Dhall/Test/Freeze.hs | 2 -- dhall/tests/Dhall/Test/Import.hs | 4 ++-- dhall/tests/Dhall/Test/Lint.hs | 2 -- dhall/tests/Dhall/Test/Normalization.hs | 3 +-- dhall/tests/Dhall/Test/Parser.hs | 3 +-- dhall/tests/Dhall/Test/Schemas.hs | 2 -- dhall/tests/Dhall/Test/SemanticHash.hs | 2 -- dhall/tests/Dhall/Test/Tags.hs | 7 +++---- dhall/tests/Dhall/Test/TypeInference.hs | 3 +-- dhall/tests/Dhall/Test/Util.hs | 13 ++++++++----- 11 files changed, 16 insertions(+), 27 deletions(-) diff --git a/dhall/tests/Dhall/Test/Diff.hs b/dhall/tests/Dhall/Test/Diff.hs index 01a070407..682af0b3a 100644 --- a/dhall/tests/Dhall/Test/Diff.hs +++ b/dhall/tests/Dhall/Test/Diff.hs @@ -3,9 +3,7 @@ module Dhall.Test.Diff where import Data.Text (Text) -import Prelude hiding (FilePath) import Test.Tasty (TestTree) -import Turtle (FilePath) import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO diff --git a/dhall/tests/Dhall/Test/Freeze.hs b/dhall/tests/Dhall/Test/Freeze.hs index 2581baf1e..3937e6d33 100644 --- a/dhall/tests/Dhall/Test/Freeze.hs +++ b/dhall/tests/Dhall/Test/Freeze.hs @@ -4,9 +4,7 @@ module Dhall.Test.Freeze where import Data.Text (Text) import Dhall.Freeze (Intent (..), Scope (..)) -import Prelude hiding (FilePath) import Test.Tasty (TestTree) -import Turtle (FilePath) import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO diff --git a/dhall/tests/Dhall/Test/Import.hs b/dhall/tests/Dhall/Test/Import.hs index 84c52caae..dbd4d2721 100644 --- a/dhall/tests/Dhall/Test/Import.hs +++ b/dhall/tests/Dhall/Test/Import.hs @@ -72,7 +72,7 @@ getTests = do successTests <- Test.Util.discover (Turtle.chars <* "A.dhall") successTest (do path <- Turtle.lstree (importDirectory "success") - Monad.guard (path `notElem` flakyTests) + Monad.guard (path `Test.Util.pathNotElem` flakyTests) return path ) @@ -96,7 +96,7 @@ getTests = do #endif ] - _ <- Monad.guard (path `notElem` expectedSuccesses) + _ <- Monad.guard (path `Test.Util.pathNotElem` expectedSuccesses) _ <- Monad.guard (not ("ENV.dhall" `isSuffixOf` Text.pack path)) return path ) diff --git a/dhall/tests/Dhall/Test/Lint.hs b/dhall/tests/Dhall/Test/Lint.hs index 7d578eccd..b0f8b1456 100644 --- a/dhall/tests/Dhall/Test/Lint.hs +++ b/dhall/tests/Dhall/Test/Lint.hs @@ -4,9 +4,7 @@ module Dhall.Test.Lint where import Data.Text (Text) import Dhall.Parser (Header (..)) -import Prelude hiding (FilePath) import Test.Tasty (TestTree) -import Turtle (FilePath) import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO diff --git a/dhall/tests/Dhall/Test/Normalization.hs b/dhall/tests/Dhall/Test/Normalization.hs index 3586f2f94..742d5d81e 100644 --- a/dhall/tests/Dhall/Test/Normalization.hs +++ b/dhall/tests/Dhall/Test/Normalization.hs @@ -5,9 +5,8 @@ module Dhall.Test.Normalization where import Data.Text (Text) import Data.Void (Void) import Dhall.Core (Expr (..), Var (..), throws) -import Prelude hiding (FilePath) +import System.FilePath (()) import Test.Tasty (TestTree) -import Turtle (FilePath, ()) import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO diff --git a/dhall/tests/Dhall/Test/Parser.hs b/dhall/tests/Dhall/Test/Parser.hs index 0c3df5ad9..5d5245739 100644 --- a/dhall/tests/Dhall/Test/Parser.hs +++ b/dhall/tests/Dhall/Test/Parser.hs @@ -5,9 +5,8 @@ module Dhall.Test.Parser where import Data.Text (Text) import Data.Void (Void) import Dhall.Core (Binding (..), Expr (..), Import, Var (..)) -import Prelude hiding (FilePath) +import System.FilePath (()) import Test.Tasty (TestTree) -import Turtle (FilePath, ()) import qualified Control.Monad as Monad import qualified Data.Bifunctor as Bifunctor diff --git a/dhall/tests/Dhall/Test/Schemas.hs b/dhall/tests/Dhall/Test/Schemas.hs index bd7a4733d..e4386c0fe 100644 --- a/dhall/tests/Dhall/Test/Schemas.hs +++ b/dhall/tests/Dhall/Test/Schemas.hs @@ -4,9 +4,7 @@ module Dhall.Test.Schemas where import Data.Text (Text) import Dhall.Parser (Header (..)) -import Prelude hiding (FilePath) import Test.Tasty (TestTree) -import Turtle (FilePath) import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO diff --git a/dhall/tests/Dhall/Test/SemanticHash.hs b/dhall/tests/Dhall/Test/SemanticHash.hs index f0ee329a9..5a717d1cb 100644 --- a/dhall/tests/Dhall/Test/SemanticHash.hs +++ b/dhall/tests/Dhall/Test/SemanticHash.hs @@ -3,9 +3,7 @@ module Dhall.Test.SemanticHash where import Data.Text (Text) -import Prelude hiding (FilePath) import Test.Tasty (TestTree) -import Turtle (FilePath) import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO diff --git a/dhall/tests/Dhall/Test/Tags.hs b/dhall/tests/Dhall/Test/Tags.hs index 41e181054..5ede3e4e7 100644 --- a/dhall/tests/Dhall/Test/Tags.hs +++ b/dhall/tests/Dhall/Test/Tags.hs @@ -4,9 +4,8 @@ module Dhall.Test.Tags where import Data.Text (Text) import Dhall.Util (Input (..)) -import Prelude hiding (FilePath) +import System.FilePath (()) import Test.Tasty (TestTree) -import Turtle (FilePath) import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO @@ -30,7 +29,7 @@ getTests = do tagsTest :: Text -> TestTree tagsTest prefix = Tasty.HUnit.testCase (Text.unpack prefix) $ do - let inputFile = Text.unpack (prefix <> ".dhall") + let inputFile = Text.unpack (Test.Util.toDhallPath prefix <> ".dhall") let outputFile = Text.unpack (prefix <> ".tags") actualTags <- fixPathSeparators <$> Tags.generate (InputFile inputFile) Nothing False @@ -44,7 +43,7 @@ tagsTest prefix = tagsDirTest :: TestTree tagsDirTest = Tasty.HUnit.testCase "all" $ do - let outputFile = Text.unpack . Turtle.format Turtle.fp $ tagsDirectory Turtle. "all.tags" + let outputFile = Text.unpack . Turtle.format Turtle.fp $ tagsDirectory "all.tags" actualTags <- fmap fixPathSeparators (Tags.generate diff --git a/dhall/tests/Dhall/Test/TypeInference.hs b/dhall/tests/Dhall/Test/TypeInference.hs index 561f06cd5..bf6c4e39b 100644 --- a/dhall/tests/Dhall/Test/TypeInference.hs +++ b/dhall/tests/Dhall/Test/TypeInference.hs @@ -5,9 +5,8 @@ module Dhall.Test.TypeInference where import Control.Exception (SomeException (..)) import Data.Text (Text) -import Prelude hiding (FilePath) +import System.FilePath (()) import Test.Tasty (TestTree) -import Turtle (FilePath, ()) import qualified Control.Exception as Exception import qualified Control.Monad as Monad diff --git a/dhall/tests/Dhall/Test/Util.hs b/dhall/tests/Dhall/Test/Util.hs index 79b8e1721..f90f1861c 100644 --- a/dhall/tests/Dhall/Test/Util.hs +++ b/dhall/tests/Dhall/Test/Util.hs @@ -20,6 +20,7 @@ module Dhall.Test.Util , assertDoesntTypeCheck , discover , Dhall.Test.Util.testCase + , pathNotElem , toDhallPath , managedTestEnvironment ) where @@ -41,11 +42,10 @@ import Dhall.Core ) import Dhall.Import (SemanticCacheMode (..), Status (..)) import Dhall.Parser (Src) -import Prelude hiding (FilePath) import System.IO.Error (isDoesNotExistError) import Test.Tasty (TestTree) import Test.Tasty.HUnit -import Turtle (FilePath, Pattern, Shell, fp) +import Turtle (Pattern, Shell, fp) import qualified Control.Exception import qualified Control.Foldl as Foldl @@ -289,7 +289,7 @@ discover pattern buildTest paths = do let shell = do path_ <- paths - let pathText = Turtle.format fp path_ + let pathText = Turtle.format fp (FilePath.normalise path_) prefix : _ <- return (Turtle.match pattern pathText) @@ -301,15 +301,18 @@ discover pattern buildTest paths = do testCase :: Text -> [ FilePath ] -> Assertion -> TestTree testCase prefix expectedFailures assertion = - if prefix `elem` map (Turtle.format fp) expectedFailures + if prefix `elem` map (Turtle.format fp . FilePath.normalise) expectedFailures then Tasty.ExpectedFailure.expectFail test else test where test = Test.Tasty.HUnit.testCase (Text.unpack prefix) assertion +pathNotElem :: FilePath -> [FilePath] -> Bool +pathNotElem this = not . any (FilePath.equalFilePath this) + {-| Path names on Windows are not valid Dhall paths due to using backslashes instead of forwardslashes to separate path components. This utility fixes them if necessary -} toDhallPath :: Text -> Text -toDhallPath = Text.replace "\\" "/" +toDhallPath = ("./" <>) . Text.replace "\\" "/" From f3ba6ba97891ce2f3f126dd768e7b904c2dab95a Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 16:02:25 +0200 Subject: [PATCH 05/22] Made normalization tests a bit more chatty --- dhall/tests/Dhall/Test/Normalization.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dhall/tests/Dhall/Test/Normalization.hs b/dhall/tests/Dhall/Test/Normalization.hs index 742d5d81e..32c59bb22 100644 --- a/dhall/tests/Dhall/Test/Normalization.hs +++ b/dhall/tests/Dhall/Test/Normalization.hs @@ -46,9 +46,9 @@ getTests = do let testTree = Tasty.testGroup "normalization" - [ betaNormalizationTests - , unitTests - , alphaNormalizationTests + [ Tasty.testGroup "beta-normalization" [ betaNormalizationTests ] + , Tasty.testGroup "unit tests" [ unitTests ] + , Tasty.testGroup "alpha-normalization" [ alphaNormalizationTests ] , customization ] @@ -127,7 +127,7 @@ alphaNormalizationTest prefix = do let expectedNormalized = Core.denote expectedResolved :: Expr Void Void let message = - "The normalized expression did not match the expected output" + "The alpha-normalized expression did not match the expected output" Tasty.HUnit.assertEqual message expectedNormalized actualNormalized @@ -199,6 +199,6 @@ betaNormalizationTest prefix = do Core.alphaNormalize (Core.denote expectedResolved) let message = - "The normalized expression did not match the expected output" + "The beta-normalized expression did not match the expected output" Tasty.HUnit.assertEqual message expectedNormalized actualNormalized From 79647ce6916ed92f36f3ea90b86355327c00d323 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 16:34:23 +0200 Subject: [PATCH 06/22] Fix: Exclude unit test from beta-normalization in Dhall.Test.Normalization --- dhall/tests/Dhall/Test/Normalization.hs | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/dhall/tests/Dhall/Test/Normalization.hs b/dhall/tests/Dhall/Test/Normalization.hs index 32c59bb22..8ad57d498 100644 --- a/dhall/tests/Dhall/Test/Normalization.hs +++ b/dhall/tests/Dhall/Test/Normalization.hs @@ -8,6 +8,8 @@ import Dhall.Core (Expr (..), Var (..), throws) import System.FilePath (()) import Test.Tasty (TestTree) +import qualified Control.Monad as Monad +import qualified Data.List as List import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO import qualified Dhall.Context as Context @@ -16,6 +18,7 @@ import qualified Dhall.Import as Import import qualified Dhall.Parser as Parser import qualified Dhall.Test.Util as Test.Util import qualified Dhall.TypeCheck as TypeCheck +import qualified System.FilePath as FilePath import qualified Test.Tasty as Tasty import qualified Test.Tasty.HUnit as Tasty.HUnit import qualified Turtle @@ -23,32 +26,41 @@ import qualified Turtle normalizationDirectory :: FilePath normalizationDirectory = "./dhall-lang/tests/normalization/success" +unitDirectory :: FilePath +unitDirectory = normalizationDirectory "unit/" + getTests :: IO TestTree getTests = do let pattern = Turtle.chars <* "A.dhall" let normalizationFiles = do - path <- Turtle.lstree normalizationDirectory + path <- FilePath.normalise <$> Turtle.lstree normalizationDirectory - Nothing <- return (Turtle.stripPrefix (normalizationDirectory "unit/") path) + Monad.guard (not (FilePath.normalise unitDirectory `List.isPrefixOf` path)) return path betaNormalizationTests <- Test.Util.discover pattern betaNormalizationTest normalizationFiles - alphaNormalizationTests <- do + alphaNormalizationTests <- Test.Util.discover pattern alphaNormalizationTest (Turtle.lstree "./dhall-lang/tests/alpha-normalization/success/") - let unitTestFiles = Turtle.lstree (normalizationDirectory "unit/") + let unitTestFiles = Turtle.lstree unitDirectory unitTests <- Test.Util.discover pattern unitTest unitTestFiles let testTree = Tasty.testGroup "normalization" - [ Tasty.testGroup "beta-normalization" [ betaNormalizationTests ] - , Tasty.testGroup "unit tests" [ unitTests ] - , Tasty.testGroup "alpha-normalization" [ alphaNormalizationTests ] + [ Tasty.testGroup "beta-normalization" + [ betaNormalizationTests + ] + , Tasty.testGroup "unit tests" + [ unitTests + ] + , Tasty.testGroup "alpha-normalization" + [ alphaNormalizationTests + ] , customization ] From cc5d987a93993e8104f066f02a45ed1ca019ff4c Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 16:47:59 +0200 Subject: [PATCH 07/22] Improved usage of guards for path selection in test suite --- dhall/tests/Dhall/Test/Format.hs | 3 +-- dhall/tests/Dhall/Test/Import.hs | 10 +++++----- dhall/tests/Dhall/Test/Normalization.hs | 4 +--- dhall/tests/Dhall/Test/TypeInference.hs | 3 +-- dhall/tests/Dhall/Test/Util.hs | 21 +++++++++++++++++---- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/dhall/tests/Dhall/Test/Format.hs b/dhall/tests/Dhall/Test/Format.hs index 6419c7fd6..e802ab478 100644 --- a/dhall/tests/Dhall/Test/Format.hs +++ b/dhall/tests/Dhall/Test/Format.hs @@ -7,7 +7,6 @@ import Dhall.Parser (Header (..)) import Dhall.Pretty (CharacterSet (..)) import Test.Tasty (TestTree) -import qualified Control.Monad as Monad import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO import qualified Dhall.Core as Core @@ -27,7 +26,7 @@ getTests = do let skip = [ "./tests/format/asciiA.dhall" ] - Monad.guard (path `notElem` skip) + path `Test.Util.pathNotIn` skip return path diff --git a/dhall/tests/Dhall/Test/Import.hs b/dhall/tests/Dhall/Test/Import.hs index dbd4d2721..8109e9825 100644 --- a/dhall/tests/Dhall/Test/Import.hs +++ b/dhall/tests/Dhall/Test/Import.hs @@ -5,13 +5,12 @@ module Dhall.Test.Import where import Control.Exception (SomeException) -import Data.Text (Text, isSuffixOf) +import Data.Text (Text) import Data.Void (Void) import System.FilePath (()) import Test.Tasty (TestTree) import qualified Control.Exception as Exception -import qualified Control.Monad as Monad import qualified Control.Monad.Trans.State.Strict as State import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO @@ -72,7 +71,7 @@ getTests = do successTests <- Test.Util.discover (Turtle.chars <* "A.dhall") successTest (do path <- Turtle.lstree (importDirectory "success") - Monad.guard (path `Test.Util.pathNotElem` flakyTests) + path `Test.Util.pathNotIn` flakyTests return path ) @@ -96,8 +95,9 @@ getTests = do #endif ] - _ <- Monad.guard (path `Test.Util.pathNotElem` expectedSuccesses) - _ <- Monad.guard (not ("ENV.dhall" `isSuffixOf` Text.pack path)) + path `Test.Util.pathNotIn` expectedSuccesses + "ENV.dhall" `Test.Util.pathNotSuffixOf` path + return path ) let testTree = diff --git a/dhall/tests/Dhall/Test/Normalization.hs b/dhall/tests/Dhall/Test/Normalization.hs index 8ad57d498..3d8bbe9e5 100644 --- a/dhall/tests/Dhall/Test/Normalization.hs +++ b/dhall/tests/Dhall/Test/Normalization.hs @@ -8,8 +8,6 @@ import Dhall.Core (Expr (..), Var (..), throws) import System.FilePath (()) import Test.Tasty (TestTree) -import qualified Control.Monad as Monad -import qualified Data.List as List import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO import qualified Dhall.Context as Context @@ -36,7 +34,7 @@ getTests = do let normalizationFiles = do path <- FilePath.normalise <$> Turtle.lstree normalizationDirectory - Monad.guard (not (FilePath.normalise unitDirectory `List.isPrefixOf` path)) + unitDirectory `Test.Util.pathNotPrefixOf` path return path diff --git a/dhall/tests/Dhall/Test/TypeInference.hs b/dhall/tests/Dhall/Test/TypeInference.hs index bf6c4e39b..8579fd737 100644 --- a/dhall/tests/Dhall/Test/TypeInference.hs +++ b/dhall/tests/Dhall/Test/TypeInference.hs @@ -9,7 +9,6 @@ import System.FilePath (()) import Test.Tasty (TestTree) import qualified Control.Exception as Exception -import qualified Control.Monad as Monad import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO import qualified Dhall.Core as Core @@ -37,7 +36,7 @@ getTests = do , typeInferenceDirectory "success/CacheImportsCanonicalizeA.dhall" ] - Monad.guard (path `notElem` skip) + path `Test.Util.pathNotIn` skip return path diff --git a/dhall/tests/Dhall/Test/Util.hs b/dhall/tests/Dhall/Test/Util.hs index f90f1861c..12930eb67 100644 --- a/dhall/tests/Dhall/Test/Util.hs +++ b/dhall/tests/Dhall/Test/Util.hs @@ -20,12 +20,15 @@ module Dhall.Test.Util , assertDoesntTypeCheck , discover , Dhall.Test.Util.testCase - , pathNotElem + , pathIn + , pathNotIn + , pathNotPrefixOf + , pathNotSuffixOf , toDhallPath , managedTestEnvironment ) where -import Control.Applicative (liftA2, (<|>)) +import Control.Applicative (Alternative, liftA2, (<|>)) import Control.Exception (tryJust) import Control.Monad (guard) import Control.Monad.Trans.State.Strict (StateT) @@ -66,6 +69,7 @@ import qualified Turtle #if defined(WITH_HTTP) && defined(NETWORK_TESTS) import qualified Data.Foldable +import qualified Data.List as List #else import Control.Monad.IO.Class (MonadIO (..)) import Dhall.Core (URL (..), File (..), Directory (..)) @@ -307,8 +311,17 @@ testCase prefix expectedFailures assertion = where test = Test.Tasty.HUnit.testCase (Text.unpack prefix) assertion -pathNotElem :: FilePath -> [FilePath] -> Bool -pathNotElem this = not . any (FilePath.equalFilePath this) +pathIn :: Alternative f => FilePath -> [FilePath] -> f () +pathIn this = guard . any (FilePath.equalFilePath this) + +pathNotIn :: Alternative f => FilePath -> [FilePath] -> f () +pathNotIn this = guard . not . any (FilePath.equalFilePath this) + +pathNotPrefixOf :: Alternative f => FilePath -> FilePath -> f () +pathNotPrefixOf this = guard . not . List.isPrefixOf this + +pathNotSuffixOf :: Alternative f => FilePath -> FilePath -> f () +pathNotSuffixOf this = guard . not . List.isSuffixOf this {-| Path names on Windows are not valid Dhall paths due to using backslashes instead of forwardslashes to separate path components. This utility fixes From 94026e90c4dc4530d306dcb7ca39b1f68c2aa1c4 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 16:50:12 +0200 Subject: [PATCH 08/22] Normalize filepath in guards for path selection --- dhall/tests/Dhall/Test/Util.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dhall/tests/Dhall/Test/Util.hs b/dhall/tests/Dhall/Test/Util.hs index 12930eb67..9371abc2d 100644 --- a/dhall/tests/Dhall/Test/Util.hs +++ b/dhall/tests/Dhall/Test/Util.hs @@ -318,10 +318,12 @@ pathNotIn :: Alternative f => FilePath -> [FilePath] -> f () pathNotIn this = guard . not . any (FilePath.equalFilePath this) pathNotPrefixOf :: Alternative f => FilePath -> FilePath -> f () -pathNotPrefixOf this = guard . not . List.isPrefixOf this +pathNotPrefixOf this = + guard . not . List.isPrefixOf (FilePath.normalise this) . FilePath.normalise pathNotSuffixOf :: Alternative f => FilePath -> FilePath -> f () -pathNotSuffixOf this = guard . not . List.isSuffixOf this +pathNotSuffixOf this = + guard . not . List.isSuffixOf (FilePath.normalise this) . FilePath.normalise {-| Path names on Windows are not valid Dhall paths due to using backslashes instead of forwardslashes to separate path components. This utility fixes From 7ec27c271b8dec912c5f5d1cef79a3b4aaf6b257 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 17:28:13 +0200 Subject: [PATCH 09/22] Added turtle-1.6.2 to Nix setup --- nix/packages/turtle.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 nix/packages/turtle.nix diff --git a/nix/packages/turtle.nix b/nix/packages/turtle.nix new file mode 100644 index 000000000..68b1df9b5 --- /dev/null +++ b/nix/packages/turtle.nix @@ -0,0 +1,25 @@ +{ mkDerivation, ansi-wl-pprint, async, base, bytestring, clock +, containers, directory, doctest, exceptions, filepath, foldl +, hostname, lib, managed, optional-args, optparse-applicative +, process, stm, streaming-commons, tasty, tasty-bench, tasty-hunit +, temporary, text, time, transformers, unix, unix-compat +}: +mkDerivation { + pname = "turtle"; + version = "1.6.2"; + sha256 = "1a0166b11566e956bcec6f37cfcfc4d0647d4540479545d4858d2ff8c43a5b2d"; + revision = "3"; + editedCabalFile = "19i3n3hd2a0rkdz1ikwdgwhg4ds5pcfah25vgk0jnmwf71h0qwbm"; + libraryHaskellDepends = [ + ansi-wl-pprint async base bytestring clock containers directory + exceptions filepath foldl hostname managed optional-args + optparse-applicative process stm streaming-commons temporary text + time transformers unix unix-compat + ]; + testHaskellDepends = [ + base doctest filepath tasty tasty-hunit temporary + ]; + benchmarkHaskellDepends = [ base tasty-bench text ]; + description = "Shell programming, Haskell-style"; + license = lib.licenses.bsd3; +} From 7abe9823d1c75ae145ba470314ab3b6aa008f790 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 17:50:58 +0200 Subject: [PATCH 10/22] Unconditionally import Data.List in Dhall.Test.Util --- dhall/tests/Dhall/Test/Util.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dhall/tests/Dhall/Test/Util.hs b/dhall/tests/Dhall/Test/Util.hs index 9371abc2d..ee2eefb32 100644 --- a/dhall/tests/Dhall/Test/Util.hs +++ b/dhall/tests/Dhall/Test/Util.hs @@ -54,6 +54,7 @@ import qualified Control.Exception import qualified Control.Foldl as Foldl import qualified Control.Monad.Trans.State.Strict as State import qualified Data.Functor +import qualified Data.List as List import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO import qualified Dhall.Context @@ -69,7 +70,6 @@ import qualified Turtle #if defined(WITH_HTTP) && defined(NETWORK_TESTS) import qualified Data.Foldable -import qualified Data.List as List #else import Control.Monad.IO.Class (MonadIO (..)) import Dhall.Core (URL (..), File (..), Directory (..)) From 4ed8bf7d23804e92217a37ab4ca88a704e456039 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Wed, 5 Jun 2024 18:33:44 +0200 Subject: [PATCH 11/22] Added small comment on the use of toDhallPath in Dhall.Test.Tags --- dhall/tests/Dhall/Test/Tags.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dhall/tests/Dhall/Test/Tags.hs b/dhall/tests/Dhall/Test/Tags.hs index 5ede3e4e7..41fdc9ba2 100644 --- a/dhall/tests/Dhall/Test/Tags.hs +++ b/dhall/tests/Dhall/Test/Tags.hs @@ -29,6 +29,8 @@ getTests = do tagsTest :: Text -> TestTree tagsTest prefix = Tasty.HUnit.testCase (Text.unpack prefix) $ do + -- The use of toDhallPah is a hack to ensure we always get the same file + -- paths, i.e. ones with a '.' prefixed and UNIX path separators. let inputFile = Text.unpack (Test.Util.toDhallPath prefix <> ".dhall") let outputFile = Text.unpack (prefix <> ".tags") From a35c384a987ca3a24f3e5c6cf0cd442da60436f0 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 00:00:54 +0200 Subject: [PATCH 12/22] Ran stylish-haskell --- dhall/src/Dhall/Diff.hs | 12 ++++++------ dhall/tests/Dhall/Test/Import.hs | 4 ++-- dhall/tests/Dhall/Test/Normalization.hs | 8 ++++---- dhall/tests/Dhall/Test/Parser.hs | 8 ++++---- dhall/tests/Dhall/Test/Tags.hs | 6 +++--- dhall/tests/Dhall/Test/Util.hs | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dhall/src/Dhall/Diff.hs b/dhall/src/Dhall/Diff.hs index 10d538d9f..46f332b78 100644 --- a/dhall/src/Dhall/Diff.hs +++ b/dhall/src/Dhall/Diff.hs @@ -41,16 +41,16 @@ import Dhall.Syntax import Numeric.Natural (Natural) import Prettyprinter (Doc, Pretty) -import qualified Data.Algorithm.Diff as Algo.Diff +import qualified Data.Algorithm.Diff as Algo.Diff import qualified Data.List.NonEmpty import qualified Data.Set import qualified Data.Text -import qualified Data.Time as Time +import qualified Data.Time as Time import qualified Dhall.Map -import qualified Dhall.Normalize as Normalize -import qualified Dhall.Pretty.Internal as Internal -import qualified Dhall.Syntax as Syntax -import qualified Prettyprinter as Pretty +import qualified Dhall.Normalize as Normalize +import qualified Dhall.Pretty.Internal as Internal +import qualified Dhall.Syntax as Syntax +import qualified Prettyprinter as Pretty {-| This type is a `Doc` enriched with a `same` flag to efficiently track if any difference was detected diff --git a/dhall/tests/Dhall/Test/Import.hs b/dhall/tests/Dhall/Test/Import.hs index 8109e9825..61bb72b7e 100644 --- a/dhall/tests/Dhall/Test/Import.hs +++ b/dhall/tests/Dhall/Test/Import.hs @@ -25,8 +25,8 @@ import qualified Test.Tasty.HUnit as Tasty.HUnit import qualified Turtle #if defined(WITH_HTTP) && defined(NETWORK_TESTS) -import qualified Network.HTTP.Client as HTTP -import qualified Network.HTTP.Client.TLS as HTTP +import qualified Network.HTTP.Client as HTTP +import qualified Network.HTTP.Client.TLS as HTTP #endif diff --git a/dhall/tests/Dhall/Test/Normalization.hs b/dhall/tests/Dhall/Test/Normalization.hs index 3d8bbe9e5..32b9b16f2 100644 --- a/dhall/tests/Dhall/Test/Normalization.hs +++ b/dhall/tests/Dhall/Test/Normalization.hs @@ -2,11 +2,11 @@ module Dhall.Test.Normalization where -import Data.Text (Text) -import Data.Void (Void) -import Dhall.Core (Expr (..), Var (..), throws) +import Data.Text (Text) +import Data.Void (Void) +import Dhall.Core (Expr (..), Var (..), throws) import System.FilePath (()) -import Test.Tasty (TestTree) +import Test.Tasty (TestTree) import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO diff --git a/dhall/tests/Dhall/Test/Parser.hs b/dhall/tests/Dhall/Test/Parser.hs index 5d5245739..5f214c6b1 100644 --- a/dhall/tests/Dhall/Test/Parser.hs +++ b/dhall/tests/Dhall/Test/Parser.hs @@ -2,11 +2,11 @@ module Dhall.Test.Parser where -import Data.Text (Text) -import Data.Void (Void) -import Dhall.Core (Binding (..), Expr (..), Import, Var (..)) +import Data.Text (Text) +import Data.Void (Void) +import Dhall.Core (Binding (..), Expr (..), Import, Var (..)) import System.FilePath (()) -import Test.Tasty (TestTree) +import Test.Tasty (TestTree) import qualified Control.Monad as Monad import qualified Data.Bifunctor as Bifunctor diff --git a/dhall/tests/Dhall/Test/Tags.hs b/dhall/tests/Dhall/Test/Tags.hs index 41fdc9ba2..7f753a825 100644 --- a/dhall/tests/Dhall/Test/Tags.hs +++ b/dhall/tests/Dhall/Test/Tags.hs @@ -2,10 +2,10 @@ module Dhall.Test.Tags where -import Data.Text (Text) -import Dhall.Util (Input (..)) +import Data.Text (Text) +import Dhall.Util (Input (..)) import System.FilePath (()) -import Test.Tasty (TestTree) +import Test.Tasty (TestTree) import qualified Data.Text as Text import qualified Data.Text.IO as Text.IO diff --git a/dhall/tests/Dhall/Test/Util.hs b/dhall/tests/Dhall/Test/Util.hs index ee2eefb32..c7ffb724b 100644 --- a/dhall/tests/Dhall/Test/Util.hs +++ b/dhall/tests/Dhall/Test/Util.hs @@ -72,7 +72,7 @@ import qualified Turtle import qualified Data.Foldable #else import Control.Monad.IO.Class (MonadIO (..)) -import Dhall.Core (URL (..), File (..), Directory (..)) +import Dhall.Core (Directory (..), File (..), URL (..)) import Lens.Family.State.Strict (zoom) import qualified Data.Foldable From 4ff832c8154f979728c3ecb5e6a81201e24aad78 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 00:41:22 +0200 Subject: [PATCH 13/22] Log pkg-config path of libsodium in the CI --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4316dbadf..757df46f8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,12 +53,13 @@ jobs: ${{ matrix.os.runner }}-${{ runner.arch }}- path: | ${{ steps.setup-haskell-cabal.outputs.stack-root }} - - name: Install libsodium + - name: "Install libsodium" shell: bash run: | if [ '${{matrix.os.runner}}' == 'ubuntu-latest' ]; then sudo apt-get install -y libsodium-dev fi + pkg-config --path sodium || true - name: "Build" shell: bash run: | From 535e3765b747df0c408383917b05603d6681dbca Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 00:50:59 +0200 Subject: [PATCH 14/22] Log the libsodium version in the CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 757df46f8..fab6d20fd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: if [ '${{matrix.os.runner}}' == 'ubuntu-latest' ]; then sudo apt-get install -y libsodium-dev fi - pkg-config --path sodium || true + pkg-config --libs --modversion sodium || true - name: "Build" shell: bash run: | From ec8e1e9843808dbb32afbd7d1ebb84a51fb4f8b7 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 01:03:56 +0200 Subject: [PATCH 15/22] Do not install a GHC with ghcup in the CI --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fab6d20fd..e0e88c513 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,6 +45,7 @@ jobs: with: enable-stack: true stack-version: "latest" + stack-no-global: true - name: "Cache" uses: actions/cache@v3 with: From 5566dd133b0999cdca9a7ca82f2665ad1b1cd110 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 01:09:40 +0200 Subject: [PATCH 16/22] Fixed pkg-config output in the CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0e88c513..4193aa7bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,7 +60,7 @@ jobs: if [ '${{matrix.os.runner}}' == 'ubuntu-latest' ]; then sudo apt-get install -y libsodium-dev fi - pkg-config --libs --modversion sodium || true + pkg-config --print-errors --libs --exists libsodium || true - name: "Build" shell: bash run: | From eb61852871c29b578753ceb98edf7c4d0639539f Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 01:17:46 +0200 Subject: [PATCH 17/22] Bump cache_generation --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4193aa7bd..be0e0aa7d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ env: - cache_generation: 2021-06-22 + cache_generation: 2024-06-13 # NOTE: Please keep .mergify.yml in sync when adding or removing any jobs. name: main @@ -60,7 +60,7 @@ jobs: if [ '${{matrix.os.runner}}' == 'ubuntu-latest' ]; then sudo apt-get install -y libsodium-dev fi - pkg-config --print-errors --libs --exists libsodium || true + pkg-config --print-errors --libs libsodium || true - name: "Build" shell: bash run: | From 9f1e38ee9444e191e2b9ed29421b8be4be464496 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 01:27:38 +0200 Subject: [PATCH 18/22] Bumped version of some GH actions --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index be0e0aa7d..90180e095 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,7 +47,7 @@ jobs: stack-version: "latest" stack-no-global: true - name: "Cache" - uses: actions/cache@v3 + uses: actions/cache@v4 with: key: ${{ matrix.os.runner }}-${{ runner.arch }}-${{ hashFiles(matrix.stack-yaml) }}-${{ env.cache_generation }} restore-keys: | @@ -157,7 +157,7 @@ jobs: package 'dhall-yaml' "bin/dhall-to-yaml-ng${exe}" "bin/yaml-to-dhall${exe}" - name: "Upload package" if: ${{ matrix.stack-yaml == 'stack.yaml' }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: 'dhall-${{ runner.os }}-${{ runner.arch }}.${{ matrix.os.file-extension }}' path: 'dhall-*${{ runner.os }}-${{ runner.arch }}.${{ matrix.os.file-extension }}' From 7836f962b2822ab158a5995dc9a1fa040864fe4f Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 01:29:30 +0200 Subject: [PATCH 19/22] Changed cache key --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90180e095..50548beb9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,9 +49,9 @@ jobs: - name: "Cache" uses: actions/cache@v4 with: - key: ${{ matrix.os.runner }}-${{ runner.arch }}-${{ hashFiles(matrix.stack-yaml) }}-${{ env.cache_generation }} + key: ${{ matrix.os.runner }}-${{ runner.arch }}-${{ env.cache_generation }}-${{ hashFiles(matrix.stack-yaml) }} restore-keys: | - ${{ matrix.os.runner }}-${{ runner.arch }}- + ${{ matrix.os.runner }}-${{ runner.arch }}-${{ env.cache_generation }}- path: | ${{ steps.setup-haskell-cabal.outputs.stack-root }} - name: "Install libsodium" From cb9edc701eaa61c21be78532b7b1984659fb888c Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 02:39:47 +0200 Subject: [PATCH 20/22] Small comment on pkg-config output --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 50548beb9..46bb70087 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,6 +60,7 @@ jobs: if [ '${{matrix.os.runner}}' == 'ubuntu-latest' ]; then sudo apt-get install -y libsodium-dev fi + echo "::debug::'pkg-config libsodium' output:" pkg-config --print-errors --libs libsodium || true - name: "Build" shell: bash From e9c6336b42c530ae2b87240e5cf80bbc2deb0e53 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Thu, 13 Jun 2024 13:48:53 +0200 Subject: [PATCH 21/22] Added .envrc to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 78a67da72..740c628d0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ cabal.sandbox.config cabal.project.local cabal.project.local~ .HTF/ +.envrc .ghc.environment.* .cache .history From 608773327c4784aeba46f9d18bfdfbfa84ac6bc0 Mon Sep 17 00:00:00 2001 From: Mann mit Hut Date: Mon, 17 Jun 2024 03:40:42 +0200 Subject: [PATCH 22/22] Fixed deprecation warnings in dhall-nixpkgs package --- dhall-nixpkgs/Main.hs | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/dhall-nixpkgs/Main.hs b/dhall-nixpkgs/Main.hs index a6cb69881..2690304ae 100644 --- a/dhall-nixpkgs/Main.hs +++ b/dhall-nixpkgs/Main.hs @@ -681,7 +681,7 @@ githubToNixpkgs GitHub{ name, uri, rev = maybeRev, hash, fetchSubmodules, direct ExitFailure _ -> die (FailedToFetchGitHubArchive args) case Text.lines text of - [ sha256, path ] -> return (r, sha256, Turtle.fromText path) + [ sha256, path ] -> return (r, sha256, Text.unpack path) _ -> die (FailedToParseNixPrefetchURL args) _ -> do @@ -706,7 +706,7 @@ githubToNixpkgs GitHub{ name, uri, rev = maybeRev, hash, fetchSubmodules, direct Right n -> do return n - return (rev, sha256, Turtle.fromText path) + return (rev, sha256, Text.unpack path) let finalName = case name of @@ -723,15 +723,11 @@ githubToNixpkgs GitHub{ name, uri, rev = maybeRev, hash, fetchSubmodules, direct then return () else die (MissingFile expressionFile) - expressionText <- Turtle.readTextFile expressionFile + expressionText <- Text.IO.readFile expressionFile - let expressionFileString = Turtle.encodeString expressionFile + expression <- Dhall.Core.throws (Dhall.Parser.exprFromText expressionFile expressionText) - expression <- Dhall.Core.throws (Dhall.Parser.exprFromText expressionFileString expressionText) - - let status = Dhall.Import.emptyStatus baseDirectoryString - where - baseDirectoryString = Turtle.encodeString baseDirectory + let status = Dhall.Import.emptyStatus baseDirectory dependencies <- Turtle.reduce Foldl.nub (State.evalStateT (findExternalDependencies expression) status) @@ -781,16 +777,11 @@ directoryToNixpkgs Directory{ name, directory, file, source, document, fixedOutp else do die (MissingFile expressionFile) - expressionText <- Turtle.readTextFile expressionFile - - let expressionFileString = Turtle.encodeString expressionFile + expressionText <- Text.IO.readFile expressionFile - expression <- Dhall.Core.throws (Dhall.Parser.exprFromText expressionFileString expressionText) + expression <- Dhall.Core.throws (Dhall.Parser.exprFromText expressionFile expressionText) - let status = Dhall.Import.emptyStatus directoryString - where - directoryString = - Turtle.encodeString (Turtle.directory expressionFile) + let status = Dhall.Import.emptyStatus (Turtle.directory expressionFile) dependencies <- Turtle.reduce Foldl.nub (State.evalStateT (findExternalDependencies expression) status) @@ -804,11 +795,9 @@ directoryToNixpkgs Directory{ name, directory, file, source, document, fixedOutp let buildDhallDirectoryPackage = "buildDhallDirectoryPackage" - let src | null directoryString = directoryString - | last directoryString == '/' = init directoryString - | otherwise = directoryString - where - directoryString = Turtle.encodeString directory + let src | null directory = directory + | last directory == '/' = init directory + | otherwise = directory let functionParams = makeNixFunctionParams buildDhallDirectoryPackage nixDependencies @@ -852,7 +841,7 @@ data Error | FailedToCloneRepository [Text] | FailedToParseNixPrefetchGit [Text] String | MissingFile FilePath - + renderError :: Error -> Text renderError e = case e of MissingSemanticIntegrityCheck url ->