Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
6.3KB

  1. defmodule Pleroma.Mixfile do
  2. use Mix.Project
  3. def project do
  4. [
  5. app: :pleroma,
  6. version: version("0.9.0"),
  7. elixir: "~> 1.7",
  8. elixirc_paths: elixirc_paths(Mix.env()),
  9. compilers: [:phoenix, :gettext] ++ Mix.compilers(),
  10. elixirc_options: [warnings_as_errors: true],
  11. xref: [exclude: [:eldap]],
  12. start_permanent: Mix.env() == :prod,
  13. aliases: aliases(),
  14. deps: deps(),
  15. test_coverage: [tool: ExCoveralls],
  16. # Docs
  17. name: "Pleroma",
  18. homepage_url: "https://pleroma.social/",
  19. source_url: "https://git.pleroma.social/pleroma/pleroma",
  20. docs: [
  21. source_url_pattern:
  22. "https://git.pleroma.social/pleroma/pleroma/blob/develop/%{path}#L%{line}",
  23. logo: "priv/static/static/logo.png",
  24. extras: ["README.md", "CHANGELOG.md"] ++ Path.wildcard("docs/**/*.md"),
  25. groups_for_extras: [
  26. "Installation manuals": Path.wildcard("docs/installation/*.md"),
  27. Configuration: Path.wildcard("docs/config/*.md"),
  28. Administration: Path.wildcard("docs/admin/*.md"),
  29. "Pleroma's APIs and Mastodon API extensions": Path.wildcard("docs/api/*.md")
  30. ],
  31. main: "readme",
  32. output: "priv/static/doc"
  33. ]
  34. ]
  35. end
  36. # Configuration for the OTP application.
  37. #
  38. # Type `mix help compile.app` for more information.
  39. def application do
  40. [
  41. mod: {Pleroma.Application, []},
  42. extra_applications: [:logger, :runtime_tools, :comeonin, :quack],
  43. included_applications: [:ex_syslogger]
  44. ]
  45. end
  46. # Specifies which paths to compile per environment.
  47. defp elixirc_paths(:test), do: ["lib", "test/support"]
  48. defp elixirc_paths(_), do: ["lib"]
  49. # Specifies your project dependencies.
  50. #
  51. # Type `mix help deps` for examples and options.
  52. defp deps do
  53. oauth_strategies = String.split(System.get_env("OAUTH_CONSUMER_STRATEGIES") || "")
  54. oauth_deps =
  55. for s <- oauth_strategies,
  56. do: {String.to_atom("ueberauth_#{s}"), ">= 0.0.0"}
  57. [
  58. {:phoenix, "~> 1.4.1"},
  59. {:plug_cowboy, "~> 2.0"},
  60. {:phoenix_pubsub, "~> 1.1"},
  61. {:phoenix_ecto, "~> 4.0"},
  62. {:ecto_sql, "~> 3.1"},
  63. {:postgrex, ">= 0.13.5"},
  64. {:gettext, "~> 0.15"},
  65. {:comeonin, "~> 4.1.1"},
  66. {:pbkdf2_elixir, "~> 0.12.3"},
  67. {:trailing_format_plug, "~> 0.0.7"},
  68. {:html_sanitize_ex, "~> 1.3.0"},
  69. {:html_entities, "~> 0.4"},
  70. {:phoenix_html, "~> 2.10"},
  71. {:calendar, "~> 0.17.4"},
  72. {:cachex, "~> 3.0.2"},
  73. {:httpoison, "~> 1.2.0"},
  74. {:poison, "~> 3.0", override: true},
  75. {:tesla, "~> 1.2"},
  76. {:jason, "~> 1.0"},
  77. {:mogrify, "~> 0.6.1"},
  78. {:ex_aws, "~> 2.0"},
  79. {:ex_aws_s3, "~> 2.0"},
  80. {:earmark, "~> 1.3"},
  81. {:bbcode, "~> 0.1"},
  82. {:ex_machina, "~> 2.3", only: :test},
  83. {:credo, "~> 0.9.3", only: [:dev, :test]},
  84. {:mock, "~> 0.3.3", only: :test},
  85. {:crypt,
  86. git: "https://github.com/msantos/crypt", ref: "1f2b58927ab57e72910191a7ebaeff984382a1d3"},
  87. {:cors_plug, "~> 1.5"},
  88. {:ex_doc, "~> 0.20.2", only: :dev, runtime: false},
  89. {:web_push_encryption, "~> 0.2.1"},
  90. {:swoosh, "~> 0.20"},
  91. {:gen_smtp, "~> 0.13"},
  92. {:websocket_client, git: "https://github.com/jeremyong/websocket_client.git", only: :test},
  93. {:floki, "~> 0.20.0"},
  94. {:ex_syslogger, github: "slashmili/ex_syslogger", tag: "1.4.0"},
  95. {:timex, "~> 3.5"},
  96. {:ueberauth, "~> 0.4"},
  97. {:auto_linker,
  98. git: "https://git.pleroma.social/pleroma/auto_linker.git",
  99. ref: "c00c4e75b35367fa42c95ffd9b8c455bf9995829"},
  100. {:http_signatures,
  101. git: "https://git.pleroma.social/pleroma/http_signatures.git",
  102. ref: "9789401987096ead65646b52b5a2ca6bf52fc531"},
  103. {:pleroma_job_queue, "~> 0.2.0"},
  104. {:telemetry, "~> 0.3"},
  105. {:prometheus_ex, "~> 3.0"},
  106. {:prometheus_plugs, "~> 1.1"},
  107. {:prometheus_phoenix, "~> 1.2"},
  108. {:prometheus_ecto, "~> 1.4"},
  109. {:prometheus_process_collector, "~> 1.4"},
  110. {:recon, github: "ferd/recon", tag: "2.4.0"},
  111. {:quack, "~> 0.1.1"},
  112. {:benchee, "~> 1.0"},
  113. {:esshd, "~> 0.1.0", runtime: Application.get_env(:esshd, :enabled, false)},
  114. {:ex_rated, "~> 1.2"},
  115. {:plug_static_index_html, "~> 1.0.0"},
  116. {:excoveralls, "~> 0.11.1", only: :test}
  117. ] ++ oauth_deps
  118. end
  119. # Aliases are shortcuts or tasks specific to the current project.
  120. # For example, to create, migrate and run the seeds file at once:
  121. #
  122. # $ mix ecto.setup
  123. #
  124. # See the documentation for `Mix` for more info on aliases.
  125. defp aliases do
  126. [
  127. "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
  128. "ecto.reset": ["ecto.drop", "ecto.setup"],
  129. test: ["ecto.create --quiet", "ecto.migrate", "test"]
  130. ]
  131. end
  132. # Builds a version string made of:
  133. # * the application version
  134. # * a pre-release if ahead of the tag: the describe string (-count-commithash)
  135. # * build info:
  136. # * a build name if `PLEROMA_BUILD_NAME` or `:pleroma, :build_name` is defined
  137. # * the mix environment if different than prod
  138. defp version(version) do
  139. {git_tag, git_pre_release} =
  140. with {tag, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=0"]),
  141. tag = String.trim(tag),
  142. {describe, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=8"]),
  143. describe = String.trim(describe),
  144. ahead <- String.replace(describe, tag, "") do
  145. {String.replace_prefix(tag, "v", ""), if(ahead != "", do: String.trim(ahead))}
  146. else
  147. _ -> {nil, nil}
  148. end
  149. if git_tag && version != git_tag do
  150. Mix.shell().error(
  151. "Application version #{inspect(version)} does not match git tag #{inspect(git_tag)}"
  152. )
  153. end
  154. build_name =
  155. cond do
  156. name = Application.get_env(:pleroma, :build_name) -> name
  157. name = System.get_env("PLEROMA_BUILD_NAME") -> name
  158. true -> nil
  159. end
  160. env_name = if Mix.env() != :prod, do: to_string(Mix.env())
  161. build =
  162. [build_name, env_name]
  163. |> Enum.filter(fn string -> string && string != "" end)
  164. |> Enum.join("-")
  165. |> (fn
  166. "" -> nil
  167. string -> "+" <> string
  168. end).()
  169. [version, git_pre_release, build]
  170. |> Enum.filter(fn string -> string && string != "" end)
  171. |> Enum.join()
  172. end
  173. end