mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 21:43:02 +12:00
fix: make depend_on_resources
more reliable
This commit is contained in:
parent
2342126a2d
commit
b7c720fb3f
1 changed files with 10 additions and 2 deletions
|
@ -88,10 +88,18 @@ defmodule Ash.Api.Info do
|
||||||
@spec depend_on_resources(Macro.t()) :: Macro.t()
|
@spec depend_on_resources(Macro.t()) :: Macro.t()
|
||||||
defmacro depend_on_resources(api) do
|
defmacro depend_on_resources(api) do
|
||||||
quote do
|
quote do
|
||||||
|
Code.ensure_compiled!(unquote(api))
|
||||||
|
|
||||||
if registry = Ash.Api.Info.registry(unquote(api)) do
|
if registry = Ash.Api.Info.registry(unquote(api)) do
|
||||||
@external_resource List.to_string(registry.module_info(:compile)[:source])
|
Code.ensure_compiled!(registry)
|
||||||
|
# I guess I have to do this because the module name is dynamic?
|
||||||
|
# Still, seems pretty strange. This works, at least.
|
||||||
|
Kernel.LexicalTracker.remote_dispatch(__ENV__.lexical_tracker, unquote(api), :compile)
|
||||||
|
|
||||||
for entry <- Ash.Registry.Info.entries(registry) do
|
for entry <- Ash.Registry.Info.entries(registry) do
|
||||||
@external_resource List.to_string(entry.module_info(:compile)[:source])
|
Code.ensure_compiled!(entry)
|
||||||
|
# same note as above
|
||||||
|
Kernel.LexicalTracker.remote_dispatch(__ENV__.lexical_tracker, entry, :compile)
|
||||||
entry
|
entry
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue