diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1ef85809..97ada5ce 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a report to help us improve +about: Create a report to help us improve Domo title: '' labels: '' assignees: '' @@ -11,16 +11,29 @@ assignees: '' * Elixir version (elixir -v): * Domo version (mix deps | grep domo | head -1): -* TypedStruct version (mix deps | grep typed_struct | head -1): ### Actual behavior + + +### Expected behavior + + + +### Verbose output + +If the bug happens during the test, then run the command in the test environment like the following: -### Expected behavior +MIX_ENV=test mix clean && mix compile --verbose + +Attach the output. +--> diff --git a/README.md b/README.md index 458b8332..cbafb8f7 100644 --- a/README.md +++ b/README.md @@ -744,6 +744,10 @@ F.e. with `validate_required/2` call in the `Ecto` changeset. ## Changelog +### v1.5.5 (2022-06-12) + +* Fix to repeatedly run `mix test` and `mix dialyzer` without crashes. + ### v1.5.4 (2022-05-23) * Fix to reenable the support of Phoenix hot-reload. If you use it then, please, add `:domo_phoenix_hot_reload` after `:elixir` to `compilers` list in the mix.exs file and to `reloadable_compilers` list in the config file. diff --git a/example_avialia/config/dev.exs b/example_avialia/config/dev.exs index 040a09ab..8d25dec9 100644 --- a/example_avialia/config/dev.exs +++ b/example_avialia/config/dev.exs @@ -27,7 +27,7 @@ config :example_avialia, ExampleAvialiaWeb.Endpoint, http: [port: 4000], debug_errors: true, code_reloader: true, - reloadable_compilers: [:phoenix, :domo_compiler] ++ Mix.compilers(), + reloadable_compilers: [:phoenix, :domo_compiler] ++ Mix.compilers() ++ [:domo_phoenix_hot_reload], check_origin: false, watchers: [ node: [ diff --git a/example_avialia/mix.exs b/example_avialia/mix.exs index 111c3368..14cd7b62 100644 --- a/example_avialia/mix.exs +++ b/example_avialia/mix.exs @@ -7,7 +7,7 @@ defmodule ExampleAvialia.MixProject do version: "0.1.0", elixir: "~> 1.11", elixirc_paths: elixirc_paths(Mix.env()), - compilers: [:phoenix, :domo_compiler] ++ Mix.compilers(), + compilers: [:phoenix, :domo_compiler] ++ Mix.compilers() ++ [:domo_phoenix_hot_reload], start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), diff --git a/lib/domo/type_ensurer_factory/dependency_resolver.ex b/lib/domo/type_ensurer_factory/dependency_resolver.ex index c73dbb2b..0943e707 100644 --- a/lib/domo/type_ensurer_factory/dependency_resolver.ex +++ b/lib/domo/type_ensurer_factory/dependency_resolver.ex @@ -108,7 +108,7 @@ defmodule Domo.TypeEnsurerFactory.DependencyResolver do defp maybe_cleanup_preconds(preconds_path, preconds, file_module) do updated_preconds = Enum.reduce(preconds, %{}, fn {module, type_precond_description}, map -> - if Kernel.function_exported?(module, :__precond__, 2) do + if Code.ensure_loaded?(module) and Kernel.function_exported?(module, :__precond__, 2) do Map.put(map, module, type_precond_description) else map @@ -253,8 +253,22 @@ defmodule Domo.TypeEnsurerFactory.DependencyResolver do # and make elixir compiler to percept them as stale files. Process.sleep(1000) + if verbose? do + IO.write(""" + Domo marks files for recompilation by touching: + #{Enum.join(sources_to_recompile, "\n")} + """) + end + Enum.each(sources_to_recompile, &File.touch!/1) + if verbose? do + IO.write(""" + Domo meets Elixir's criteria for recompilation by removing: + #{Enum.join(beams_to_recompile, "\n")} + """) + end + # Since v1.13 Elixir expects missing .beam to recompile from source Enum.each(beams_to_recompile, &File.rm/1) diff --git a/lib/domo/type_ensurer_factory/resolver.ex b/lib/domo/type_ensurer_factory/resolver.ex index a729be8e..cc18dccd 100644 --- a/lib/domo/type_ensurer_factory/resolver.ex +++ b/lib/domo/type_ensurer_factory/resolver.ex @@ -63,10 +63,12 @@ defmodule Domo.TypeEnsurerFactory.Resolver do {:ok, fields_envs} -> modules_count = map_size(fields) - IO.puts(""" - Domo is compiling type ensurer for #{to_string(modules_count)} \ - module#{if modules_count > 1, do: "s"} (.ex)\ - """) + if modules_count > 0 do + IO.puts(""" + Domo is compiling type ensurer for #{to_string(modules_count)} \ + module#{if modules_count > 1, do: "s"} (.ex)\ + """) + end anys_by_module = plan[:anys_by_module] diff --git a/mix.exs b/mix.exs index 8b51cab8..ee24d7cd 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Domo.MixProject do use Mix.Project - @version "1.5.4" + @version "1.5.5" @repo_url "https://github.com/IvanRublev/Domo" def project do