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.

181 lines
5.9KB

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