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.

191 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, :esshd, :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,
  63. git: "https://github.com/elixir-ecto/ecto_sql",
  64. ref: "14cb065a74c488d737d973f7a91bc036c6245f78",
  65. override: true},
  66. {:postgrex, ">= 0.13.5"},
  67. {:gettext, "~> 0.15"},
  68. {:comeonin, "~> 4.1.1"},
  69. {:pbkdf2_elixir, "~> 0.12.3"},
  70. {:trailing_format_plug, "~> 0.0.7"},
  71. {:html_sanitize_ex, "~> 1.3.0"},
  72. {:html_entities, "~> 0.4"},
  73. {:phoenix_html, "~> 2.10"},
  74. {:calendar, "~> 0.17.4"},
  75. {:cachex, "~> 3.0.2"},
  76. {:httpoison, "~> 1.2.0"},
  77. {:poison, "~> 3.0", override: true},
  78. {:tesla, "~> 1.2"},
  79. {:jason, "~> 1.0"},
  80. {:mogrify, "~> 0.6.1"},
  81. {:ex_aws, "~> 2.0"},
  82. {:ex_aws_s3, "~> 2.0"},
  83. {:earmark, "~> 1.3"},
  84. {:bbcode, "~> 0.1"},
  85. {:ex_machina, "~> 2.3", only: :test},
  86. {:credo, "~> 0.9.3", only: [:dev, :test]},
  87. {:mock, "~> 0.3.3", only: :test},
  88. {:crypt,
  89. git: "https://github.com/msantos/crypt", ref: "1f2b58927ab57e72910191a7ebaeff984382a1d3"},
  90. {:cors_plug, "~> 1.5"},
  91. {:ex_doc, "~> 0.20.2", only: :dev, runtime: false},
  92. {:web_push_encryption, "~> 0.2.1"},
  93. {:swoosh, "~> 0.20"},
  94. {:gen_smtp, "~> 0.13"},
  95. {:websocket_client, git: "https://github.com/jeremyong/websocket_client.git", only: :test},
  96. {:floki, "~> 0.20.0"},
  97. {:ex_syslogger, github: "slashmili/ex_syslogger", tag: "1.4.0"},
  98. {:timex, "~> 3.5"},
  99. {:ueberauth, "~> 0.4"},
  100. {:auto_linker,
  101. git: "https://git.pleroma.social/pleroma/auto_linker.git",
  102. ref: "c00c4e75b35367fa42c95ffd9b8c455bf9995829"},
  103. {:http_signatures,
  104. git: "https://git.pleroma.social/pleroma/http_signatures.git",
  105. ref: "9789401987096ead65646b52b5a2ca6bf52fc531"},
  106. {:pleroma_job_queue, "~> 0.2.0"},
  107. {:telemetry, "~> 0.3"},
  108. {:prometheus_ex, "~> 3.0"},
  109. {:prometheus_plugs, "~> 1.1"},
  110. {:prometheus_phoenix, "~> 1.2"},
  111. {:prometheus_ecto, "~> 1.4"},
  112. {:prometheus_process_collector, "~> 1.4"},
  113. {:recon, github: "ferd/recon", tag: "2.4.0"},
  114. {:quack, "~> 0.1.1"},
  115. {:benchee, "~> 1.0"},
  116. {:esshd, "~> 0.1.0"},
  117. {:ex_rated, "~> 1.2"},
  118. {:plug_static_index_html, "~> 1.0.0"},
  119. {:excoveralls, "~> 0.11.1", only: :test}
  120. ] ++ oauth_deps
  121. end
  122. # Aliases are shortcuts or tasks specific to the current project.
  123. # For example, to create, migrate and run the seeds file at once:
  124. #
  125. # $ mix ecto.setup
  126. #
  127. # See the documentation for `Mix` for more info on aliases.
  128. defp aliases do
  129. [
  130. "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
  131. "ecto.reset": ["ecto.drop", "ecto.setup"],
  132. test: ["ecto.create --quiet", "ecto.migrate", "test"]
  133. ]
  134. end
  135. # Builds a version string made of:
  136. # * the application version
  137. # * a pre-release if ahead of the tag: the describe string (-count-commithash)
  138. # * build info:
  139. # * a build name if `PLEROMA_BUILD_NAME` or `:pleroma, :build_name` is defined
  140. # * the mix environment if different than prod
  141. defp version(version) do
  142. {git_tag, git_pre_release} =
  143. with {tag, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=0"]),
  144. tag = String.trim(tag),
  145. {describe, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=8"]),
  146. describe = String.trim(describe),
  147. ahead <- String.replace(describe, tag, "") do
  148. {String.replace_prefix(tag, "v", ""), if(ahead != "", do: String.trim(ahead))}
  149. else
  150. _ -> {nil, nil}
  151. end
  152. if git_tag && version != git_tag do
  153. Mix.shell().error(
  154. "Application version #{inspect(version)} does not match git tag #{inspect(git_tag)}"
  155. )
  156. end
  157. build_name =
  158. cond do
  159. name = Application.get_env(:pleroma, :build_name) -> name
  160. name = System.get_env("PLEROMA_BUILD_NAME") -> name
  161. true -> nil
  162. end
  163. env_name = if Mix.env() != :prod, do: to_string(Mix.env())
  164. build =
  165. [build_name, env_name]
  166. |> Enum.filter(fn string -> string && string != "" end)
  167. |> Enum.join("-")
  168. |> (fn
  169. "" -> nil
  170. string -> "+" <> string
  171. end).()
  172. [version, git_pre_release, build]
  173. |> Enum.filter(fn string -> string && string != "" end)
  174. |> Enum.join()
  175. end
  176. end