Skip to content

Commit 26899a9

Browse files
Make Mix.Project.with_build_lock/2 public (#13920)
1 parent 74beb7f commit 26899a9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/mix/lib/mix/project.ex

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,18 @@ defmodule Mix.Project do
882882
end
883883
end
884884

885-
@doc false
885+
@doc """
886+
Acquires a lock on the project build path and runs the given function.
887+
888+
When another process (across all OS processes) is holding the lock,
889+
a message is printed and this call blocks until the lock is acquired.
890+
This function can also be called if this process already has the
891+
lock. In such case the function is executed immediately.
892+
893+
This lock is primarily useful for compiler tasks that alter the build
894+
artifacts to avoid conflicts with a concurrent compilation.
895+
"""
896+
@spec with_build_lock(keyword, (-> term())) :: term()
886897
def with_build_lock(config \\ config(), fun) do
887898
# To avoid duplicated compilation, we wrap compilation tasks, such
888899
# as compile.all, deps.compile, compile.elixir, compile.erlang in

0 commit comments

Comments
 (0)