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.
 
 
 
 
 
 

493 lines
16 KiB

  1. defmodule Mobilizon.Mixfile do
  2. use Mix.Project
  3. @version "1.3.2"
  4. def project do
  5. [
  6. app: :mobilizon,
  7. version: @version,
  8. elixir: "~> 1.12",
  9. elixirc_paths: elixirc_paths(Mix.env()),
  10. compilers: [:gettext] ++ Mix.compilers(),
  11. xref: [exclude: [:eldap]],
  12. start_permanent: Mix.env() == :prod,
  13. aliases: aliases(),
  14. deps: deps(),
  15. test_coverage: [tool: ExCoveralls],
  16. dialyzer: [plt_add_apps: [:mix]],
  17. preferred_cli_env: [
  18. coveralls: :test,
  19. "coveralls.detail": :test,
  20. "coveralls.post": :test,
  21. "coveralls.html": :test,
  22. vcr: :test,
  23. "vcr.delete": :test,
  24. "vcr.check": :test,
  25. "vcr.show": :test
  26. ],
  27. name: "Mobilizon",
  28. source_url: "https://framagit.org/framasoft/mobilizon",
  29. homepage_url: "https://joinmobilizon.org",
  30. docs: docs(),
  31. releases: [
  32. mobilizon: [
  33. include_executables_for: [:unix],
  34. applications: [eldap: :transient],
  35. config_providers: [{Mobilizon.ConfigProvider, "/etc/mobilizon/config.exs"}],
  36. steps: [:assemble, &copy_files/1, &copy_config/1]
  37. ]
  38. ],
  39. unused: [
  40. ignore: [
  41. Mobilizon.Storage.Repo,
  42. Mobilizon.Storage.PostgresTypes,
  43. Mobilizon.Factory,
  44. Mobilizon.Web.Router.Helpers,
  45. Mobilizon.Web.Email.Mailer,
  46. Mobilizon.Web.Auth.Guardian.Plug,
  47. Mobilizon.Web.Gettext,
  48. Mobilizon.Web.Endpoint,
  49. Mobilizon.Web.Auth.Guardian,
  50. Mobilizon.Web,
  51. Mobilizon.GraphQL.Schema.Compiled,
  52. Mobilizon.GraphQL.Schema,
  53. Mobilizon.Web.Router,
  54. Mobilizon.Users.Setting.Location,
  55. {:_, :start_link, 1},
  56. {:_, :child_spec, 1},
  57. {:_, :__impl__, 1},
  58. {:_, :__schema__, :_},
  59. {:_, :__struct__, 0..1},
  60. {:_, :__changeset__, 0},
  61. {:_, :create_type, 0},
  62. {:_, :drop_type, 0},
  63. {:_, :schema, 0},
  64. {:_, :schemaless_type, 0},
  65. {:_, :valid_value?, 0..1},
  66. {:_, :__enum_map__, 0},
  67. {:_, :__absinthe_blueprint__, :_},
  68. {:_, :__absinthe_function__, :_},
  69. {~r/^Mobilizon.Web.*Controller/, :_, 2},
  70. {~r/^Mobilizon.Web.*View/, :_, :_},
  71. {~r/^Mobilizon.Web.Email.*/, :render, 3},
  72. {~r/^Mobilizon.Service.HTTP.*Client/, :_, :_},
  73. {~r/^Mobilizon.Cldr.*/, :_, :_},
  74. {Mobilizon.Web.GraphQLSocket, :__channel__, 1}
  75. ]
  76. ]
  77. ]
  78. end
  79. # Configuration for the OTP application.
  80. #
  81. # Type `mix help compile.app` for more information.
  82. def application do
  83. [
  84. mod: {Mobilizon, []},
  85. extra_applications: [:logger, :runtime_tools, :guardian, :bamboo, :geolix, :crypto, :cachex]
  86. ]
  87. end
  88. def copy_files(%{path: target_path} = release) do
  89. File.cp_r!("./rel/overlays", target_path)
  90. release
  91. end
  92. def copy_config(%{path: target_path} = release) do
  93. support_path = Path.join([target_path, "support"])
  94. File.mkdir!(support_path)
  95. File.cp_r!(
  96. "./support",
  97. support_path
  98. )
  99. release
  100. end
  101. # Specifies which paths to compile per environment.
  102. defp elixirc_paths(:test), do: ["lib", "test/support"]
  103. defp elixirc_paths(:dev), do: ["lib", "test/support/factory.ex"]
  104. defp elixirc_paths(_), do: ["lib"]
  105. # Specifies OAuth dependencies.
  106. defp oauth_deps do
  107. oauth_strategy_packages =
  108. System.get_env("OAUTH_CONSUMER_STRATEGIES")
  109. |> to_string()
  110. |> String.split()
  111. |> Enum.map(fn strategy_entry ->
  112. with [_strategy, dependency] <- String.split(strategy_entry, ":") do
  113. dependency
  114. else
  115. [strategy] -> "ueberauth_#{strategy}"
  116. end
  117. end)
  118. for s <- oauth_strategy_packages, do: {String.to_atom(s), ">= 0.0.0"}
  119. end
  120. # Specifies your project dependencies.
  121. #
  122. # Type `mix help deps` for examples and options.
  123. defp deps do
  124. [
  125. {:phoenix, "~> 1.6.0"},
  126. {:phoenix_pubsub, "~> 2.0"},
  127. {:phoenix_ecto, "~> 4.0"},
  128. {:postgrex, ">= 0.15.3"},
  129. {:phoenix_html, "~> 3.0"},
  130. {:phoenix_live_view, "~> 0.17.1"},
  131. {:gettext, "~> 0.11"},
  132. {:cowboy, "~> 2.6"},
  133. {:guardian, "~> 2.0"},
  134. {:guardian_db, "~> 2.1.0"},
  135. {:guardian_phoenix, "~> 2.0"},
  136. {:argon2_elixir, "~> 2.0"},
  137. {:cors_plug, "~> 2.0"},
  138. {:ecto_autoslug_field, "~> 3.0"},
  139. {:geo, "~> 3.0"},
  140. {:geo_postgis, "~> 3.1"},
  141. {:timex, "~> 3.0"},
  142. {:icalendar, github: "tcitworld/icalendar"},
  143. {:exgravatar, "~> 2.0.1"},
  144. # {:json_ld, "~> 0.3"},
  145. {:jason, "~> 1.2"},
  146. {:ecto_enum, "~> 1.4"},
  147. {:ex_ical, "~> 0.2"},
  148. {:bamboo, "~> 2.1"},
  149. {:bamboo_phoenix, "~> 1.0"},
  150. {:bamboo_smtp, "~> 4.0"},
  151. {:geolix, "~> 2.0"},
  152. {:geolix_adapter_mmdb2, "~> 0.6.0"},
  153. {:absinthe, "~> 1.6"},
  154. {:absinthe_phoenix, "~> 2.0.1"},
  155. {:absinthe_plug, "~> 1.5.0"},
  156. {:dataloader, "~> 1.0.6"},
  157. {:plug_cowboy, "~> 2.0"},
  158. {:atomex, "~> 0.4"},
  159. {:cachex, "~> 3.1"},
  160. {:geohax, "~> 0.4.0"},
  161. {:mogrify, "~> 0.9"},
  162. {:linkify, "~> 0.3"},
  163. {:http_signatures, "~> 0.1.0"},
  164. {:ex_cldr, "~> 2.0"},
  165. {:ex_cldr_dates_times, "~> 2.2"},
  166. {:ex_optimizer, "~> 0.1"},
  167. {:progress_bar, "~> 2.0"},
  168. {:oban, "~> 2.2"},
  169. {:floki, "~> 0.31"},
  170. {:ip_reserved, "~> 0.1.0"},
  171. {:fast_sanitize, "~> 0.1"},
  172. {:ueberauth, "~> 0.6"},
  173. {:ueberauth_twitter, "~> 0.4"},
  174. {:ueberauth_github, "~> 0.7"},
  175. {:ueberauth_facebook, "~> 0.8"},
  176. {:ueberauth_discord, "~> 0.5"},
  177. {:ueberauth_google, "~> 0.10"},
  178. {:ueberauth_keycloak_strategy,
  179. git: "https://github.com/tcitworld/ueberauth_keycloak.git", branch: "upgrade-deps"},
  180. {:ueberauth_gitlab_strategy,
  181. git: "https://github.com/tcitworld/ueberauth_gitlab.git", branch: "upgrade-deps"},
  182. {:ecto_shortuuid, "~> 0.1"},
  183. {:tesla, "~> 1.4.0"},
  184. {:sitemapper, "~> 0.6"},
  185. {:xml_builder, "~> 2.2"},
  186. {:remote_ip, "~> 1.0.0"},
  187. {:ex_cldr_languages, "~> 0.3.0"},
  188. {:slugger, "~> 0.3"},
  189. {:sentry, "~> 8.0"},
  190. {:html_entities, "~> 0.5"},
  191. {:sweet_xml, "~> 0.7"},
  192. {:web_push_encryption, "~> 0.3"},
  193. {:eblurhash, "~> 1.2.0"},
  194. {:struct_access, "~> 1.1.2"},
  195. {:paasaa, "~> 0.5.0"},
  196. {:nimble_csv, "~> 1.1"},
  197. {:export, "~> 0.1.0"},
  198. {:tz_world, "~> 1.0"},
  199. {:tzdata, "~> 1.1"},
  200. # Dev and test dependencies
  201. {:phoenix_live_reload, "~> 1.2", only: [:dev, :e2e]},
  202. {:ex_machina, "~> 2.3", only: [:dev, :test]},
  203. {:excoveralls, "~> 0.14.0", only: :test},
  204. {:ex_doc, "~> 0.25", only: [:dev, :test], runtime: false},
  205. {:mix_test_watch, "~> 1.0", only: :dev, runtime: false},
  206. {:ex_unit_notifier, "~> 1.0", only: :test},
  207. {:dialyxir, "~> 1.1", only: [:dev], runtime: false},
  208. {:exvcr, "~> 0.12", only: :test},
  209. {:credo, "~> 1.5", only: [:dev, :test], runtime: false},
  210. {:mock, "~> 0.3.4", only: :test},
  211. {:elixir_feed_parser, "~> 2.1.0", only: :test},
  212. {:mox, "~> 1.0", only: :test},
  213. {:junit_formatter, "~> 3.1", only: [:test]},
  214. {:sobelow, "~> 0.8", only: [:dev, :test]},
  215. {:doctor, "~> 0.18.0", only: :dev}
  216. ] ++ oauth_deps()
  217. end
  218. # Aliases are shortcuts or tasks specific to the current project.
  219. # For example, to create, migrate and run the seeds file at once:
  220. #
  221. # $ mix ecto.setup
  222. #
  223. # See the documentation for `Mix` for more info on aliases.
  224. defp aliases do
  225. [
  226. "ecto.setup": [
  227. "ecto.create",
  228. "ecto.migrate",
  229. "run priv/repo/seeds.exs"
  230. ],
  231. "ecto.reset": [
  232. "ecto.drop",
  233. "ecto.setup"
  234. ],
  235. test: [
  236. "ecto.create",
  237. "ecto.migrate",
  238. "tz_world.update",
  239. &run_test/1
  240. ],
  241. "phx.deps_migrate_serve": [
  242. "deps.get",
  243. "ecto.create --quiet",
  244. "ecto.migrate",
  245. "cmd cd js && yarn install && cd ../",
  246. "phx.server"
  247. ]
  248. ]
  249. end
  250. defp run_test(args) do
  251. Mix.Task.run("test", args)
  252. File.rm_rf!("test/uploads")
  253. end
  254. defp docs() do
  255. [
  256. source_ref: "v#{@version}",
  257. groups_for_modules: groups_for_modules(),
  258. nest_modules_by_prefix: [
  259. Mobilizon,
  260. Mobilizon.Web,
  261. Mobilizon.Service.Geospatial,
  262. Mobilizon.Web.Resolvers,
  263. Mobilizon.GraphQL.Schema,
  264. Mobilizon.Service
  265. ]
  266. ]
  267. end
  268. defp groups_for_modules() do
  269. [
  270. Models: [
  271. Mobilizon.Actors,
  272. Mobilizon.Actors.Actor,
  273. Mobilizon.Actors.ActorOpenness,
  274. Mobilizon.Actors.ActorType,
  275. Mobilizon.Actors.MemberRole,
  276. Mobilizon.Actors.Bot,
  277. Mobilizon.Actors.Follower,
  278. Mobilizon.Actors.Member,
  279. Mobilizon.Addresses,
  280. Mobilizon.Addresses.Address,
  281. Mobilizon.Admin,
  282. Mobilizon.Admin.ActionLog,
  283. Mobilizon.Events,
  284. Mobilizon.Events.Event,
  285. Mobilizon.Events.FeedToken,
  286. Mobilizon.Events.Participant,
  287. Mobilizon.Events.Session,
  288. Mobilizon.Events.Tag,
  289. Mobilizon.Events.TagRelations,
  290. Mobilizon.Events.Track,
  291. Mobilizon.Events.EventCategory,
  292. Mobilizon.Events.EventStatus,
  293. Mobilizon.Events.EventVisibility,
  294. Mobilizon.Events.JoinOptions,
  295. Mobilizon.Events.ParticipantRole,
  296. Mobilizon.Events.Tag.TitleSlug,
  297. Mobilizon.Events.Tag.TitleSlug.Type,
  298. Mobilizon.Events.TagRelation,
  299. Mobilizon.Medias,
  300. Mobilizon.Medias.File,
  301. Mobilizon.Medias.Media,
  302. Mobilizon.Mention,
  303. Mobilizon.Reports,
  304. Mobilizon.Reports.Note,
  305. Mobilizon.Reports.Report,
  306. Mobilizon.Share,
  307. Mobilizon.Tombstone,
  308. Mobilizon.Users,
  309. Mobilizon.Users.User,
  310. Mobilizon.Users.UserRole,
  311. Mobilizon.Federation.ActivityPub.Activity
  312. ],
  313. APIs: [
  314. Mobilizon.GraphQL.API.Comments,
  315. Mobilizon.GraphQL.API.Events,
  316. Mobilizon.GraphQL.API.Follows,
  317. Mobilizon.GraphQL.API.Groups,
  318. Mobilizon.GraphQL.API.Participations,
  319. Mobilizon.GraphQL.API.Reports,
  320. Mobilizon.GraphQL.API.Search,
  321. Mobilizon.GraphQL.API.Utils
  322. ],
  323. Web: [
  324. Mobilizon.Web,
  325. Mobilizon.Web.Endpoint,
  326. Mobilizon.Web.Router,
  327. Mobilizon.Web.Router.Helpers,
  328. Mobilizon.Web.Plugs.UploadedMedia,
  329. Mobilizon.Web.FallbackController,
  330. Mobilizon.Web.FeedController,
  331. Mobilizon.Web.PageController,
  332. Mobilizon.Web.ChangesetView,
  333. Mobilizon.Web.JsonLD.ObjectView,
  334. Mobilizon.Web.EmailView,
  335. Mobilizon.Web.ErrorView,
  336. Mobilizon.Web.LayoutView,
  337. Mobilizon.Web.PageView,
  338. Mobilizon.Web.Auth.Context,
  339. Mobilizon.Web.Auth.ErrorHandler,
  340. Mobilizon.Web.Auth.Guardian,
  341. Mobilizon.Web.Auth.Pipeline,
  342. Mobilizon.Web.Cache,
  343. Mobilizon.Web.Cache.ActivityPub,
  344. Mobilizon.Web.Email,
  345. Mobilizon.Web.Email.Admin,
  346. Mobilizon.Web.Email.Checker,
  347. Mobilizon.Web.Email.Event,
  348. Mobilizon.Web.Email.Mailer,
  349. Mobilizon.Web.Email.Participation,
  350. Mobilizon.Web.Email.User,
  351. Mobilizon.Web.Upload,
  352. Mobilizon.Web.Upload.Filter,
  353. Mobilizon.Web.Upload.Filter.AnonymizeFilename,
  354. Mobilizon.Web.Upload.Filter.Dedupe,
  355. Mobilizon.Web.Upload.Filter.Mogrify,
  356. Mobilizon.Web.Upload.Filter.Optimize,
  357. Mobilizon.Web.Upload.MIME,
  358. Mobilizon.Web.Upload.Uploader,
  359. Mobilizon.Web.Upload.Uploader.Local,
  360. Mobilizon.Web.ReverseProxy
  361. ],
  362. Geospatial: [
  363. Mobilizon.Service.Geospatial,
  364. Mobilizon.Service.Geospatial.Addok,
  365. Mobilizon.Service.Geospatial.GoogleMaps,
  366. Mobilizon.Service.Geospatial.MapQuest,
  367. Mobilizon.Service.Geospatial.Mimirsbrunn,
  368. Mobilizon.Service.Geospatial.Nominatim,
  369. Mobilizon.Service.Geospatial.Pelias,
  370. Mobilizon.Service.Geospatial.Photon,
  371. Mobilizon.Service.Geospatial.Provider
  372. ],
  373. Localization: [
  374. Mobilizon.Cldr,
  375. Mobilizon.Web.Gettext
  376. ],
  377. GraphQL: [
  378. Mobilizon.Web.GraphQLSocket,
  379. Mobilizon.GraphQL.Resolvers.Address,
  380. Mobilizon.GraphQL.Resolvers.Admin,
  381. Mobilizon.GraphQL.Resolvers.Comment,
  382. Mobilizon.GraphQL.Resolvers.Config,
  383. Mobilizon.GraphQL.Resolvers.Event,
  384. Mobilizon.GraphQL.Resolvers.FeedToken,
  385. Mobilizon.GraphQL.Resolvers.Group,
  386. Mobilizon.GraphQL.Resolvers.Member,
  387. Mobilizon.GraphQL.Resolvers.Person,
  388. Mobilizon.GraphQL.Resolvers.Media,
  389. Mobilizon.GraphQL.Resolvers.Report,
  390. Mobilizon.GraphQL.Resolvers.Search,
  391. Mobilizon.GraphQL.Resolvers.Tag,
  392. Mobilizon.GraphQL.Resolvers.User,
  393. Mobilizon.GraphQL.Schema,
  394. Mobilizon.GraphQL.Schema.ActorInterface,
  395. Mobilizon.GraphQL.Schema.Actors.ApplicationType,
  396. Mobilizon.GraphQL.Schema.Actors.FollowerType,
  397. Mobilizon.GraphQL.Schema.Actors.GroupType,
  398. Mobilizon.GraphQL.Schema.Actors.MemberType,
  399. Mobilizon.GraphQL.Schema.Actors.PersonType,
  400. Mobilizon.GraphQL.Schema.AddressType,
  401. Mobilizon.GraphQL.Schema.AdminType,
  402. Mobilizon.GraphQL.Schema.Discussions.CommentType,
  403. Mobilizon.GraphQL.Schema.ConfigType,
  404. Mobilizon.GraphQL.Schema.EventType,
  405. Mobilizon.GraphQL.Schema.Events.FeedTokenType,
  406. Mobilizon.GraphQL.Schema.Events.ParticipantType,
  407. Mobilizon.GraphQL.Schema.MediaType,
  408. Mobilizon.GraphQL.Schema.ReportType,
  409. Mobilizon.GraphQL.Schema.SearchType,
  410. Mobilizon.GraphQL.Schema.SortType,
  411. Mobilizon.GraphQL.Schema.TagType,
  412. Mobilizon.GraphQL.Schema.UserType,
  413. Mobilizon.GraphQL.Schema.Utils,
  414. Mobilizon.GraphQL.Schema.Custom.Point,
  415. Mobilizon.GraphQL.Schema.Custom.UUID
  416. ],
  417. ActivityPub: [
  418. Mobilizon.Federation.ActivityPub,
  419. Mobilizon.Federation.ActivityPub.Audience,
  420. Mobilizon.Federation.ActivityPub.Federator,
  421. Mobilizon.Federation.ActivityPub.Relay,
  422. Mobilizon.Federation.ActivityPub.Transmogrifier,
  423. Mobilizon.Federation.ActivityPub.Visibility,
  424. Mobilizon.Federation.ActivityPub.Utils,
  425. Mobilizon.Federation.ActivityStream.Convertible,
  426. Mobilizon.Federation.ActivityStream.Converter,
  427. Mobilizon.Federation.ActivityStream.Converter.Actor,
  428. Mobilizon.Federation.ActivityStream.Converter.Address,
  429. Mobilizon.Federation.ActivityStream.Converter.Comment,
  430. Mobilizon.Federation.ActivityStream.Converter.Event,
  431. Mobilizon.Federation.ActivityStream.Converter.Flag,
  432. Mobilizon.Federation.ActivityStream.Converter.Follower,
  433. Mobilizon.Federation.ActivityStream.Converter.Participant,
  434. Mobilizon.Federation.ActivityStream.Converter.Media,
  435. Mobilizon.Federation.ActivityStream.Converter.Tombstone,
  436. Mobilizon.Federation.ActivityStream.Converter.Utils,
  437. Mobilizon.Federation.HTTPSignatures.Signature,
  438. Mobilizon.Federation.WebFinger,
  439. Mobilizon.Federation.WebFinger.XmlBuilder,
  440. Mobilizon.Web.Plugs.Federating,
  441. Mobilizon.Web.Plugs.HTTPSignatures,
  442. Mobilizon.Web.Plugs.MappedSignatureToIdentity,
  443. Mobilizon.Web.ActivityPubController,
  444. Mobilizon.Web.NodeInfoController,
  445. Mobilizon.Web.WebFingerController,
  446. Mobilizon.Web.ActivityPub.ActorView,
  447. Mobilizon.Web.ActivityPub.ObjectView
  448. ],
  449. Services: [
  450. Mobilizon.Service.Export.Feed,
  451. Mobilizon.Service.Export.ICalendar,
  452. Mobilizon.Service.Formatter,
  453. Mobilizon.Service.Formatter.HTML,
  454. Mobilizon.Service.Formatter.DefaultScrubbler,
  455. Mobilizon.Service.Metadata,
  456. Mobilizon.Service.Metadata.Actor,
  457. Mobilizon.Service.Metadata.Comment,
  458. Mobilizon.Service.Metadata.Event,
  459. Mobilizon.Service.Metadata.Instance,
  460. Mobilizon.Service.Metadata.Utils,
  461. Mobilizon.Service.Statistics,
  462. Mobilizon.Service.Workers.Background,
  463. Mobilizon.Service.Workers.BuildSearch,
  464. Mobilizon.Service.Workers.Helper
  465. ],
  466. Tools: [
  467. Mobilizon.Application,
  468. Mobilizon.Config,
  469. Mobilizon.Crypto,
  470. Mobilizon.Factory,
  471. Mobilizon.Storage.Ecto,
  472. Mobilizon.Storage.Page,
  473. Mobilizon.Storage.Repo
  474. ]
  475. ]
  476. end
  477. end