From 3711c344040f47cebceb5daaae553ecb9f10cc8c Mon Sep 17 00:00:00 2001 From: Munjal A Patel Date: Sun, 2 Jul 2023 05:59:51 -0700 Subject: [PATCH 1/5] resolve no`local return` and `will never be called` dialyzer errors Reference: https://stackoverflow.com/questions/76597378/elixirls-dialyzer-errors-no-local-return-and-will-never-be-called --- lib/graphql/parser/nif.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/graphql/parser/nif.ex b/lib/graphql/parser/nif.ex index cd8af8a..92db81e 100644 --- a/lib/graphql/parser/nif.ex +++ b/lib/graphql/parser/nif.ex @@ -20,12 +20,13 @@ defmodule GraphQL.Parser.Nif do |> :filename.dirname |> :filename.dirname |> :filename.join('priv') + path -> path end end def parse(_) do - exit(:nif_library_not_loaded) + :erlang.nif_error(:nif_library_not_loaded) end end From 8f73beb744defb09f97b4ff11b7bbdf8bda03c99 Mon Sep 17 00:00:00 2001 From: Munjal A Patel Date: Sun, 2 Jul 2023 06:02:38 -0700 Subject: [PATCH 2/5] upgrade poison to v2.2.0 --- mix.lock | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mix.lock b/mix.lock index cd6a1bc..ec52010 100644 --- a/mix.lock +++ b/mix.lock @@ -1,3 +1,5 @@ -%{"earmark": {:hex, :earmark, "0.1.19"}, - "ex_doc": {:hex, :ex_doc, "0.11.1"}, - "poison": {:hex, :poison, "1.5.0"}} +%{ + "earmark": {:hex, :earmark, "0.1.19", "ffec54f520a11b711532c23d8a52b75a74c09697062d10613fa2dbdf8a9db36e", [:mix], [], "hexpm", "db85f989ba3030d40d3a901d7eebbf926ee07355bf6113d730b8aaf9404a6bd7"}, + "ex_doc": {:hex, :ex_doc, "0.11.1", "43a16e4168e384213a052e6ee77723b765165b866ac52a10394dfa8f7de5b203", [:mix], [{:earmark, "~> 0.1.17 or ~> 0.2", [hex: :earmark, repo: "hexpm", optional: true]}], "hexpm", "d9da03da5792939081ce8bc9753136a98978ec1f23b2ff364395fd4cd50e674f"}, + "poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], [], "hexpm", "519bc209e4433961284174c497c8524c001e285b79bdf80212b47a1f898084cc"}, +} From 438d5648be7f14fbb335c32364c29f4e56642733 Mon Sep 17 00:00:00 2001 From: Munjal A Patel Date: Sun, 2 Jul 2023 06:09:42 -0700 Subject: [PATCH 3/5] upgrade lib version to v0.0.4 --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 8657281..79779b8 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule GraphQL.Parser.Mixfile do use Mix.Project - @version "0.0.3" + @version "0.0.4" def project do [app: :graphql_parser, From 638aa3dda002c48e56f5a6a36414349928365580 Mon Sep 17 00:00:00 2001 From: Munjal A Patel Date: Sun, 2 Jul 2023 06:13:41 -0700 Subject: [PATCH 4/5] update README.md with the correct version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d7376f6..3fb2e03 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ To get started quickly, add GraphQL.Parser to your deps in `mix.exs`: ```elixir defp deps do - [{:graphql_parser, "~> 0.0.3"}] + [{:graphql_parser, "~> 0.0.4"}] end ``` From b7413037efb562170ef6ee1e93ef42c7713abd58 Mon Sep 17 00:00:00 2001 From: Munjal A Patel Date: Sun, 2 Jul 2023 12:05:14 -0700 Subject: [PATCH 5/5] update mix.exs formatting --- mix.exs | 91 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 37 deletions(-) diff --git a/mix.exs b/mix.exs index 79779b8..acdbf81 100644 --- a/mix.exs +++ b/mix.exs @@ -4,17 +4,19 @@ defmodule GraphQL.Parser.Mixfile do @version "0.0.4" def project do - [app: :graphql_parser, - name: "GraphQL.Parser", - version: @version, - elixir: "~> 1.2", - compilers: [:nif] ++ Mix.compilers, - build_embedded: Mix.env == :prod, - start_permanent: Mix.env == :prod, - description: description, - package: package, - docs: docs, - deps: deps] + [ + app: :graphql_parser, + name: "GraphQL.Parser", + version: @version, + elixir: "~> 1.2", + compilers: [:nif] ++ Mix.compilers(), + build_embedded: Mix.env() == :prod, + start_permanent: Mix.env() == :prod, + description: description(), + package: package(), + docs: docs(), + deps: deps() + ] end def application do @@ -22,9 +24,7 @@ defmodule GraphQL.Parser.Mixfile do end defp deps do - [{:poison, "~> 2.0"}, - {:earmark, "~> 0.1", only: :dev}, - {:ex_doc, "~> 0.11", only: :dev}] + [{:poison, "~> 2.0"}, {:earmark, "~> 0.1", only: :dev}, {:ex_doc, "~> 0.11", only: :dev}] end defp description do @@ -35,36 +35,51 @@ defmodule GraphQL.Parser.Mixfile do end defp package do - [maintainers: ["Vignesh Rajagopalan"], - licenses: ["MIT"], - links: %{"GitHub" => "https://github.com/aarvay/graphql_parser"}, - files: ["lib", "src", "Makefile", "mix.exs", "README.md", - "libgraphqlparser/ast/ast.ast", "libgraphqlparser/ast/*.py", - "libgraphqlparser/c/*.cpp", "libgraphqlparser/c/*.h", - "libgraphqlparser/*.h", "libgraphqlparser/*.cpp", - "libgraphqlparser/*.lpp", "libgraphqlparser/*.hh", - "libgraphqlparser/*.hpp", "libgraphqlparser/*.ypp", - "libgraphqlparser/CMakeLists.txt", "libgraphqlparser/LICENSE", - "libgraphqlparser/PATENTS", "libgraphqlparser/README.md"]] + [ + maintainers: ["Vignesh Rajagopalan"], + licenses: ["MIT"], + links: %{"GitHub" => "https://github.com/aarvay/graphql_parser"}, + files: [ + "lib", + "src", + "Makefile", + "mix.exs", + "README.md", + "libgraphqlparser/ast/ast.ast", + "libgraphqlparser/ast/*.py", + "libgraphqlparser/c/*.cpp", + "libgraphqlparser/c/*.h", + "libgraphqlparser/*.h", + "libgraphqlparser/*.cpp", + "libgraphqlparser/*.lpp", + "libgraphqlparser/*.hh", + "libgraphqlparser/*.hpp", + "libgraphqlparser/*.ypp", + "libgraphqlparser/CMakeLists.txt", + "libgraphqlparser/LICENSE", + "libgraphqlparser/PATENTS", + "libgraphqlparser/README.md" + ] + ] end defp docs do - [source_ref: "v#{@version}", - extras: ["README.md"], - main: "README"] + [source_ref: "v#{@version}", extras: ["README.md"], main: "README"] end end defmodule GraphQL.Parser.MixHelper do def check_exit_status({res, exit_status_code}) do if exit_status_code != 0 do - raise Mix.Error, message: """ - Build command exited with status code: #{exit_status_code}. - Make sure you're running `mix compile` from project's root. - """ + raise Mix.Error, + message: """ + Build command exited with status code: #{exit_status_code}. + Make sure you're running `mix compile` from project's root. + """ end - IO.binwrite res # verbose + # verbose + IO.binwrite(res) end end @@ -81,15 +96,17 @@ defmodule Mix.Tasks.Compile.Nif do rescue e in Mix.Error -> raise e + e in ErlangError -> case e.original do :enoent -> - raise Mix.Error, message: """ - Please check if `cmake` and `make` are installed - """ + raise Mix.Error, + message: """ + Please check if `cmake` and `make` are installed + """ end end - Mix.Project.build_structure + Mix.Project.build_structure() end end