diff options
| -rw-r--r-- | Omni/Bild.hs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Omni/Bild.hs b/Omni/Bild.hs index fcf959f..39ac01f 100644 --- a/Omni/Bild.hs +++ b/Omni/Bild.hs @@ -225,6 +225,7 @@ move args = do |> filterM Dir.doesFileExist +> filterGitIgnored /> filter (\x -> isGitHook x |> don't) + /> filter isLikelySourceFile +> traverse Dir.makeAbsolute +> traverse (namespaceFromPathOrDie root) let (namespaces, skippedNamespaces) = partition isBuildableNs allNamespaces @@ -326,6 +327,40 @@ isGitHook :: FilePath -> Bool isGitHook path = "Omni/Ide/hooks" `List.isInfixOf` path +-- | Filter out files that are clearly not source files to avoid namespace parsing errors +isLikelySourceFile :: FilePath -> Bool +isLikelySourceFile path = + not (isDotfile path || isConfigFile path) + where + isDotfile p = + let filename = List.reverse (takeWhile (/= '/') (List.reverse p)) + in case filename of + ('.' : _) -> True + _ -> False + isConfigFile p = + any + (`List.isSuffixOf` p) + [ ".json", + ".yaml", + ".yml", + ".toml", + ".ini", + ".cfg", + ".conf", + ".lock", + ".log", + ".tmp", + ".bak", + ".orig", + "Makefile", + "makefile", + "Dockerfile", + "LICENSE", + "README", + ".gitignore", + ".gitattributes" + ] + test_isGitHook :: Test.Tree test_isGitHook = Test.group |
