diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Fpm.hs | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -81,12 +81,14 @@ data Executable = Executable { , executableName :: String } -data Version = SimpleVersion String | GitVersion GitVersionSpec +data Version = SimpleVersion String | GitVersion GitVersionSpec | PathVersion PathVersionSpec data GitVersionSpec = GitVersionSpec { gitVersionSpecUrl :: String, gitVersionSpecRef :: Maybe GitRef } data GitRef = Tag String | Branch String | Commit String +data PathVersionSpec = PathVersionSpec { pathVersionSpecPath :: String } + data Command = Run | Test | Build data DependencyTree = Dependency { @@ -263,6 +265,11 @@ matchGitVersion = \case GitVersion v -> Just v _ -> Nothing +matchPathVersion :: Version -> Maybe PathVersionSpec +matchPathVersion = \case + PathVersion v -> Just v + _ -> Nothing + matchTag :: GitRef -> Maybe String matchTag = \case Tag v -> Just v @@ -282,6 +289,7 @@ versionCodec :: Toml.Key -> Toml.TomlCodec Version versionCodec key = Toml.dimatch matchSimpleVersion SimpleVersion (Toml.string key) <|> Toml.dimatch matchGitVersion GitVersion (Toml.table gitVersionCodec key) + <|> Toml.dimatch matchPathVersion PathVersion (Toml.table pathVersionCodec key) gitVersionCodec :: Toml.TomlCodec GitVersionSpec gitVersionCodec = @@ -297,6 +305,10 @@ gitRefCodec = <|> Toml.dimatch matchBranch Branch (Toml.string "branch") <|> Toml.dimatch matchCommit Commit (Toml.string "rev") +pathVersionCodec :: Toml.TomlCodec PathVersionSpec +pathVersionCodec = + PathVersionSpec <$> Toml.string "path" .= pathVersionSpecPath + toml2AppSettings :: TomlSettings -> Bool -> IO AppSettings toml2AppSettings tomlSettings release = do let projectName = tomlSettingsProjectName tomlSettings @@ -452,6 +464,7 @@ fetchDependency name version = do ) return (name, clonePath) Nothing -> return (name, clonePath) + PathVersion versionSpec -> return (name, pathVersionSpecPath versionSpec) {- Bulding the dependencies is done on a depth first basis to ensure all of |