@@ -3,6 +3,15 @@ defmodule ElixirLS.LanguageServer.Build do
3
3
alias ElixirLS.Utils.MixfileHelpers
4
4
require Logger
5
5
6
+ ## Public API
7
+
8
+ @ doc """
9
+ Starts the build process for the project at the given `root_path` with the
10
+ provided options.
11
+
12
+ This spawns a separate process (with a monitor on the caller) that performs
13
+ the build steps while holding a global build lock.
14
+ """
6
15
def build ( parent , root_path , opts ) when is_binary ( root_path ) do
7
16
Application . loaded_applications ( ) |> Enum . map ( & elem ( & 1 , 0 ) )
8
17
@@ -67,6 +76,10 @@ defmodule ElixirLS.LanguageServer.Build do
67
76
build_pid_reference
68
77
end
69
78
79
+ @ doc """
80
+ Cleans the project build artifacts (and optionally dependency artifacts)
81
+ by reloading the Mix project and running the "clean" task.
82
+ """
70
83
def clean ( root_path , clean_deps? \\ false ) when is_binary ( root_path ) do
71
84
with_build_lock ( fn ->
72
85
mixfile = SourceFile.Path . absname ( MixfileHelpers . mix_exs ( ) , root_path )
@@ -82,10 +95,15 @@ defmodule ElixirLS.LanguageServer.Build do
82
95
end )
83
96
end
84
97
98
+ @ doc """
99
+ Executes the given function `fun` while holding a global build lock.
100
+ """
85
101
def with_build_lock ( func ) do
86
102
:global . trans ( { __MODULE__ , self ( ) } , func )
87
103
end
88
104
105
+ ## Build Process
106
+
89
107
# After reloading the project, update deps and (optionally) compile.
90
108
defp handle_reloaded_project ( parent , mixfile , root_path , mixfile_diagnostics , opts , cached_deps ) do
91
109
{ deps_result , deps_raw_diagnostics } =
0 commit comments