2020-06-15 20:23:14 +00:00
|
|
|
defmodule Majic.MixProject do
|
2020-05-03 21:58:04 +00:00
|
|
|
use Mix.Project
|
|
|
|
|
2023-08-09 12:49:39 +00:00
|
|
|
if :erlang.system_info(:otp_release) < ~c"21" do
|
2020-06-15 20:23:14 +00:00
|
|
|
raise "Majic requires Erlang/OTP 21 or newer"
|
2020-05-03 21:58:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def project do
|
|
|
|
[
|
2020-06-15 20:23:14 +00:00
|
|
|
app: :majic,
|
2020-05-03 21:58:04 +00:00
|
|
|
version: "1.0.0",
|
2023-08-09 12:49:39 +00:00
|
|
|
elixir: "~> 1.14",
|
2020-05-03 21:58:04 +00:00
|
|
|
elixirc_paths: elixirc_paths(Mix.env()),
|
2020-06-16 09:55:04 +00:00
|
|
|
elixirc_options: [warnings_as_errors: warnings_as_errors(Mix.env())],
|
2020-05-03 21:58:04 +00:00
|
|
|
start_permanent: Mix.env() == :prod,
|
|
|
|
compilers: [:elixir_make] ++ Mix.compilers(),
|
2020-07-09 14:21:08 +00:00
|
|
|
make_env: make_env(),
|
2020-05-03 21:58:04 +00:00
|
|
|
package: package(),
|
|
|
|
deps: deps(),
|
|
|
|
dialyzer: dialyzer(),
|
2020-06-15 20:23:14 +00:00
|
|
|
name: "Majic",
|
2020-05-03 21:58:04 +00:00
|
|
|
description: "File introspection with libmagic",
|
2021-12-15 18:37:41 +00:00
|
|
|
source_url: "https://git.pleroma.social/pleroma/elixir-libraries/majic",
|
2020-05-03 21:58:04 +00:00
|
|
|
docs: docs()
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def application do
|
|
|
|
[extra_applications: [:logger]]
|
|
|
|
end
|
|
|
|
|
|
|
|
defp elixirc_paths(:test), do: ["lib", "test/support"]
|
|
|
|
defp elixirc_paths(_), do: ["lib"]
|
|
|
|
|
|
|
|
defp dialyzer do
|
|
|
|
[
|
2020-06-16 09:55:04 +00:00
|
|
|
plt_add_apps: [:mix, :iex, :ex_unit, :plug, :mime],
|
2020-05-03 21:58:04 +00:00
|
|
|
flags: ~w(error_handling no_opaque race_conditions underspecs unmatched_returns)a,
|
|
|
|
ignore_warnings: "dialyzer-ignore-warnings.exs",
|
|
|
|
list_unused_filters: true
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
defp deps do
|
|
|
|
[
|
2023-08-09 12:49:39 +00:00
|
|
|
{:nimble_pool, "~> 1.0"},
|
2023-08-09 12:53:23 +00:00
|
|
|
{:mime, "~> 2.0"},
|
2020-06-16 09:55:04 +00:00
|
|
|
{:plug, "~> 1.0", optional: true},
|
2023-08-09 12:54:53 +00:00
|
|
|
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
|
2023-08-09 12:49:39 +00:00
|
|
|
{:dialyxir, "~> 1.0.0", only: :dev, runtime: false},
|
2020-05-03 21:58:04 +00:00
|
|
|
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
|
2023-08-09 12:54:53 +00:00
|
|
|
{:elixir_make, "~> 0.7", runtime: false}
|
2020-05-03 21:58:04 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
defp package do
|
|
|
|
[
|
|
|
|
licenses: ["Apache 2.0"],
|
2020-06-16 09:55:04 +00:00
|
|
|
links: %{"GitHub" => "https://github.com/hrefhref/majic"},
|
2021-12-15 18:37:41 +00:00
|
|
|
source_url: "https://git.pleroma.social/pleroma/elixir-libraries/majic"
|
2020-05-03 21:58:04 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
defp docs do
|
|
|
|
[
|
|
|
|
main: "readme",
|
|
|
|
extras: ["README.md", "CHANGELOG.md"]
|
|
|
|
]
|
|
|
|
end
|
2020-06-16 09:55:04 +00:00
|
|
|
|
|
|
|
defp warnings_as_errors(:dev), do: false
|
|
|
|
defp warnings_as_errors(_), do: true
|
2020-07-09 14:21:08 +00:00
|
|
|
|
|
|
|
defp make_env() do
|
2021-12-15 18:37:41 +00:00
|
|
|
otp =
|
|
|
|
:erlang.system_info(:otp_release)
|
|
|
|
|> to_string()
|
|
|
|
|> String.to_integer()
|
2020-07-09 14:21:08 +00:00
|
|
|
|
|
|
|
ei_incomplete = if(otp < 21.3, do: "YES", else: "NO")
|
|
|
|
%{"EI_INCOMPLETE" => ei_incomplete}
|
|
|
|
end
|
2020-05-03 21:58:04 +00:00
|
|
|
end
|