Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Terrabuild.Common.Tests/IO.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Terrabuild.Tests.IO
open FsUnit
open NUnit.Framework
open System.IO
open Microsoft.Extensions.FileSystemGlobbing

[<Test>]
let ``Detect new files``() =
Expand All @@ -15,3 +16,14 @@ let ``Detect new files``() =

diff
|> should equal expected


[<Test>]
let ``Matcher``() =
let matcher = Matcher()
matcher.AddInclude("**/*").AddExcludePatterns(["**/node_modules"; "**/.nuxt"; "**/.vscode"])

matcher.Match(".vscode").HasMatches |> should equal false
matcher.Match("node_modules").HasMatches |> should equal false
matcher.Match("toto/node_modules").HasMatches |> should equal false
matcher.Match("toto/tagada.txt").HasMatches |> should equal true
10 changes: 6 additions & 4 deletions src/Terrabuild/Core/Configuration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ let read (options: ConfigOptions.Options) =
let projectFiles =
let matcher = Matcher()
matcher.AddInclude("**/*").AddExcludePatterns(workspaceConfig.Workspace.Ignores)
printfn $"{workspaceConfig.Workspace.Ignores}"

let rec findDependencies isSubFolder dir =
seq {
Expand All @@ -472,11 +473,12 @@ let read (options: ConfigOptions.Options) =
match projectFile with
| FS.File file ->
file |> FS.parentDirectory |> FS.relativePath options.Workspace
| _ ->
for subdir in dir |> IO.enumerateDirs do
let relativeDir = subdir |> FS.relativePath options.Workspace
if matcher.Match(relativeDir).HasMatches then
| FS.Directory dir ->
let relativeDir = dir |> FS.relativePath options.Workspace
if matcher.Match(relativeDir).HasMatches then
for subdir in dir |> IO.enumerateDirs do
yield! findDependencies true subdir
| _ -> ()
}

findDependencies false options.Workspace
Expand Down
Loading
Loading