diff options
author | Brad Richardson <brichardson@structint.com> | 2020-05-23 20:43:04 -0700 |
---|---|---|
committer | Brad Richardson <brichardson@structint.com> | 2020-05-23 20:43:04 -0700 |
commit | d89214ba52c968a950dc3118f54b8547350536d9 (patch) | |
tree | 6783b1360272411f8e51aebd6f17678fadc1c23a /src | |
parent | b5a1ada4f24a4334dcaef6d2d8dcfb53e17ecc6c (diff) | |
download | fpm-d89214ba52c968a950dc3118f54b8547350536d9.tar.gz fpm-d89214ba52c968a950dc3118f54b8547350536d9.zip |
Add path dependencies and a test to make sure it works
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 |