diff --git a/appveyor.yml b/appveyor.yml index 75bc11ae6..98ea6b642 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,7 @@ branches: environment: STACK_ROOT: C:\sr - STACK_VERSION: 2.3.3 + STACK_VERSION: 2.5.1 matrix: - STACK_YAML: stack.yaml diff --git a/package.yaml b/package.yaml deleted file mode 100644 index 74b732c56..000000000 --- a/package.yaml +++ /dev/null @@ -1,191 +0,0 @@ -name: spago -version: 0.20.1 -github: "purescript/spago" -license: BSD3 -author: "Justin Woo, Fabrizio Ferrai" -maintainer: "@jusrin00, @fabferrai" -copyright: "2018-2020 Justin Woo, Fabrizio Ferrai" - -extra-source-files: -- README.md -- CHANGELOG.md -- templates/* - -ghc-options: - - -Wall - - -Wcompat - - -Wincomplete-record-updates - - -Wredundant-constraints - - -fprint-potential-instances - - -optP-Wno-nonportable-include-path - -flags: - static: - manual: true - default: false - -# Metadata used when publishing your package -# synopsis: Short description of your package -# category: Web - -# To avoid duplicated efforts in documentation and dealing with the -# complications of embedding Haddock markup inside cabal files, it is -# common to point users to the README.md file. -description: Please see the README on GitHub at - -default-extensions: -- ApplicativeDo -- BangPatterns -- BinaryLiterals -- ConstraintKinds -- DataKinds -- DefaultSignatures -- DeriveDataTypeable -- DeriveFoldable -- DeriveFunctor -- DeriveGeneric -- DeriveTraversable -- DerivingStrategies -- DoAndIfThenElse -- DuplicateRecordFields -- EmptyDataDecls -- ExistentialQuantification -- FlexibleContexts -- FlexibleInstances -- FunctionalDependencies -- GADTs -- GeneralizedNewtypeDeriving -- InstanceSigs -- KindSignatures -- LambdaCase -- LiberalTypeSynonyms -- MonadFailDesugaring -- MultiParamTypeClasses -- MultiWayIf -- NamedFieldPuns -- NoImplicitPrelude -- NoMonomorphismRestriction -- OverloadedStrings -- PartialTypeSignatures -- PatternGuards -- PolyKinds -- QuantifiedConstraints -- RankNTypes -- RecordWildCards -- ScopedTypeVariables -- StandaloneDeriving -- TupleSections -- TypeApplications -- TypeFamilies -- TypeSynonymInstances -- UndecidableInstances -- ViewPatterns - - -library: - source-dirs: src - dependencies: - - aeson - - aeson-pretty - - ansi-terminal - - async-pool - - base >= 4.7 && < 5 - - bower-json - - bytestring - - Cabal - - containers - - cryptonite - - dhall >= 1.38.0 - - directory >= 1.3.4.0 - - either - - file-embed - - filepath - - foldl - - fsnotify - - generic-lens - - Glob - - http-types - - http-client - - http-conduit - - lens-family-core - - megaparsec >=7.0 && <8.0 - - mtl - - network-uri - - open-browser - - optparse-applicative - - prettyprinter - - process - - retry - - rio >= 0.1.16.0 - - rio-orphans - - safe - - semver-range - - stm - - stringsearch - - tar - - template-haskell - - temporary - - text < 1.3 - - time - - transformers - - turtle - - unliftio - - unordered-containers - - utf8-string - - versions - - with-utf8 - - zlib - -executables: - spago: - main: Spago.hs - source-dirs: app - other-modules: [ Paths_spago ] - when: - - condition: flag(static) - then: - ghc-options: - - -main-is Spago - - -threaded - - -rtsopts - - -with-rtsopts=-N - - -static - - -O2 - cc-options: -static - ld-options: -static -pthread - else: - ghc-options: - - -main-is Spago - - -threaded - - -rtsopts - - -with-rtsopts=-N - dependencies: - - ansi-terminal - - base >= 4.7 && < 5 - - spago - - text < 1.3 - - turtle - - with-utf8 - -tests: - spec: - defaults: hspec/hspec@master - main: Main - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - dependencies: - - base >= 4.7 && < 5 - - containers - - directory - - extra - - hspec-megaparsec >=2.0 && <2.1 - - megaparsec >=7.0 && <8.0 - - process - - QuickCheck - - spago - - temporary - - text < 1.3 - - turtle - - versions diff --git a/spago.cabal b/spago.cabal index a89ddec8a..072718203 100644 --- a/spago.cabal +++ b/spago.cabal @@ -1,10 +1,4 @@ -cabal-version: 1.12 - --- This file has been generated from package.yaml by hpack version 0.33.0. --- --- see: https://github.com/sol/hpack --- --- hash: a855e35ce4d9df2ee719d838aa3683ecdf43c715295b09623e7a12ddcbd0dddd +cabal-version: 2.4 name: spago version: 0.20.1 @@ -14,7 +8,7 @@ bug-reports: https://github.com/purescript/spago/issues author: Justin Woo, Fabrizio Ferrai maintainer: @jusrin00, @fabferrai copyright: 2018-2020 Justin Woo, Fabrizio Ferrai -license: BSD3 +license: BSD-3-Clause license-file: LICENSE build-type: Simple extra-source-files: @@ -36,49 +30,95 @@ source-repository head type: git location: https://github.com/purescript/spago -flag static - manual: True - default: False +common defaults + default-language: Haskell2010 + default-extensions: + ApplicativeDo + BangPatterns + BinaryLiterals + ConstraintKinds + DataKinds + DefaultSignatures + DeriveDataTypeable + DeriveFoldable + DeriveFunctor + DeriveGeneric + DeriveTraversable + DerivingStrategies + DoAndIfThenElse + DuplicateRecordFields + EmptyDataDecls + ExistentialQuantification + FlexibleContexts + FlexibleInstances + FunctionalDependencies + GADTs + GeneralizedNewtypeDeriving + InstanceSigs + KindSignatures + LambdaCase + LiberalTypeSynonyms + MonadFailDesugaring + MultiParamTypeClasses + MultiWayIf + NamedFieldPuns + NoImplicitPrelude + NoMonomorphismRestriction + OverloadedStrings + PartialTypeSignatures + PatternGuards + PolyKinds + QuantifiedConstraints + RankNTypes + RecordWildCards + ScopedTypeVariables + StandaloneDeriving + TupleSections + TypeApplications + TypeFamilies + TypeSynonymInstances + UndecidableInstances + ViewPatterns library + import: defaults + hs-source-dirs: src exposed-modules: - Spago.Async - Spago.Bower - Spago.Build - Spago.CLI - Spago.Command.Init - Spago.Command.Ls - Spago.Command.Path - Spago.Command.Verify - Spago.Config - Spago.Dhall - Spago.DryRun - Spago.Env - Spago.FetchPackage - Spago.Git - Spago.GitHub - Spago.GlobalCache - Spago.Messages - Spago.Packages - Spago.PackageSet - Spago.Prelude - Spago.PscPackage - Spago.Purs - Spago.RunEnv - Spago.Templates - Spago.TH - Spago.Types - Spago.Version - Spago.Watch + Spago.Async + Spago.Bower + Spago.Build + Spago.CLI + Spago.Command.Init + Spago.Command.Ls + Spago.Command.Path + Spago.Command.Verify + Spago.Config + Spago.Dhall + Spago.DryRun + Spago.Env + Spago.FetchPackage + Spago.Git + Spago.GitHub + Spago.GlobalCache + Spago.Messages + Spago.Packages + Spago.PackageSet + Spago.Prelude + Spago.PscPackage + Spago.Purs + Spago.RunEnv + Spago.Templates + Spago.TH + Spago.Types + Spago.Version + Spago.Watch other-modules: - Paths_spago - hs-source-dirs: - src - default-extensions: ApplicativeDo BangPatterns BinaryLiterals ConstraintKinds DataKinds DefaultSignatures DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable DerivingStrategies DoAndIfThenElse DuplicateRecordFields EmptyDataDecls ExistentialQuantification FlexibleContexts FlexibleInstances FunctionalDependencies GADTs GeneralizedNewtypeDeriving InstanceSigs KindSignatures LambdaCase LiberalTypeSynonyms MonadFailDesugaring MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude NoMonomorphismRestriction OverloadedStrings PartialTypeSignatures PatternGuards PolyKinds QuantifiedConstraints RankNTypes RecordWildCards ScopedTypeVariables StandaloneDeriving TupleSections TypeApplications TypeFamilies TypeSynonymInstances UndecidableInstances ViewPatterns - ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wredundant-constraints -fprint-potential-instances -optP-Wno-nonportable-include-path + Paths_spago + autogen-modules: + Paths_spago + ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wredundant-constraints build-depends: - Cabal - , Glob + Glob , aeson , aeson-pretty , ansi-terminal @@ -127,16 +167,15 @@ library , versions , with-utf8 , zlib - default-language: Haskell2010 executable spago + import: defaults main-is: Spago.hs other-modules: - Paths_spago - hs-source-dirs: - app - default-extensions: ApplicativeDo BangPatterns BinaryLiterals ConstraintKinds DataKinds DefaultSignatures DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable DerivingStrategies DoAndIfThenElse DuplicateRecordFields EmptyDataDecls ExistentialQuantification FlexibleContexts FlexibleInstances FunctionalDependencies GADTs GeneralizedNewtypeDeriving InstanceSigs KindSignatures LambdaCase LiberalTypeSynonyms MonadFailDesugaring MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude NoMonomorphismRestriction OverloadedStrings PartialTypeSignatures PatternGuards PolyKinds QuantifiedConstraints RankNTypes RecordWildCards ScopedTypeVariables StandaloneDeriving TupleSections TypeApplications TypeFamilies TypeSynonymInstances UndecidableInstances ViewPatterns - ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wredundant-constraints -fprint-potential-instances -optP-Wno-nonportable-include-path + Paths_spago + autogen-modules: + Paths_spago + hs-source-dirs: app build-depends: ansi-terminal , base >=4.7 && <5 @@ -144,29 +183,22 @@ executable spago , text <1.3 , turtle , with-utf8 - if flag(static) - ghc-options: -main-is Spago -threaded -rtsopts -with-rtsopts=-N -static -O2 - cc-options: -static - ld-options: -static -pthread - else - ghc-options: -main-is Spago -threaded -rtsopts -with-rtsopts=-N - default-language: Haskell2010 + ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Spago -optP-Wno-nonportable-include-path test-suite spec + import: defaults type: exitcode-stdio-1.0 + hs-source-dirs: test main-is: Main.hs other-modules: - BumpVersionSpec - Spago.PursSpec - SpagoSpec - Spec - UnitSpec - Utils - Paths_spago - hs-source-dirs: - test - default-extensions: ApplicativeDo BangPatterns BinaryLiterals ConstraintKinds DataKinds DefaultSignatures DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable DerivingStrategies DoAndIfThenElse DuplicateRecordFields EmptyDataDecls ExistentialQuantification FlexibleContexts FlexibleInstances FunctionalDependencies GADTs GeneralizedNewtypeDeriving InstanceSigs KindSignatures LambdaCase LiberalTypeSynonyms MonadFailDesugaring MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude NoMonomorphismRestriction OverloadedStrings PartialTypeSignatures PatternGuards PolyKinds QuantifiedConstraints RankNTypes RecordWildCards ScopedTypeVariables StandaloneDeriving TupleSections TypeApplications TypeFamilies TypeSynonymInstances UndecidableInstances ViewPatterns - ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wredundant-constraints -fprint-potential-instances -optP-Wno-nonportable-include-path -threaded -rtsopts -with-rtsopts=-N -main-is Main + BumpVersionSpec + Spago.PursSpec + SpagoSpec + Spec + UnitSpec + Utils + Paths_spago + ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Main build-depends: QuickCheck , base >=4.7 && <5 @@ -182,5 +214,7 @@ test-suite spec , text <1.3 , turtle , versions - default-language: Haskell2010 - build-tool-depends: hspec-discover:hspec-discover == 2.* + build-tool-depends: + hspec-discover:hspec-discover == 2.* + -- we need the the executable available for the end to end tests + , spago:spago -any diff --git a/src/Spago/Bower.hs b/src/Spago/Bower.hs index 52d80e9df..01aa3836e 100644 --- a/src/Spago/Bower.hs +++ b/src/Spago/Bower.hs @@ -11,7 +11,7 @@ import qualified Data.Aeson as Aeson import qualified Data.Aeson.Encode.Pretty as Pretty import qualified Data.HashMap.Strict as HashMap import qualified Data.Text as Text -import qualified Distribution.System as OS +import qualified System.Info import qualified Turtle import qualified Web.Bower.PackageMeta as Bower import qualified Data.Text.Lazy as LazyText @@ -135,8 +135,8 @@ mkDependencies = do bowerVersion <- mkBowerVersion bowerName version repo pure (bowerName, bowerVersion) - getJobs = case OS.buildOS of + getJobs = case System.Info.os of -- Windows sucks so lets make it slow for them! -- (just kidding, its a bug: https://github.com/bower/spec/issues/79) - OS.Windows -> pure $ Jobs 1 - _ -> view (the @Jobs) + "mingw32" -> pure $ Jobs 1 + _ -> view (the @Jobs) diff --git a/src/Spago/Command/Ls.hs b/src/Spago/Command/Ls.hs index c5b2fa197..1aebca2e4 100644 --- a/src/Spago/Command/Ls.hs +++ b/src/Spago/Command/Ls.hs @@ -71,7 +71,7 @@ formatPackageNames = \case , json_repo = toJSON loc , json_version = version } - asJson (PackageName{..}, Package { location = loc@(Local _), ..}) + asJson (PackageName{..}, Package { location = loc@(Local _) }) = JsonPackageOutput { json_packageName = packageName , json_repo = toJSON loc diff --git a/src/Spago/Prelude.hs b/src/Spago/Prelude.hs index a446c2d81..de0037859 100644 --- a/src/Spago/Prelude.hs +++ b/src/Spago/Prelude.hs @@ -81,9 +81,9 @@ import qualified Data.Text.Prettyprint.Doc.Render.Text as PrettyText import qualified Data.Time as Time import Dhall (Text) import qualified Dhall.Core -import qualified Distribution.System as OS import qualified RIO import qualified System.FilePath as FilePath +import qualified System.Info import qualified System.IO import qualified Turtle import qualified UnliftIO.Directory as Directory @@ -98,7 +98,6 @@ import Data.Either as X import Data.Either.Validation (Validation (..)) import Data.Foldable as X import Data.Generics.Product (the, HasType(..)) -import Data.List.NonEmpty (NonEmpty (..)) import Data.Maybe as X import Data.Sequence (Seq (..)) import Data.Text.Prettyprint.Doc (Pretty) @@ -249,8 +248,8 @@ pretty = PrettyText.renderStrict -- first try the `.cmd` version. findExecutable :: MonadIO m => String -> m (Maybe Text) findExecutable x = - fmap (fmap Text.pack) $ case OS.buildOS of - OS.Windows -> Directory.findExecutable (x <> ".cmd") >>= \case + fmap (fmap Text.pack) $ case System.Info.os of + "mingw32" -> Directory.findExecutable (x <> ".cmd") >>= \case Nothing -> Directory.findExecutable x success -> pure success _ -> Directory.findExecutable x diff --git a/src/Spago/RunEnv.hs b/src/Spago/RunEnv.hs index 933eb4de5..d977fddcc 100644 --- a/src/Spago/RunEnv.hs +++ b/src/Spago/RunEnv.hs @@ -5,8 +5,8 @@ import Spago.Env import System.Console.ANSI (hSupportsANSIWithoutEmulation) import qualified System.Environment as Env -import qualified Distribution.System as OS import qualified RIO +import qualified System.Info import qualified Turtle import qualified Spago.Config as Config @@ -118,8 +118,8 @@ withPublishEnv app = do envGitCmd <- getGit envBowerCmd <- BowerCmd <$> -- workaround windows issue: https://github.com/haskell/process/issues/140 - case OS.buildOS of - OS.Windows -> do + case System.Info.os of + "mingw32" -> do let bowers = Turtle.inproc "where" ["bower.cmd"] empty Turtle.lineToText <$> Turtle.single (Turtle.limit 1 bowers) _ -> findExecutableOrDie "bower" diff --git a/stack.yaml b/stack.yaml index cce1108ba..cca49cd88 100644 --- a/stack.yaml +++ b/stack.yaml @@ -5,7 +5,7 @@ extra-deps: - async-pool-0.9.1@sha256:4015140f896c3f1652b06a679b0ade2717d05557970c283ea2c372a71be2a6a1,1605 - base-compat-0.11.1@sha256:e49c1ce84f556621ef1142a169e4349049c516f5b3e3c3ec6830be503e7d4a93,7140 - binary-instances-1.0.0.1@sha256:e234be994da675479a3661f050d4a1d53565c9ed7786d9a68b7a29ba8b54b5a7,2659 -- dhall-1.38.0 +- dhall-1.38.1 - directory-1.3.6.1@sha256:3dc9c69c8e09ec95a7a45c6d06abe0f0d2f604439c37e5f88e5a6c335b088d71,2810 - generic-lens-2.0.0.0@sha256:7409fa0ce540d0bd41acf596edd1c5d0c0ab1cd1294d514cf19c5c24e8ef2550,3866 - generic-lens-core-2.0.0.0@sha256:40b063c4a1399b3cdb19f2df1fae5a1a82f3313015c7c3e47fc23b8ef1b3e443,2913 @@ -19,20 +19,19 @@ extra-deps: - process-1.6.10.0@sha256:c0d2d8adaca7cea7ceaa60e67b61c775dc03727b83bdb1c97aa8cbeac9f5dd84,2469 - repline-0.4.0.0@sha256:3324479e497d27c40c3d4762bffc52058f9921621d20d2947dcf9a554b94cd0d,2253 - rio-0.1.18.0@sha256:067914d6ae9df1704902ecd1dd92b2c3d150216f7b924ce5aa57771a2ef3b99b,3688 -- semver-range-0.2.8@sha256:44918080c220cf67b6e7c8ad16f01f3cfe1ac69d4f72e528e84d566348bb23c3,1941 +- semver-range-0.2.8 - th-env-0.1.0.2@sha256:d8f1f37f42a8f1a22404d7d0579528af18f5dac7232cca6bdbd5117c115a0ad5,1370 - time-1.8.0.4@sha256:3f6eddf238b828eb4f82683acce1c3afe64784f0d20114239b738c123316c85c,5494 - unix-2.7.2.2@sha256:9e93f93cc5a065248120136e83a0a6d1ce93d6eb5ef2a2543f9593e93e164d24,3496 - Win32-2.8.5.0@sha256:50c11fce7ec29c750f199eec0bc97d42e9b8ca80abfbe068c0f474a3727b60ae,4277 -# Using a patched version as upstream doesn't support GHC 8.6.5 (and newer) on Windows -# See https://github.com/serokell/haskell-with-utf8/issues/9 -- github: f-f/haskell-with-utf8 - commit: 8ae743ac6503a4c494ea3bd52f1fe7d72f9f125d +- with-utf8-1.0.2.2 allow-newer: true nix: packages: [zlib] - -# This is so we don't depend on libtinfo flags: + aeson-pretty: + lib-only: true + # This is so we don't depend on libtinfo haskeline: terminfo: false + examples: false