fix compilation warning about ASN.1
This commit is contained in:
parent
f03838ba6e
commit
690111f1f4
2 changed files with 38 additions and 2 deletions
39
mix.exs
39
mix.exs
|
@ -24,10 +24,47 @@ defmodule Floof.MixProject do
|
|||
# Run "mix help deps" to learn about dependencies.
|
||||
defp deps do
|
||||
[
|
||||
{:asn1ex, git: "https://github.com/vicentfg/asn1ex"},
|
||||
{:enacl, "~> 1.0.0"}
|
||||
# {:dep_from_hexpm, "~> 0.3.0"},
|
||||
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
# source: https://github.com/processone/ejabberd/blob/441eca75b23ecc3fd2ae35655d23061fb28cdefa/mix.exs
|
||||
defmodule Mix.Tasks.Compile.Asn1 do
|
||||
use Mix.Task
|
||||
alias Mix.Compilers.Erlang
|
||||
|
||||
@recursive true
|
||||
@manifest ".compile.asn1"
|
||||
|
||||
def run(args) do
|
||||
{opts, _, _} = OptionParser.parse(args, switches: [force: :boolean])
|
||||
|
||||
project = Mix.Project.config
|
||||
source_paths = project[:asn1_paths] || ["asn1"]
|
||||
dest_paths = project[:asn1_target] || ["src"]
|
||||
mappings = Enum.zip(source_paths, dest_paths)
|
||||
options = project[:asn1_options] || []
|
||||
|
||||
force = case opts[:force] do
|
||||
:true -> [force: true]
|
||||
_ -> [force: false]
|
||||
end
|
||||
|
||||
Erlang.compile(manifest(), mappings, :asn1, :erl, force, fn
|
||||
input, output ->
|
||||
options = options ++ [:noobj, outdir: Erlang.to_erl_file(Path.dirname(output))]
|
||||
case :asn1ct.compile(Erlang.to_erl_file(input), options) do
|
||||
:ok -> {:ok, :done}
|
||||
error -> error
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
def manifests, do: [manifest()]
|
||||
defp manifest, do: Path.join(Mix.Project.manifest_path, @manifest)
|
||||
|
||||
def clean, do: Erlang.clean(manifest())
|
||||
end
|
||||
|
|
1
mix.lock
1
mix.lock
|
@ -1,4 +1,3 @@
|
|||
%{
|
||||
"asn1ex": {:git, "https://github.com/vicentfg/asn1ex", "0255348e2fffbdfd1eef7b46f71dc733318a36a0", []},
|
||||
"enacl": {:hex, :enacl, "1.0.0", "1bacae6c8aad1a2944ed5eb108e241d0d5e466819b685dfa690650abdff9bba0", [:rebar3], [], "hexpm", "308b38a8cb0d244c97d06b8da73abc318d73f576ab1e7c4999eaf0bbcf993bd2"},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue