Change config file structure; Add config version tag
parent
647fa94ef3
commit
8f1e366f9c
|
@ -111,8 +111,8 @@ mainCmdParser helpDesc = do
|
||||||
& runIdentity
|
& runIdentity
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
let cppMode = config
|
let cppMode = config
|
||||||
& _conf_errorHandling
|
& _conf_preprocessor
|
||||||
& _econf_CPPMode
|
& _ppconf_CPPMode
|
||||||
& runIdentity
|
& runIdentity
|
||||||
& Semigroup.getLast
|
& Semigroup.getLast
|
||||||
let cppCheckFunc dynFlags = if GHC.xopt GHC.Cpp dynFlags
|
let cppCheckFunc dynFlags = if GHC.xopt GHC.Cpp dynFlags
|
||||||
|
|
|
@ -143,8 +143,9 @@ instance Show PPTextWrapper where
|
||||||
|
|
||||||
defaultTestConfig :: Config
|
defaultTestConfig :: Config
|
||||||
defaultTestConfig = Config
|
defaultTestConfig = Config
|
||||||
{ _conf_debug = _conf_debug staticDefaultConfig
|
{ _conf_version = _conf_version staticDefaultConfig
|
||||||
, _conf_layout = LayoutConfig
|
, _conf_debug = _conf_debug staticDefaultConfig
|
||||||
|
, _conf_layout = LayoutConfig
|
||||||
{ _lconfig_cols = coerce (80 :: Int)
|
{ _lconfig_cols = coerce (80 :: Int)
|
||||||
, _lconfig_indentPolicy = coerce IndentPolicyFree
|
, _lconfig_indentPolicy = coerce IndentPolicyFree
|
||||||
, _lconfig_indentAmount = coerce (2 :: Int)
|
, _lconfig_indentAmount = coerce (2 :: Int)
|
||||||
|
@ -159,7 +160,8 @@ defaultTestConfig = Config
|
||||||
, _conf_errorHandling = (_conf_errorHandling staticDefaultConfig)
|
, _conf_errorHandling = (_conf_errorHandling staticDefaultConfig)
|
||||||
{ _econf_omit_output_valid_check = coerce True
|
{ _econf_omit_output_valid_check = coerce True
|
||||||
}
|
}
|
||||||
, _conf_forward = ForwardOptions
|
, _conf_preprocessor = _conf_preprocessor staticDefaultConfig
|
||||||
|
, _conf_forward = ForwardOptions
|
||||||
{ _options_ghc = Identity []
|
{ _options_ghc = Identity []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,9 @@ instance Show PPTextWrapper where
|
||||||
|
|
||||||
defaultTestConfig :: Config
|
defaultTestConfig :: Config
|
||||||
defaultTestConfig = Config
|
defaultTestConfig = Config
|
||||||
{ _conf_debug = _conf_debug staticDefaultConfig
|
{ _conf_version = _conf_version staticDefaultConfig
|
||||||
, _conf_layout = LayoutConfig
|
, _conf_debug = _conf_debug staticDefaultConfig
|
||||||
|
, _conf_layout = LayoutConfig
|
||||||
{ _lconfig_cols = coerce (80 :: Int)
|
{ _lconfig_cols = coerce (80 :: Int)
|
||||||
, _lconfig_indentPolicy = coerce IndentPolicyFree
|
, _lconfig_indentPolicy = coerce IndentPolicyFree
|
||||||
, _lconfig_indentAmount = coerce (2 :: Int)
|
, _lconfig_indentAmount = coerce (2 :: Int)
|
||||||
|
@ -57,7 +58,8 @@ defaultTestConfig = Config
|
||||||
, _conf_errorHandling = (_conf_errorHandling staticDefaultConfig)
|
, _conf_errorHandling = (_conf_errorHandling staticDefaultConfig)
|
||||||
{ _econf_ExactPrintFallback = coerce ExactPrintFallbackModeNever
|
{ _econf_ExactPrintFallback = coerce ExactPrintFallbackModeNever
|
||||||
}
|
}
|
||||||
, _conf_forward = ForwardOptions
|
, _conf_preprocessor = (_conf_preprocessor staticDefaultConfig)
|
||||||
|
, _conf_forward = ForwardOptions
|
||||||
{ _options_ghc = Identity []
|
{ _options_ghc = Identity []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,8 @@ configParser = do
|
||||||
(flagHelp $ parDoc "allows to define default language extensions. The parameter is forwarded to ghc.")
|
(flagHelp $ parDoc "allows to define default language extensions. The parameter is forwarded to ghc.")
|
||||||
|
|
||||||
return $ Config
|
return $ Config
|
||||||
{ _conf_debug = DebugConfig
|
{ _conf_version = mempty
|
||||||
|
, _conf_debug = DebugConfig
|
||||||
{ _dconf_dump_config = wrapLast $ falseToNothing dumpConfig
|
{ _dconf_dump_config = wrapLast $ falseToNothing dumpConfig
|
||||||
, _dconf_dump_annotations = wrapLast $ falseToNothing dumpAnnotations
|
, _dconf_dump_annotations = wrapLast $ falseToNothing dumpAnnotations
|
||||||
, _dconf_dump_ast_unknown = wrapLast $ falseToNothing dumpUnknownAST
|
, _dconf_dump_ast_unknown = wrapLast $ falseToNothing dumpUnknownAST
|
||||||
|
@ -91,10 +92,12 @@ configParser = do
|
||||||
, _conf_errorHandling = ErrorHandlingConfig
|
, _conf_errorHandling = ErrorHandlingConfig
|
||||||
{ _econf_produceOutputOnErrors = wrapLast $ falseToNothing outputOnErrors
|
{ _econf_produceOutputOnErrors = wrapLast $ falseToNothing outputOnErrors
|
||||||
, _econf_Werror = wrapLast $ falseToNothing wError
|
, _econf_Werror = wrapLast $ falseToNothing wError
|
||||||
, _econf_CPPMode = mempty
|
|
||||||
, _econf_ExactPrintFallback = mempty
|
, _econf_ExactPrintFallback = mempty
|
||||||
, _econf_omit_output_valid_check = wrapLast $ falseToNothing omitValidCheck
|
, _econf_omit_output_valid_check = wrapLast $ falseToNothing omitValidCheck
|
||||||
}
|
}
|
||||||
|
, _conf_preprocessor = PreProcessorConfig
|
||||||
|
{ _ppconf_CPPMode = mempty
|
||||||
|
}
|
||||||
, _conf_forward = ForwardOptions
|
, _conf_forward = ForwardOptions
|
||||||
{ _options_ghc = [ optionsGhc & List.unwords & CmdArgs.splitArgs | not $ null optionsGhc ]
|
{ _options_ghc = [ optionsGhc & List.unwords & CmdArgs.splitArgs | not $ null optionsGhc ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,6 @@ data CForwardOptions f = ForwardOptions
|
||||||
data CErrorHandlingConfig f = ErrorHandlingConfig
|
data CErrorHandlingConfig f = ErrorHandlingConfig
|
||||||
{ _econf_produceOutputOnErrors :: f (Semigroup.Last Bool)
|
{ _econf_produceOutputOnErrors :: f (Semigroup.Last Bool)
|
||||||
, _econf_Werror :: f (Semigroup.Last Bool)
|
, _econf_Werror :: f (Semigroup.Last Bool)
|
||||||
, _econf_CPPMode :: f (Semigroup.Last CPPMode)
|
|
||||||
, _econf_ExactPrintFallback :: f (Semigroup.Last ExactPrintFallbackMode)
|
, _econf_ExactPrintFallback :: f (Semigroup.Last ExactPrintFallbackMode)
|
||||||
-- ^ Determines when to fall back on the exactprint'ed output when
|
-- ^ Determines when to fall back on the exactprint'ed output when
|
||||||
-- syntactical constructs are encountered which are not yet handled by
|
-- syntactical constructs are encountered which are not yet handled by
|
||||||
|
@ -97,11 +96,18 @@ data CErrorHandlingConfig f = ErrorHandlingConfig
|
||||||
}
|
}
|
||||||
deriving (Generic)
|
deriving (Generic)
|
||||||
|
|
||||||
|
data CPreProcessorConfig f = PreProcessorConfig
|
||||||
|
{ _ppconf_CPPMode :: f (Semigroup.Last CPPMode)
|
||||||
|
}
|
||||||
|
deriving (Generic)
|
||||||
|
|
||||||
data CConfig f = Config
|
data CConfig f = Config
|
||||||
{ _conf_debug :: CDebugConfig f
|
{ _conf_version :: f (Semigroup.Last Int)
|
||||||
, _conf_layout :: CLayoutConfig f
|
, _conf_debug :: CDebugConfig f
|
||||||
|
, _conf_layout :: CLayoutConfig f
|
||||||
, _conf_errorHandling :: CErrorHandlingConfig f
|
, _conf_errorHandling :: CErrorHandlingConfig f
|
||||||
, _conf_forward :: CForwardOptions f
|
, _conf_forward :: CForwardOptions f
|
||||||
|
, _conf_preprocessor :: CPreProcessorConfig f
|
||||||
}
|
}
|
||||||
deriving (Generic)
|
deriving (Generic)
|
||||||
|
|
||||||
|
@ -116,18 +122,21 @@ deriving instance Show (CDebugConfig Identity)
|
||||||
deriving instance Show (CLayoutConfig Identity)
|
deriving instance Show (CLayoutConfig Identity)
|
||||||
deriving instance Show (CErrorHandlingConfig Identity)
|
deriving instance Show (CErrorHandlingConfig Identity)
|
||||||
deriving instance Show (CForwardOptions Identity)
|
deriving instance Show (CForwardOptions Identity)
|
||||||
|
deriving instance Show (CPreProcessorConfig Identity)
|
||||||
deriving instance Show (CConfig Identity)
|
deriving instance Show (CConfig Identity)
|
||||||
|
|
||||||
deriving instance Show (CDebugConfig Option)
|
deriving instance Show (CDebugConfig Option)
|
||||||
deriving instance Show (CLayoutConfig Option)
|
deriving instance Show (CLayoutConfig Option)
|
||||||
deriving instance Show (CErrorHandlingConfig Option)
|
deriving instance Show (CErrorHandlingConfig Option)
|
||||||
deriving instance Show (CForwardOptions Option)
|
deriving instance Show (CForwardOptions Option)
|
||||||
|
deriving instance Show (CPreProcessorConfig Option)
|
||||||
deriving instance Show (CConfig Option)
|
deriving instance Show (CConfig Option)
|
||||||
|
|
||||||
deriving instance Data (CDebugConfig Identity)
|
deriving instance Data (CDebugConfig Identity)
|
||||||
deriving instance Data (CLayoutConfig Identity)
|
deriving instance Data (CLayoutConfig Identity)
|
||||||
deriving instance Data (CErrorHandlingConfig Identity)
|
deriving instance Data (CErrorHandlingConfig Identity)
|
||||||
deriving instance Data (CForwardOptions Identity)
|
deriving instance Data (CForwardOptions Identity)
|
||||||
|
deriving instance Data (CPreProcessorConfig Identity)
|
||||||
deriving instance Data (CConfig Identity)
|
deriving instance Data (CConfig Identity)
|
||||||
|
|
||||||
instance Semigroup.Semigroup (CDebugConfig Option) where
|
instance Semigroup.Semigroup (CDebugConfig Option) where
|
||||||
|
@ -138,6 +147,8 @@ instance Semigroup.Semigroup (CErrorHandlingConfig Option) where
|
||||||
(<>) = gmappend
|
(<>) = gmappend
|
||||||
instance Semigroup.Semigroup (CForwardOptions Option) where
|
instance Semigroup.Semigroup (CForwardOptions Option) where
|
||||||
(<>) = gmappend
|
(<>) = gmappend
|
||||||
|
instance Semigroup.Semigroup (CPreProcessorConfig Option) where
|
||||||
|
(<>) = gmappend
|
||||||
instance Semigroup.Semigroup (CConfig Option) where
|
instance Semigroup.Semigroup (CConfig Option) where
|
||||||
(<>) = gmappend
|
(<>) = gmappend
|
||||||
|
|
||||||
|
@ -202,6 +213,11 @@ makeFromJSONMaybe(CForwardOptions)
|
||||||
makeToJSONOption(CForwardOptions)
|
makeToJSONOption(CForwardOptions)
|
||||||
makeToJSONMaybe(CForwardOptions)
|
makeToJSONMaybe(CForwardOptions)
|
||||||
|
|
||||||
|
makeFromJSONOption(CPreProcessorConfig)
|
||||||
|
makeFromJSONMaybe(CPreProcessorConfig)
|
||||||
|
makeToJSONOption(CPreProcessorConfig)
|
||||||
|
makeToJSONMaybe(CPreProcessorConfig)
|
||||||
|
|
||||||
makeFromJSONOption(CConfig)
|
makeFromJSONOption(CConfig)
|
||||||
makeFromJSONMaybe(CConfig)
|
makeFromJSONMaybe(CConfig)
|
||||||
makeToJSONOption(CConfig)
|
makeToJSONOption(CConfig)
|
||||||
|
@ -267,7 +283,8 @@ data ExactPrintFallbackMode
|
||||||
|
|
||||||
staticDefaultConfig :: Config
|
staticDefaultConfig :: Config
|
||||||
staticDefaultConfig = Config
|
staticDefaultConfig = Config
|
||||||
{ _conf_debug = DebugConfig
|
{ _conf_version = coerce (1 :: Int)
|
||||||
|
, _conf_debug = DebugConfig
|
||||||
{ _dconf_dump_config = coerce False
|
{ _dconf_dump_config = coerce False
|
||||||
, _dconf_dump_annotations = coerce False
|
, _dconf_dump_annotations = coerce False
|
||||||
, _dconf_dump_ast_unknown = coerce False
|
, _dconf_dump_ast_unknown = coerce False
|
||||||
|
@ -295,10 +312,12 @@ staticDefaultConfig = Config
|
||||||
, _conf_errorHandling = ErrorHandlingConfig
|
, _conf_errorHandling = ErrorHandlingConfig
|
||||||
{ _econf_produceOutputOnErrors = coerce False
|
{ _econf_produceOutputOnErrors = coerce False
|
||||||
, _econf_Werror = coerce False
|
, _econf_Werror = coerce False
|
||||||
, _econf_CPPMode = coerce CPPModeAbort
|
|
||||||
, _econf_ExactPrintFallback = coerce ExactPrintFallbackModeInline
|
, _econf_ExactPrintFallback = coerce ExactPrintFallbackModeInline
|
||||||
, _econf_omit_output_valid_check = coerce False
|
, _econf_omit_output_valid_check = coerce False
|
||||||
}
|
}
|
||||||
|
, _conf_preprocessor = PreProcessorConfig
|
||||||
|
{ _ppconf_CPPMode = coerce CPPModeAbort
|
||||||
|
}
|
||||||
, _conf_forward = ForwardOptions
|
, _conf_forward = ForwardOptions
|
||||||
{ _options_ghc = Identity []
|
{ _options_ghc = Identity []
|
||||||
}
|
}
|
||||||
|
@ -311,5 +330,6 @@ deriveCZipWith ''CDebugConfig
|
||||||
deriveCZipWith ''CLayoutConfig
|
deriveCZipWith ''CLayoutConfig
|
||||||
deriveCZipWith ''CErrorHandlingConfig
|
deriveCZipWith ''CErrorHandlingConfig
|
||||||
deriveCZipWith ''CForwardOptions
|
deriveCZipWith ''CForwardOptions
|
||||||
|
deriveCZipWith ''CPreProcessorConfig
|
||||||
deriveCZipWith ''CConfig
|
deriveCZipWith ''CConfig
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue