diff options
author | Brad Richardson <brichardson@structint.com> | 2020-05-23 12:50:42 -0700 |
---|---|---|
committer | Brad Richardson <brichardson@structint.com> | 2020-05-23 12:50:42 -0700 |
commit | b5a1ada4f24a4334dcaef6d2d8dcfb53e17ecc6c (patch) | |
tree | ad7b4eea0d97dfc10d83a455e7e053c7e9564605 /src/Fpm.hs | |
parent | 382ce71efae399897c8a008c0042bb0511516fe6 (diff) | |
download | fpm-b5a1ada4f24a4334dcaef6d2d8dcfb53e17ecc6c.tar.gz fpm-b5a1ada4f24a4334dcaef6d2d8dcfb53e17ecc6c.zip |
Add some explanatory comments to the dependency functions
Diffstat (limited to 'src/Fpm.hs')
-rw-r--r-- | src/Fpm.hs | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -390,12 +390,21 @@ makeBuildPrefix compiler release = -- Probably version, and make sure to not include path to the compiler return $ "build" </> compiler ++ "_" ++ if release then "release" else "debug" --- This really needs to be a tree instead +{- + Fetching the dependencies is done on a sort of breadth first approach. All + of the dependencies are fetched before doing the transitive dependencies. + This means that the top level dependencies dictate which version is fetched. + The fetchDependency function is idempotent, so we don't have to worry about + dealing with half fetched, or adding dependencies. + TODO check for version compatibility issues +-} fetchDependencies :: [String] -> Map.Map String Version -> IO [DependencyTree] fetchDependencies knownPackages dependencies = do theseDependencies <- mapM (uncurry fetchDependency) - (filter (\(name, _) -> not (name `elem` knownPackages)) (Map.toList dependencies)) + (filter (\(name, _) -> not (name `elem` knownPackages)) + (Map.toList dependencies) + ) mapM fetchTransitiveDependencies theseDependencies where fetchTransitiveDependencies :: (String, FilePath) -> IO DependencyTree @@ -444,6 +453,10 @@ fetchDependency name version = do return (name, clonePath) Nothing -> return (name, clonePath) +{- + Bulding the dependencies is done on a depth first basis to ensure all of + the transitive dependencies have been built before trying to build this one +-} buildDependencies :: String -> String -> [String] -> [DependencyTree] -> IO [FilePath] buildDependencies buildPrefix compiler flags dependencies = do |