Mix.Project.compile_path() inside an umbrella

I have a Mix.Task.Compiler that runs under an umbrella which calls Mix.Project.compile_path(). When I am under the app path, I get the result I expect, but when I am at the root of the umbrella, I get a runtime error:

** (RuntimeError) trying to access Mix.Project.app_path for an umbrella project but umbrellas have no app
    (mix 1.11.3) lib/mix/project.ex:602: Mix.Project.app_path/1
    (mix 1.11.3) lib/mix/project.ex:628: Mix.Project.compile_path/1
    lib/mix/compiler.ex:11: Mix.Tasks.Compile.Test.run/1
    (mix 1.11.3) lib/mix/task.ex:394: Mix.Task.run_task/3
    (elixir 1.11.3) lib/file.ex:1553: File.cd!/2
    (mix 1.11.3) lib/mix/project_stack.ex:49: Mix.ProjectStack.on_recursing_root/1
    (mix 1.11.3) lib/mix/tasks/compile.all.ex:90: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.11.3) lib/mix/tasks/compile.all.ex:70: Mix.Tasks.Compile.All.compile/4

How do I access the compile path for the project inside the umbrella?

1 Like