Skip to content

Commit

Permalink
Excluded source files in build directory
Browse files Browse the repository at this point in the history
Fixes #456
  • Loading branch information
scohen committed Feb 21, 2024
1 parent a028a54 commit 432ac91
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/remote_control/lib/lexical/remote_control/search/indexer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule Lexical.RemoteControl.Search.Indexer do

project_files =
project
|> indexable_files
|> indexable_files()
|> MapSet.new()

previously_indexed_paths = MapSet.new(path_to_ids, fn {path, _} -> path end)
Expand Down Expand Up @@ -176,10 +176,12 @@ defmodule Lexical.RemoteControl.Search.Indexer do

def indexable_files(%Project{} = project) do
root_dir = Project.root_path(project)
build_dir = build_dir()

[root_dir, "**", @indexable_extensions]
|> Path.join()
|> Path.wildcard()
|> Enum.reject(&contained_in?(&1, build_dir))
end

# stat(path) is here for testing so it can be mocked
Expand All @@ -199,4 +201,11 @@ defmodule Lexical.RemoteControl.Search.Indexer do
_ -> Mix.Project.deps_path()
end
end

defp build_dir do
case RemoteControl.Mix.in_project(&Mix.Project.build_path/0) do
{:ok, path} -> path
_ -> Mix.Project.build_path()
end
end
end

0 comments on commit 432ac91

Please sign in to comment.