mk_mix_file.escript 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env escript
  2. %% Generates mix.exs from ebin/mysql.app.
  3. %% The mix file is used for publishing the package to Hex.
  4. -mode(compile).
  5. -define(MIX_TPL,
  6. <<"defmodule Mysql.Mixfile do
  7. use Mix.Project
  8. def project() do
  9. [app: :mysql,
  10. version: \"~s\",
  11. elixir: \"~~> 1.0\",
  12. description: description(),
  13. package: package(),
  14. build_embedded: Mix.env == :prod,
  15. start_permanent: Mix.env == :prod,
  16. deps: deps(),
  17. aliases: aliases()]
  18. end
  19. defp description() do
  20. \"\"\"
  21. ~s
  22. \"\"\"
  23. end
  24. defp package() do
  25. [contributors: [\"Viktor Söderqvist\", \"Jan Uhlig\", \"et.al.\"],
  26. maintainers: [\"Viktor Söderqvist\", \"TJ\"],
  27. licenses: [\"LGPL-3.0-or-later\"],
  28. links: %{\"GitHub\" => \"https://github.com/mysql-otp/mysql-otp\"},
  29. build_tools: [\"make\", \"rebar3\", \"mix\"],
  30. files: ~~w(mix.exs README.md CHANGELOG.md) ++
  31. ~~w(doc erlang.mk include Makefile priv src test)
  32. ]
  33. end
  34. # Configuration for the OTP application
  35. #
  36. # Type `mix help compile.app` for more information
  37. def application() do
  38. [applications: [:ssl]]
  39. end
  40. # Dependencies
  41. defp deps() do
  42. []
  43. end
  44. # Alias docs to nothing, just to be able to publish docs to Hex
  45. # using already generated docs
  46. defp aliases() do
  47. [
  48. docs: []
  49. ]
  50. end
  51. end
  52. ">>).
  53. main(_) ->
  54. {ok, [{application, mysql, Props}]} =
  55. file:consult("ebin/mysql.app"),
  56. Vsn = proplists:get_value(vsn, Props),
  57. Desc = proplists:get_value(description, Props),
  58. io:setopts([{encoding, unicode}]),
  59. io:format(?MIX_TPL, [Vsn, Desc]).