diff --git a/lib/bundlex/project.ex b/lib/bundlex/project.ex index 3d4cfa9..feb5832 100644 --- a/lib/bundlex/project.ex +++ b/lib/bundlex/project.ex @@ -47,15 +47,21 @@ defmodule Bundlex.Project do - `precompiled` - Downloads the dependency from a given url and sets appropriate compilation and linking flags. Can be either `{:precompiled, url, libs}` or `{:precompiled, url}`, in which case the dependency name will be used as the lib name. - Precompiled dependencies for given applications (Mix projects) can be disabled via configuration, for example: + Precompiled dependencies can be disabled via configuration globally: - ```elixir - config :bundlex, :disable_precompiled_os_deps, - apps: [:my_application, :another_application] - ``` + ```elixir + config :bundlex, :disable_precompiled_os_deps, true + ``` - Note that this will affect the natives and libs defined in the `bundlex.exs` files of specified - applications only, not in their dependencies. + or for given applications (Mix projects), for example: + + ```elixir + config :bundlex, :disable_precompiled_os_deps, + apps: [:my_application, :another_application] + ``` + + Note that this will affect the natives and libs defined in the `bundlex.exs` files of specified + applications only, not in their dependencies. Check `t:os_dep/0` for details. * `pkg_configs` - (deprecated, use `os_deps` instead) Names of libraries for which the appropriate flags will be diff --git a/lib/bundlex/toolchain/common/unix/os_deps.ex b/lib/bundlex/toolchain/common/unix/os_deps.ex index 551040c..8ac17bc 100644 --- a/lib/bundlex/toolchain/common/unix/os_deps.ex +++ b/lib/bundlex/toolchain/common/unix/os_deps.ex @@ -38,7 +38,7 @@ defmodule Bundlex.Toolchain.Common.Unix.OSDeps do end if is_old_api do - IO.warn(""" + Output.warn(""" Native #{inspect(native_name)} uses deprecated syntax for `os_deps`. \ See `Bundlex.Project.os_dep` for the new syntax. """) @@ -110,12 +110,13 @@ defmodule Bundlex.Toolchain.Common.Unix.OSDeps do end defp resolve_os_dep_provider(name, {:precompiled, url, lib_names}, native) do - disabled_apps = - Application.get_env(:bundlex, :disable_precompiled_os_deps, []) - |> Keyword.get(:apps, []) - |> Bunch.listify() + is_precompiled_disabled = + case Application.get_env(:bundlex, :disable_precompiled_os_deps, false) do + bool when is_boolean(bool) -> bool + [apps: apps] -> native.app in Bunch.listify(apps) + end - if native.app in disabled_apps do + if is_precompiled_disabled do {:error, """ is disabled in the application configuration, check the config.exs file.