Skip to content

Commit

Permalink
single test suite failure should show entire log #388
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Jun 24, 2015
1 parent f38b913 commit 0455fcf
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Put stackage snapshots JSON on S3 [#380](https://github.com/commercialhaskell/stack/issues/380)
* Specifying flags for multiple packages [#335](https://github.com/commercialhaskell/stack/issues/335)
* single test suite failure should show entire log [#388](https://github.com/commercialhaskell/stack/issues/388)
* valid-wanted is a confusing option name [#386](https://github.com/commercialhaskell/stack/issues/386)

## 0.1.0.0

Expand Down
5 changes: 4 additions & 1 deletion src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,10 @@ resolvePackageEntry menv projRoot pe = do
case peSubdirs pe of
[] -> return [entryRoot]
subs -> mapM (resolveDir entryRoot) subs
return $ map (, peValidWanted pe) paths
case peValidWanted pe of
Nothing -> return ()
Just _ -> $logWarn "Warning: you are using the deprecated valid-wanted field. You should instead use extra-dep. See: https://github.com/commercialhaskell/stack/wiki/stack.yaml#packages"
return $ map (, not $ peExtraDep pe) paths

-- | Resolve a PackageLocation into a path, downloading and cloning as
-- necessary.
Expand Down
3 changes: 2 additions & 1 deletion src/Stack/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ initProject initOpts = do
}
pkgs = map toPkg cabalfps
toPkg fp = PackageEntry
{ peValidWanted = True
{ peValidWanted = Nothing
, peExtraDepMaybe = Nothing
, peLocation = PLFilePath $
case stripDir currDir $ parent fp of
Nothing
Expand Down
39 changes: 30 additions & 9 deletions src/Stack/Types/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ data BuildConfig = BuildConfig
-- ^ Version of GHC we expected for this build
, bcPackages :: !(Map (Path Abs Dir) Bool)
-- ^ Local packages identified by a path, Bool indicates whether it is
-- allowed to be wanted (see 'peValidWanted')
-- a non-dependency (the opposite of 'peExtraDep')
, bcExtraDeps :: !(Map PackageName Version)
-- ^ Extra dependencies specified in configuration.
--
Expand Down Expand Up @@ -221,32 +221,52 @@ data NoBuildConfigStrategy
deriving (Show, Eq, Ord)

data PackageEntry = PackageEntry
{ peValidWanted :: !Bool
-- ^ Can this package be considered wanted? Useful to disable when simply
-- modifying an upstream package, see:
{ peExtraDepMaybe :: !(Maybe Bool)
-- ^ Is this package a dependency? This means the local package will be
-- treated just like an extra-deps: it will only be built as a dependency
-- for others, and its test suite/benchmarks will not be run.
--
-- Useful modifying an upstream package, see:
-- https://github.com/commercialhaskell/stack/issues/219
-- https://github.com/commercialhaskell/stack/issues/386
, peValidWanted :: !(Maybe Bool)
-- ^ Deprecated name meaning the opposite of peExtraDep. Only present to
-- provide deprecation warnings to users.
, peLocation :: !PackageLocation
, peSubdirs :: ![FilePath]
}
deriving Show

-- | Once peValidWanted is removed, this should just become the field name in PackageEntry.
peExtraDep :: PackageEntry -> Bool
peExtraDep pe =
case peExtraDepMaybe pe of
Just x -> x
Nothing ->
case peValidWanted pe of
Just x -> not x
Nothing -> False

instance ToJSON PackageEntry where
toJSON pe | peValidWanted pe && null (peSubdirs pe) =
toJSON pe | not (peExtraDep pe) && null (peSubdirs pe) =
toJSON $ peLocation pe
toJSON pe = object
[ "valid-wanted" .= peValidWanted pe
[ "extra-dep" .= peExtraDep pe
, "location" .= peLocation pe
, "subdirs" .= peSubdirs pe
]
instance FromJSON PackageEntry where
parseJSON (String t) = do
loc <- parseJSON $ String t
return PackageEntry
{ peValidWanted = True
{ peExtraDepMaybe = Nothing
, peValidWanted = Nothing
, peLocation = loc
, peSubdirs = []
}
parseJSON v = withObject "PackageEntry" (\o -> PackageEntry
<$> o .:? "valid-wanted" .!= True
<$> o .:? "extra-dep"
<*> o .:? "valid-wanted"
<*> o .: "location"
<*> o .:? "subdirs" .!= []) v

Expand Down Expand Up @@ -714,7 +734,8 @@ instance FromJSON ProjectAndConfigMonoid where
-- | A PackageEntry for the current directory, used as a default
packageEntryCurrDir :: PackageEntry
packageEntryCurrDir = PackageEntry
{ peValidWanted = True
{ peValidWanted = Nothing
, peExtraDepMaybe = Nothing
, peLocation = PLFilePath "."
, peSubdirs = []
}

0 comments on commit 0455fcf

Please sign in to comment.