Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated configuration load and added examples of config #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]`
7 changes: 3 additions & 4 deletions lib/mix/tasks/compile.asn1.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
dest_paths = Application.get_env(:asn1ex, :erlc_paths)
# mappings = Enum.zip(source_paths, dest_paths)
options = project[:asn1_options] || []
options = Application.get_env(:asn1ex, :asn1_options)

build_dest()

Expand Down
4 changes: 3 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down