Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

212 lignes
6.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. 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. releases: [
  35. pleroma: [
  36. include_executables_for: [:unix],
  37. applications: [ex_syslogger: :load, syslog: :load],
  38. steps: [:assemble, &copy_pleroma_ctl/1]
  39. ]
  40. ]
  41. ]
  42. end
  43. def copy_pleroma_ctl(%{path: target_path} = release) do
  44. File.cp!("./rel/pleroma_ctl", Path.join([target_path, "bin", "pleroma_ctl"]))
  45. release
  46. end
  47. # Configuration for the OTP application.
  48. #
  49. # Type `mix help compile.app` for more information.
  50. def application do
  51. [
  52. mod: {Pleroma.Application, []},
  53. extra_applications: [:logger, :runtime_tools, :comeonin, :quack],
  54. included_applications: [:ex_syslogger]
  55. ]
  56. end
  57. # Specifies which paths to compile per environment.
  58. defp elixirc_paths(:test), do: ["lib", "test/support"]
  59. defp elixirc_paths(_), do: ["lib"]
  60. # Specifies OAuth dependencies.
  61. defp oauth_deps do
  62. oauth_strategy_packages =
  63. System.get_env("OAUTH_CONSUMER_STRATEGIES")
  64. |> to_string()
  65. |> String.split()
  66. |> Enum.map(fn strategy_entry ->
  67. with [_strategy, dependency] <- String.split(strategy_entry, ":") do
  68. dependency
  69. else
  70. [strategy] -> "ueberauth_#{strategy}"
  71. end
  72. end)
  73. for s <- oauth_strategy_packages, do: {String.to_atom(s), ">= 0.0.0"}
  74. end
  75. # Specifies your project dependencies.
  76. #
  77. # Type `mix help deps` for examples and options.
  78. defp deps do
  79. [
  80. {:phoenix, "~> 1.4.1"},
  81. {:plug_cowboy, "~> 2.0"},
  82. {:phoenix_pubsub, "~> 1.1"},
  83. {:phoenix_ecto, "~> 4.0"},
  84. {:ecto_sql, "~> 3.1"},
  85. {:postgrex, ">= 0.13.5"},
  86. {:gettext, "~> 0.15"},
  87. {:comeonin, "~> 4.1.1"},
  88. {:pbkdf2_elixir, "~> 0.12.3"},
  89. {:trailing_format_plug, "~> 0.0.7"},
  90. {:html_sanitize_ex, "~> 1.3.0"},
  91. {:html_entities, "~> 0.4"},
  92. {:phoenix_html, "~> 2.10"},
  93. {:calendar, "~> 0.17.4"},
  94. {:cachex, "~> 3.0.2"},
  95. {:httpoison, "~> 1.2.0"},
  96. {:poison, "~> 3.0", override: true},
  97. {:tesla, "~> 1.2"},
  98. {:jason, "~> 1.0"},
  99. {:mogrify, "~> 0.6.1"},
  100. {:ex_aws, "~> 2.0"},
  101. {:ex_aws_s3, "~> 2.0"},
  102. {:earmark, "~> 1.3"},
  103. {:bbcode, "~> 0.1"},
  104. {:ex_machina, "~> 2.3", only: :test},
  105. {:credo, "~> 0.9.3", only: [:dev, :test]},
  106. {:mock, "~> 0.3.3", only: :test},
  107. {:crypt,
  108. git: "https://github.com/msantos/crypt", ref: "1f2b58927ab57e72910191a7ebaeff984382a1d3"},
  109. {:cors_plug, "~> 1.5"},
  110. {:ex_doc, "~> 0.20.2", only: :dev, runtime: false},
  111. {:web_push_encryption, "~> 0.2.1"},
  112. {:swoosh, "~> 0.20"},
  113. {:gen_smtp, "~> 0.13"},
  114. {:websocket_client, git: "https://github.com/jeremyong/websocket_client.git", only: :test},
  115. {:floki, "~> 0.20.0"},
  116. {:ex_syslogger, github: "slashmili/ex_syslogger", tag: "1.4.0"},
  117. {:timex, "~> 3.5"},
  118. {:ueberauth, "~> 0.4"},
  119. {:auto_linker,
  120. git: "https://git.pleroma.social/pleroma/auto_linker.git",
  121. ref: "c00c4e75b35367fa42c95ffd9b8c455bf9995829"},
  122. {:http_signatures,
  123. git: "https://git.pleroma.social/pleroma/http_signatures.git",
  124. ref: "9789401987096ead65646b52b5a2ca6bf52fc531"},
  125. {:pleroma_job_queue, "~> 0.2.0"},
  126. {:telemetry, "~> 0.3"},
  127. {:prometheus_ex, "~> 3.0"},
  128. {:prometheus_plugs, "~> 1.1"},
  129. {:prometheus_phoenix, "~> 1.2"},
  130. {:prometheus_ecto, "~> 1.4"},
  131. {:prometheus_process_collector, "~> 1.4"},
  132. {:recon, github: "ferd/recon", tag: "2.4.0"},
  133. {:quack, "~> 0.1.1"},
  134. {:benchee, "~> 1.0"},
  135. {:esshd, "~> 0.1.0", runtime: Application.get_env(:esshd, :enabled, false)},
  136. {:ex_rated, "~> 1.2"},
  137. {:plug_static_index_html, "~> 1.0.0"},
  138. {:excoveralls, "~> 0.11.1", only: :test}
  139. ] ++ oauth_deps()
  140. end
  141. # Aliases are shortcuts or tasks specific to the current project.
  142. # For example, to create, migrate and run the seeds file at once:
  143. #
  144. # $ mix ecto.setup
  145. #
  146. # See the documentation for `Mix` for more info on aliases.
  147. defp aliases do
  148. [
  149. "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
  150. "ecto.reset": ["ecto.drop", "ecto.setup"],
  151. test: ["ecto.create --quiet", "ecto.migrate", "test"]
  152. ]
  153. end
  154. # Builds a version string made of:
  155. # * the application version
  156. # * a pre-release if ahead of the tag: the describe string (-count-commithash)
  157. # * build info:
  158. # * a build name if `PLEROMA_BUILD_NAME` or `:pleroma, :build_name` is defined
  159. # * the mix environment if different than prod
  160. defp version(version) do
  161. {git_tag, git_pre_release} =
  162. with {tag, 0} <-
  163. System.cmd("git", ["describe", "--tags", "--abbrev=0"], stderr_to_stdout: true),
  164. tag = String.trim(tag),
  165. {describe, 0} <- System.cmd("git", ["describe", "--tags", "--abbrev=8"]),
  166. describe = String.trim(describe),
  167. ahead <- String.replace(describe, tag, "") do
  168. {String.replace_prefix(tag, "v", ""), if(ahead != "", do: String.trim(ahead))}
  169. else
  170. _ -> {nil, nil}
  171. end
  172. if git_tag && version != git_tag do
  173. Mix.shell().error(
  174. "Application version #{inspect(version)} does not match git tag #{inspect(git_tag)}"
  175. )
  176. end
  177. build_name =
  178. cond do
  179. name = Application.get_env(:pleroma, :build_name) -> name
  180. name = System.get_env("PLEROMA_BUILD_NAME") -> name
  181. true -> nil
  182. end
  183. env_name = if Mix.env() != :prod, do: to_string(Mix.env())
  184. build =
  185. [build_name, env_name]
  186. |> Enum.filter(fn string -> string && string != "" end)
  187. |> Enum.join("-")
  188. |> (fn
  189. "" -> nil
  190. string -> "+" <> string
  191. end).()
  192. [version, git_pre_release, build]
  193. |> Enum.filter(fn string -> string && string != "" end)
  194. |> Enum.join()
  195. end
  196. end