Skip to content

Commit 10d7f05

Browse files
committed
Merge branch 'master' into faster-index-populate
Conflicts: src/Stack/PackageIndex.hs
2 parents 2af5748 + 644478f commit 10d7f05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+990
-833
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ install:
2929
- cabal --version
3030
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
3131
- travis_retry cabal update
32-
- cabal install cpphs
33-
- cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls
32+
- cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0
3433

3534
script:
3635
- if [ -f configure.ac ]; then autoreconf -i; fi
37-
- cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
36+
- cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options=-O0 # -v2 provides useful information for debugging
3837
- cabal build # this builds all libraries and executables (including tests/benchmarks)
3938
- cabal test
4039
- cabal check
4140
- cabal sdist # tests that a source-distribution can be generated
4241

4342
- cabal copy
4443
- cd test/integration
45-
- stack setup
46-
- stack test
44+
# Takes too long for now
45+
# - stack setup
46+
# - stack test
4747
- cd ../..
4848

4949
# Check that the resulting source distribution can be built & installed.

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* Fall back to cabal dependency solver when a snapshot can't be found
44
* Basic implementation of `stack new` [#137](https://github.com/commercialhaskell/stack/issues/137)
5+
* Build haddocks for dependencies [#143](https://github.com/commercialhaskell/stack/issues/143)
6+
* `stack solver` command [#364](https://github.com/commercialhaskell/stack/issues/364)
57

68
## 0.0.3
79

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ A full description of the architecture
5656
please see
5757
[the FAQ](https://github.com/commercialhaskell/stack/wiki/FAQ).
5858
* For general questions, comments, feedback and support please write
59-
to
60-
[the Commercial Haskell mailing list](https://groups.google.com/d/forum/commercialhaskell).
59+
to [the stack mailing list](https://groups.google.com/d/forum/haskell-stack).
6160
* For bugs, issues, or requests please
6261
[open an issue](https://github.com/commercialhaskell/stack/issues/new).
6362

src/Data/Aeson/Extended.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import Data.Text (unpack, Text)
1515
import Data.Monoid ((<>))
1616

1717
(.:) :: FromJSON a => Object -> Text -> Parser a
18-
(.:) o p = modifyFailure (("failed to parse field " <> unpack p <> ": ") <>) (o A..: p)
18+
(.:) o p = modifyFailure (("failed to parse field '" <> unpack p <> "': ") <>) (o A..: p)
1919
{-# INLINE (.:) #-}
2020

2121
(.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a)
22-
(.:?) o p = modifyFailure (("failed to parse field " <> unpack p <> ": ") <>) (o A..:? p)
22+
(.:?) o p = modifyFailure (("failed to parse field '" <> unpack p <> "': ") <>) (o A..:? p)
2323
{-# INLINE (.:?) #-}

src/Data/Binary/VersionTagged.hs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
11
{-# LANGUAGE OverloadedStrings #-}
2+
{-# LANGUAGE ScopedTypeVariables #-}
23
-- | Tag a Binary instance with the stack version number to ensure we're
34
-- reading a compatible format.
45
module Data.Binary.VersionTagged
56
( taggedDecodeOrLoad
67
, taggedEncodeFile
8+
, BinarySchema (..)
79
) where
810

911
import Control.Monad.IO.Class (MonadIO, liftIO)
1012
import Data.Binary (Binary (..), encodeFile, decodeFileOrFail, putWord8, getWord8)
1113
import Control.Exception.Enclosed (tryIO)
12-
import qualified Paths_stack
13-
import Stack.Types.Version (Version, fromCabalVersion)
1414
import System.FilePath (takeDirectory)
1515
import System.Directory (createDirectoryIfMissing)
1616
import qualified Data.ByteString as S
1717
import Data.ByteString (ByteString)
1818
import Control.Monad (forM_, when)
19-
20-
tag :: Version
21-
tag = fromCabalVersion Paths_stack.version
19+
import Data.Proxy
2220

2321
magic :: ByteString
24-
magic = "STACK"
22+
magic = "stack"
23+
24+
-- | A @Binary@ instance that also has a schema version
25+
class Binary a => BinarySchema a where
26+
binarySchema :: Proxy a -> Int
2527

2628
newtype WithTag a = WithTag a
27-
instance Binary a => Binary (WithTag a) where
29+
instance forall a. BinarySchema a => Binary (WithTag a) where
2830
get = do
2931
forM_ (S.unpack magic) $ \w -> do
3032
w' <- getWord8
3133
when (w /= w')
3234
$ fail "Mismatched magic string, forcing a recompute"
3335
tag' <- get
34-
if tag == tag'
36+
if binarySchema (Proxy :: Proxy a) == tag'
3537
then fmap WithTag get
3638
else fail "Mismatched tags, forcing a recompute"
3739
put (WithTag x) = do
3840
mapM_ putWord8 $ S.unpack magic
39-
put tag
41+
put (binarySchema (Proxy :: Proxy a))
4042
put x
4143

4244
-- | Write to the given file, with a version tag.
43-
taggedEncodeFile :: (Binary a, MonadIO m)
45+
taggedEncodeFile :: (BinarySchema a, MonadIO m)
4446
=> FilePath
4547
-> a
4648
-> m ()
@@ -51,7 +53,7 @@ taggedEncodeFile fp x = liftIO $ do
5153
-- | Read from the given file. If the read fails, run the given action and
5254
-- write that back to the file. Always starts the file off with the version
5355
-- tag.
54-
taggedDecodeOrLoad :: (Binary a, MonadIO m)
56+
taggedDecodeOrLoad :: (BinarySchema a, MonadIO m)
5557
=> FilePath
5658
-> m a
5759
-> m a

src/Options/Applicative/Builder/Extra.hs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
module Options.Applicative.Builder.Extra
44
(boolFlags
5+
,boolFlagsNoDefault
56
,maybeBoolFlags
67
,enableDisableFlags
8+
,enableDisableFlagsNoDefault
79
,extraHelpOption
810
,execExtraHelp)
911
where
@@ -17,13 +19,23 @@ import System.FilePath (takeBaseName)
1719
boolFlags :: Bool -> String -> String -> Mod FlagFields Bool -> Parser Bool
1820
boolFlags defaultValue = enableDisableFlags defaultValue True False
1921

22+
-- | Enable/disable flags for a @Bool@, without a default case (to allow chaining @<|>@s).
23+
boolFlagsNoDefault :: String -> String -> Mod FlagFields Bool -> Parser Bool
24+
boolFlagsNoDefault = enableDisableFlagsNoDefault True False
25+
2026
-- | Enable/disable flags for a @(Maybe Bool)@.
2127
maybeBoolFlags :: String -> String -> Mod FlagFields (Maybe Bool) -> Parser (Maybe Bool)
2228
maybeBoolFlags = enableDisableFlags Nothing (Just True) (Just False)
2329

2430
-- | Enable/disable flags for any type.
2531
enableDisableFlags :: a -> a -> a -> String -> String -> Mod FlagFields a -> Parser a
2632
enableDisableFlags defaultValue enabledValue disabledValue name helpSuffix mods =
33+
enableDisableFlagsNoDefault enabledValue disabledValue name helpSuffix mods <|>
34+
pure defaultValue
35+
36+
-- | Enable/disable flags for any type, without a default (to allow chaining @<|>@s)
37+
enableDisableFlagsNoDefault :: a -> a -> String -> String -> Mod FlagFields a -> Parser a
38+
enableDisableFlagsNoDefault enabledValue disabledValue name helpSuffix mods =
2739
flag' enabledValue
2840
(long name <>
2941
help ("Enable " ++ helpSuffix) <>
@@ -41,8 +53,7 @@ enableDisableFlags defaultValue enabledValue disabledValue name helpSuffix mods
4153
(internal <>
4254
long ("disable-" ++ name) <>
4355
help ("Disable " ++ helpSuffix) <>
44-
mods) <|>
45-
pure defaultValue
56+
mods)
4657

4758
-- | Show an extra help option (e.g. @--docker-help@ shows help for all @--docker*@ args).
4859
-- To actually show have that help appear, use 'execExtraHelp' before executing the main parser.

0 commit comments

Comments
 (0)