From d7a754a06dc645679b8280969938d2ddbe6de0b4 Mon Sep 17 00:00:00 2001 From: Calancea Daniel Date: Fri, 20 Dec 2019 14:33:24 +0200 Subject: [PATCH 1/3] Changed from Mix.Project.config to Application.get_env --- lib/mix/tasks/compile.asn1.ex | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/mix/tasks/compile.asn1.ex b/lib/mix/tasks/compile.asn1.ex index 4d5db53..7e9c5ea 100644 --- a/lib/mix/tasks/compile.asn1.ex +++ b/lib/mix/tasks/compile.asn1.ex @@ -37,11 +37,10 @@ defmodule Mix.Tasks.Compile.Asn1 do def run(args) do {opts, _, _} = OptionParser.parse(args, switches: [force: :boolean]) - project = Mix.Project.config - source_paths = project[:asn1_paths] || ["asn1"] - dest_paths = project[:erlc_paths] + source_paths = Application.get_env(:asn1ex, :asn1_paths) || ["asn1"] + dest_paths = Application.get_env(:asn1ex, :erlc_paths) || ["src"] # mappings = Enum.zip(source_paths, dest_paths) - options = project[:asn1_options] || [] + options = Application.get_env(:asn1ex, :asn1_options) || [] build_dest() From e9740287d33ea0f63f4b5146493bde00b3cfcac8 Mon Sep 17 00:00:00 2001 From: Calancea Daniel Date: Fri, 20 Dec 2019 14:36:58 +0200 Subject: [PATCH 2/3] Added examples of config --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index ebbe6d8..317961f 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,8 @@ Other configuration options: - `:asn1_options` - compilation options that apply to ASN.1's compiler. There are many other available options here: http://erlang.org/doc/man/asn1ct.html#compile-2. + +Config Examples: +- `config :asn1ex, :asn1_options, [:maps, :per]` +- `config :asn1ex, :erlc_paths, ["src"]` +- `config :asn1ex, :asn1_paths, ["asn1"]` \ No newline at end of file From 7ff82606af165757feb199d355b1b3369c116e40 Mon Sep 17 00:00:00 2001 From: Calancea Daniel Date: Fri, 20 Dec 2019 17:44:15 +0200 Subject: [PATCH 3/3] Moved default config to mix.exs --- lib/mix/tasks/compile.asn1.ex | 6 +++--- mix.exs | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/mix/tasks/compile.asn1.ex b/lib/mix/tasks/compile.asn1.ex index 7e9c5ea..65760f2 100644 --- a/lib/mix/tasks/compile.asn1.ex +++ b/lib/mix/tasks/compile.asn1.ex @@ -37,10 +37,10 @@ defmodule Mix.Tasks.Compile.Asn1 do def run(args) do {opts, _, _} = OptionParser.parse(args, switches: [force: :boolean]) - source_paths = Application.get_env(:asn1ex, :asn1_paths) || ["asn1"] - dest_paths = Application.get_env(:asn1ex, :erlc_paths) || ["src"] + source_paths = Application.get_env(:asn1ex, :asn1_paths) + dest_paths = Application.get_env(:asn1ex, :erlc_paths) # mappings = Enum.zip(source_paths, dest_paths) - options = Application.get_env(:asn1ex, :asn1_options) || [] + options = Application.get_env(:asn1ex, :asn1_options) build_dest() diff --git a/mix.exs b/mix.exs index 777898a..868136c 100644 --- a/mix.exs +++ b/mix.exs @@ -8,7 +8,9 @@ defmodule Asn1ex.Mixfile do end def application do - [] + [ + env: [asn1_paths: ["asn1"], erlc_paths: ["src"], asn1_options: []] + ] end defp deps do