This commit is contained in:
Mayel de Borniol 2022-11-30 12:44:04 +13:00
parent 2808437219
commit 2fb790f619
4 changed files with 41 additions and 12 deletions

View file

@ -12,9 +12,26 @@ config :bonfire, Bonfire.Common.Repo,
# EctoSparkles does the logging instead
log: false
local_deps = Mess.deps((if System.get_env("WITH_FORKS", "1")=="1", do: [path: Path.relative_to_cwd("config/deps.path")], else: []), [])
local_deps =
Mess.deps(
if(System.get_env("WITH_FORKS", "1") == "1",
do: [path: Path.relative_to_cwd("config/deps.path")],
else: []
),
[]
)
local_dep_names = Enum.map(local_deps, &elem(&1, 0))
dep_paths = Enum.map(local_deps, &(Keyword.fetch!(elem(&1, 1), :path) <> "/lib"))
dep_paths =
Enum.map(local_deps, fn dep ->
case elem(dep, 1)[:path] do
nil -> nil
path -> "#{path}/lib"
end
end)
|> Enum.reject(&is_nil/1)
watch_paths = dep_paths ++ ["lib/"] ++ ["priv/static/"]
IO.puts("Watching these deps for code reloading: #{inspect(local_dep_names)}")

View file

@ -5,7 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if not Code.ensure_loaded?(Mess) do
defmodule Mess do
@newline ~r/(?:\r\n|[\r\n])/
@parser ~r/^(?<indent>\s*)((?<package>[a-z_][a-z0-9_]+)\s*=\s*"(?<value>[^"]+)")?(?<post>.*)/
@git_branch ~r/(?<repo>[^#]+)(#(?<branch>.+))?/
@ -14,13 +13,20 @@ if not Code.ensure_loaded?(Mess) do
defp sources(_), do: [git: "deps.git", hex: "deps.hex"]
defp opts(opts \\ []),
do: opts
|> Keyword.put_new_lazy(:use_local_forks?, fn -> System.get_env("WITH_FORKS", "1")=="1" end)
|> Keyword.put_new_lazy(:umbrella_path, fn -> if Mix.env() == :dev, do: "extensions/", else: nil end)
do:
opts
|> Keyword.put_new_lazy(:use_local_forks?, fn ->
System.get_env("WITH_FORKS", "1") == "1"
end)
|> Keyword.put_new_lazy(:umbrella_path, fn ->
if Mix.env() == :dev, do: "extensions/", else: nil
end)
def deps(sources \\ nil, extra_deps, opts \\ []) do
opts = opts(opts)
Enum.flat_map(sources || sources(opts[:use_local_forks?]), fn {k, v} -> read(v, k) end) |> deps_packages(extra_deps, opts)
Enum.flat_map(sources || sources(opts[:use_local_forks?]), fn {k, v} -> read(v, k) end)
|> deps_packages(extra_deps, opts)
end
defp deps_packages(packages, extra_deps, opts),
@ -44,11 +50,13 @@ if not Code.ensure_loaded?(Mess) do
dep_opts = elem(dep, 1)
is_list(dep_opts) and dep_opts[:from_umbrella]
end)
# |> IO.inspect(label: "umbrella_only")
opts[:umbrella_path] != nil ->
umbrella_deps = read_umbrella("#{File.cwd!()}/config/deps.path", opts)
|> IO.inspect(label: "umbrella_deps")
umbrella_deps =
read_umbrella("#{File.cwd!()}/config/deps.path", opts)
|> IO.inspect(label: "umbrella_deps")
deps
|> Enum.map(fn dep ->

View file

@ -6,9 +6,13 @@ defmodule Bonfire.Umbrella.MixProject do
alias Bonfire.Mixer
# we only behave as an umbrella im dev/test env
@use_local_forks System.get_env("WITH_FORKS", "1")=="1"
@use_local_forks System.get_env("WITH_FORKS", "1") == "1"
@umbrella_path if Mix.env() == :dev and @use_local_forks, do: Mixer.forks_path(), else: nil
@mess_opts [use_local_forks?: @use_local_forks, umbrella_root?: @use_local_forks, umbrella_path: @umbrella_path]
@mess_opts [
use_local_forks?: @use_local_forks,
umbrella_root?: @use_local_forks,
umbrella_path: @umbrella_path
]
@extra_deps [
## password hashing - builtin vs nif

View file

@ -12,7 +12,7 @@
"benchee": {:hex, :benchee, "1.1.0", "f3a43817209a92a1fade36ef36b86e1052627fd8934a8b937ac9ab3a76c43062", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}], "hexpm", "7da57d545003165a012b587077f6ba90b89210fd88074ce3c60ce239eb5e6d93"},
"benchee_html": {:hex, :benchee_html, "1.0.0", "5b4d24effebd060f466fb460ec06576e7b34a00fc26b234fe4f12c4f05c95947", [:mix], [{:benchee, ">= 0.99.0 and < 2.0.0", [hex: :benchee, repo: "hexpm", optional: false]}, {:benchee_json, "~> 1.0", [hex: :benchee_json, repo: "hexpm", optional: false]}], "hexpm", "5280af9aac432ff5ca4216d03e8a93f32209510e925b60e7f27c33796f69e699"},
"benchee_json": {:hex, :benchee_json, "1.0.0", "cc661f4454d5995c08fe10dd1f2f72f229c8f0fb1c96f6b327a8c8fc96a91fe5", [:mix], [{:benchee, ">= 0.99.0 and < 2.0.0", [hex: :benchee, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "da05d813f9123505f870344d68fb7c86a4f0f9074df7d7b7e2bb011a63ec231c"},
"bonfire": {:git, "https://github.com/bonfire-networks/bonfire_spark", "db59432777a2464f52325057a54ead4d21e87ec8", [branch: "main"]},
"bonfire": {:git, "https://github.com/bonfire-networks/bonfire_spark", "69168f66c1d4653637c0fb77d5c19f6ba42ce679", [branch: "main"]},
"bonfire_api_graphql": {:git, "https://github.com/bonfire-networks/bonfire_api_graphql", "7c8268a59a411013d492dda7e1bb117870bc13dd", [branch: "main"]},
"bonfire_boundaries": {:git, "https://github.com/bonfire-networks/bonfire_boundaries", "a294df656241bb8d2dc7570b7938b1c22a0a6fbd", [branch: "main"]},
"bonfire_breadpub": {:git, "https://github.com/bonfire-networks/bonfire_breadpub", "069698b23040279896f86f3a30d4178642162a53", [branch: "main"]},