shake-language-c 0.9.1 → 0.10.0
raw patch · 2 files changed
+33/−5 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Development.Shake.Language.C.Config: mkConfig :: Rules ([FilePath] -> FilePath -> [(String, String)] -> String -> Action (Maybe String))
- Development.Shake.Language.C.BuildFlags: archiverFlags :: ArrowApply cat => Lens cat BuildFlags [String]
+ Development.Shake.Language.C.BuildFlags: archiverFlags :: forall cat. ArrowApply cat => Lens cat BuildFlags [String]
- Development.Shake.Language.C.BuildFlags: compilerFlags :: ArrowApply cat => Lens cat BuildFlags [(Maybe Language, [String])]
+ Development.Shake.Language.C.BuildFlags: compilerFlags :: forall cat. ArrowApply cat => Lens cat BuildFlags [(Maybe Language, [String])]
- Development.Shake.Language.C.BuildFlags: defines :: ArrowApply cat => Lens cat BuildFlags [(String, Maybe String)]
+ Development.Shake.Language.C.BuildFlags: defines :: forall cat. ArrowApply cat => Lens cat BuildFlags [(String, Maybe String)]
- Development.Shake.Language.C.BuildFlags: libraries :: ArrowApply cat => Lens cat BuildFlags [String]
+ Development.Shake.Language.C.BuildFlags: libraries :: forall cat. ArrowApply cat => Lens cat BuildFlags [String]
- Development.Shake.Language.C.BuildFlags: libraryPath :: ArrowApply cat => Lens cat BuildFlags [FilePath]
+ Development.Shake.Language.C.BuildFlags: libraryPath :: forall cat. ArrowApply cat => Lens cat BuildFlags [FilePath]
- Development.Shake.Language.C.BuildFlags: linkerFlags :: ArrowApply cat => Lens cat BuildFlags [String]
+ Development.Shake.Language.C.BuildFlags: linkerFlags :: forall cat. ArrowApply cat => Lens cat BuildFlags [String]
- Development.Shake.Language.C.BuildFlags: localLibraries :: ArrowApply cat => Lens cat BuildFlags [FilePath]
+ Development.Shake.Language.C.BuildFlags: localLibraries :: forall cat. ArrowApply cat => Lens cat BuildFlags [FilePath]
- Development.Shake.Language.C.BuildFlags: preprocessorFlags :: ArrowApply cat => Lens cat BuildFlags [String]
+ Development.Shake.Language.C.BuildFlags: preprocessorFlags :: forall cat. ArrowApply cat => Lens cat BuildFlags [String]
- Development.Shake.Language.C.BuildFlags: systemIncludes :: ArrowApply cat => Lens cat BuildFlags [FilePath]
+ Development.Shake.Language.C.BuildFlags: systemIncludes :: forall cat. ArrowApply cat => Lens cat BuildFlags [FilePath]
- Development.Shake.Language.C.BuildFlags: userIncludes :: ArrowApply cat => Lens cat BuildFlags [FilePath]
+ Development.Shake.Language.C.BuildFlags: userIncludes :: forall cat. ArrowApply cat => Lens cat BuildFlags [FilePath]
- Development.Shake.Language.C.ToolChain: archiver :: ArrowApply cat => Lens cat ToolChain Archiver
+ Development.Shake.Language.C.ToolChain: archiver :: forall cat. ArrowApply cat => Lens cat ToolChain Archiver
- Development.Shake.Language.C.ToolChain: archiverCommand :: ArrowApply cat => Lens cat ToolChain FilePath
+ Development.Shake.Language.C.ToolChain: archiverCommand :: forall cat. ArrowApply cat => Lens cat ToolChain FilePath
- Development.Shake.Language.C.ToolChain: compiler :: ArrowApply cat => Lens cat ToolChain Compiler
+ Development.Shake.Language.C.ToolChain: compiler :: forall cat. ArrowApply cat => Lens cat ToolChain Compiler
- Development.Shake.Language.C.ToolChain: compilerCommand :: ArrowApply cat => Lens cat ToolChain FilePath
+ Development.Shake.Language.C.ToolChain: compilerCommand :: forall cat. ArrowApply cat => Lens cat ToolChain FilePath
- Development.Shake.Language.C.ToolChain: defaultBuildFlags :: ArrowApply cat => Lens cat ToolChain (Action (BuildFlags -> BuildFlags))
+ Development.Shake.Language.C.ToolChain: defaultBuildFlags :: forall cat. ArrowApply cat => Lens cat ToolChain (Action (BuildFlags -> BuildFlags))
- Development.Shake.Language.C.ToolChain: linker :: ArrowApply cat => Lens cat ToolChain (LinkResult -> Linker)
+ Development.Shake.Language.C.ToolChain: linker :: forall cat. ArrowApply cat => Lens cat ToolChain (LinkResult -> Linker)
- Development.Shake.Language.C.ToolChain: linkerCommand :: ArrowApply cat => Lens cat ToolChain FilePath
+ Development.Shake.Language.C.ToolChain: linkerCommand :: forall cat. ArrowApply cat => Lens cat ToolChain FilePath
- Development.Shake.Language.C.ToolChain: toolDirectory :: ArrowApply cat => Lens cat ToolChain (Maybe FilePath)
+ Development.Shake.Language.C.ToolChain: toolDirectory :: forall cat. ArrowApply cat => Lens cat ToolChain (Maybe FilePath)
- Development.Shake.Language.C.ToolChain: toolPrefix :: ArrowApply cat => Lens cat ToolChain String
+ Development.Shake.Language.C.ToolChain: toolPrefix :: forall cat. ArrowApply cat => Lens cat ToolChain String
- Development.Shake.Language.C.ToolChain: variant :: ArrowApply cat => Lens cat ToolChain ToolChainVariant
+ Development.Shake.Language.C.ToolChain: variant :: forall cat. ArrowApply cat => Lens cat ToolChain ToolChainVariant
Files
shake-language-c.cabal view
@@ -13,7 +13,7 @@ -- limitations under the License. Name: shake-language-c-Version: 0.9.1+Version: 0.10.0 Synopsis: Utilities for cross-compiling with Shake Description: This library provides <http://hackage.haskell.org/package/shake Shake> utilities for cross-compiling @C@, @C++@ and @ObjC@ code for various target platforms. Currently supported target platforms are Android, iOS, Linux, MacOS X, Windows\/MinGW and Google Portable Native Client (PNaCl). Supported host platforms are MacOS X, Linux and Windows. Category: Development
src/Development/Shake/Language/C/Config.hs view
@@ -8,6 +8,7 @@ -} module Development.Shake.Language.C.Config( withConfig+ , mkConfig , parsePaths , getPaths ) where@@ -19,7 +20,7 @@ import Development.Shake.Config (readConfigFileWithEnv) import Development.Shake.Language.C.Util (words') -newtype Config = Config ([(String, String)], FilePath, String) deriving (Show,Typeable,Eq,Hashable,Binary,NFData)+newtype Config = Config ([FilePath], FilePath, [(String, String)], String) deriving (Show,Typeable,Eq,Hashable,Binary,NFData) {- | Given a list of dependencies, return a function that takes an environment of variable bindings, a configuration file path and a configuration variable@@ -42,11 +43,38 @@ -> String -> Action (Maybe String)) withConfig deps = do- fileCache <- newCache $ \(env, file) -> do+ fileCache <- newCache $ \(file, env) -> do need deps liftIO $ readConfigFileWithEnv env file- query <- addOracle $ \(Config (env, file, key)) -> Map.lookup key <$> fileCache (env, file)- return $ \env file key -> query (Config (env, file, key))+ query <- addOracle $ \(Config (_, file, env, key)) -> Map.lookup key <$> fileCache (file, env)+ return $ \env file key -> query (Config ([], file, env, key))++{- | Return a function that takes a list of dependencies, a configuration file+path, an environment of variable bindings and a configuration variable and+returns the corresponding configuration value.++This function is more flexible than `Development.Shake.Config.usingConfigFile`.+It allows the use of multiple configuration files as well as specifying default+variable bindings.++Typical usage would be something like this:++> -- In the Rules monad+> getConfig <- mkConfig+> -- Then in an Action+> ... value <- getConfig ["some_generated_config.cfg"] [("variable", "default value")] "config.cfg" "variable"+-}+mkConfig :: Rules ( [FilePath]+ -> FilePath+ -> [(String,String)]+ -> String+ -> Action (Maybe String))+mkConfig = do+ fileCache <- newCache $ \(deps, file, env) -> do+ need deps+ liftIO $ readConfigFileWithEnv env file+ query <- addOracle $ \(Config (deps, file, env, key)) -> Map.lookup key <$> fileCache (deps, file, env)+ return $ \deps file env key -> query (Config (deps, file, env, key)) -- | Parse a list of space separated paths from an input string. Spaces can be escaped by @\\@ characters. --