liveview-native / live_view_native

A framework for building native applications with Phoenix LiveView
https://native.live/
MIT License
441 stars 18 forks source link

Issues generating ex_docs in project after adding LVN + issue with deps compilation order #51

Closed mayel closed 2 months ago

mayel commented 9 months ago

First issue I encountered was https://github.com/elixir-lang/ex_doc/pull/1784 (which I can avoid using bleeding edge ex_doc).

Second issue for some reason is only appearing in our CI:

Generating docs...
** (Protocol.UndefinedError) protocol Enumerable not implemented for 
{[%ExDoc.ModuleNode{id: "Bonfire.Web.AboutLive.LiveViewNativeSwiftUi", title: "Bonfire.Web.AboutLive.LiveViewNativeSwiftUi", nested_context: "Bonfire", nested_title: ".Web.AboutLive.LiveViewNativeSwiftUi", module: Bonfire.Web.AboutLive.LiveViewNativeSwiftUi, group: :"Bonfire utilities", deprecated: nil, doc_format: "text/markdown", doc: nil, source_doc: :none, rendered_doc: nil, doc_line: 5, docs_groups: [:Callbacks, :Functions], docs: [%ExDoc.FunctionNode{id: "alert/1", name: :alert, arity: 1, defaults: [], deprecated: nil, doc: nil, source_doc: :none, rendered_doc: nil, type: :function, signature: "alert(arg1)", specs: [], annotations: [], group: :Functions, doc_line: 5, source_path: "deps/bonfire/lib/web/views/about_live.ex", source_url: "https://github.com/bonfire-networks/bonfire/blob/main/lib/web/views/about_live.ex#L5"}, %ExDoc.FunctionNode{id: "alert/2",
[...snip...]
}], []} of type Tuple. 
supernintendo commented 7 months ago

@mayel I'm not able to reproduce this (I tried running mix docs within a LiveView Native project and works just fine), do you have any more info you could share or maybe a link to your repo which is affected?

mayel commented 7 months ago

@supernintendo thanks for looking at this, strangely enough I'm not able to see if this issue is still occurring in CI currently because this is blocking it instead:

==> live_view_native_platform
Compiling 11 files (.ex)
warning: redefining @moduledoc attribute previously set at line 2
  lib/live_view_native_platform/env.ex:28: LiveViewNativePlatform.Env (module)

Generated live_view_native_platform app
==> live_view_native
Compiling 18 files (.ex)

== Compilation error in file lib/live_view_native/platforms.ex ==
** (UndefinedFunctionError) function LiveViewNativeSwiftUi.platforms/0 is undefined (module LiveViewNativeSwiftUi is not available)
    LiveViewNativeSwiftUi.platforms()
    (elixir 1.15.7) lib/enum.ex:4317: Enum.flat_map_list/2
    lib/live_view_native/platforms.ex:8: (module)
could not compile dependency :live_view_native, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile live_view_native --force", update it with "mix deps.update live_view_native" or clean it with "mix deps.clean live_view_native"
error: Recipe `cmd` failed on line 707 with exit code 1
error: Recipe `mix` failed on line 732 with exit code 1
error: Recipe `docs` failed on line 171 with exit code 1

This is an error I've seen locally as well and usually get around it by cleaning the live_view_native_swift_ui and live_view_native deps and recompiling as it seems the compiler is otherwise not compiling the LVN deps in the right order?

This is the repo in question: https://github.com/bonfire-networks/bonfire-app

mayel commented 7 months ago

Looks like live_view_native and live_view_native_swift_ui both depend on live_view_native_platform but nothing tells the compiler that live_view_native_swift_ui needs to be compiled before live_view_native...

mayel commented 7 months ago

Usually I'd solve that by making live_view_native_swift_ui an optional dependency of live_view_native, but not sure what's best in this context.

bcardarella commented 2 months ago

@mayel I'm closing as I believe this is no longer a valid issue with the v0.3.0 refactor work. Thank you for reporting.