1- {-# language RecordWildCards #-}
1+ -- due to recent generic-arbitrary
2+ {-# OPTIONS_GHC -fconstraint-solver-iterations=0 #-}
23{-|
34Description : Build related types
45Maintainer : srk <[email protected] > @@ -8,15 +9,18 @@ module System.Nix.Build
89 , BuildStatus (.. )
910 , BuildResult (.. )
1011 , buildSuccess
11- )
12- where
12+ ) where
1313
14- import Data.Time ( UTCTime )
14+ import Data.Time (UTCTime )
15+ import Test.QuickCheck (Arbitrary (.. ))
16+ import Test.QuickCheck.Arbitrary.Generic (GenericArbitrary (.. ))
17+ import Test.QuickCheck.Instances ()
1518
1619-- keep the order of these Enums to match enums from reference implementations
1720-- src/libstore/store-api.hh
1821data BuildMode = Normal | Repair | Check
19- deriving (Eq , Ord , Enum , Show )
22+ deriving (Eq , Generic , Ord , Enum , Show )
23+ deriving Arbitrary via GenericArbitrary BuildMode
2024
2125data BuildStatus =
2226 Built
@@ -32,8 +36,10 @@ data BuildStatus =
3236 | DependencyFailed
3337 | LogLimitExceeded
3438 | NotDeterministic
35- deriving (Eq , Ord , Enum , Show )
36-
39+ | ResolvesToAlreadyValid
40+ | NoSubstituters
41+ deriving (Eq , Generic , Ord , Enum , Show )
42+ deriving Arbitrary via GenericArbitrary BuildStatus
3743
3844-- | Result of the build
3945data BuildResult = BuildResult
@@ -42,15 +48,16 @@ data BuildResult = BuildResult
4248 , -- | possible build error message
4349 errorMessage :: ! (Maybe Text )
4450 , -- | How many times this build was performed
45- timesBuilt :: ! Integer
51+ timesBuilt :: ! Int
4652 , -- | If timesBuilt > 1, whether some builds did not produce the same result
4753 isNonDeterministic :: ! Bool
4854 , -- Start time of this build
4955 startTime :: ! UTCTime
5056 , -- Stop time of this build
5157 stopTime :: ! UTCTime
5258 }
53- deriving (Eq , Ord , Show )
59+ deriving (Eq , Generic , Ord , Show )
60+ deriving Arbitrary via GenericArbitrary BuildResult
5461
5562buildSuccess :: BuildResult -> Bool
5663buildSuccess BuildResult {.. } =
0 commit comments