defmodule AshOpenFeed.MixProject do use Mix.Project @version "0.1.0" @source_url "https://github.com/benkolera/ash-openfeed" # oidcc's Erlang source uses triple-quoted strings, which do not compile on # OTP 26 or earlier — and mix.exs has no way to declare an OTP requirement. # Checking here turns a baffling dependency compile error into a clear message. if String.to_integer(System.otp_release()) < 27 do Mix.raise(""" ash_openfeed requires OTP 27 or later, but this is OTP #{System.otp_release()}. The constraint comes from oidcc, whose Erlang source does not compile on OTP 26. Elixir 1.17 and later are supported, on OTP 27 or later. """) end def project do [ app: :ash_openfeed, version: @version, elixir: "~> 1.17", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), aliases: aliases(), description: "Ash extension for OpenFeed (Australian CDR banking and energy data). " <> "Stores disclosure grants and their tokens on your own Ash resource.", package: package(), docs: docs(), name: "AshOpenFeed", source_url: @source_url ] end def application do [extra_applications: [:logger]] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] defp deps do [ {:ash, "~> 3.0"}, openfeed_dep(), # Optional so the library can be used without the installer. The Mix task # degrades to a message telling you to install igniter. {:igniter, "~> 0.7", optional: true}, {:jason, "~> 1.4"}, # Req.Test needs Plug. See openfeed/mix.exs for why Bypass is not used. {:plug, "~> 1.0", only: :test}, # Igniter.Test.phx_test_project/1 shells out to the Phoenix installer, so # the installer tests need it present. Easy to miss locally, where it is # usually installed globally — CI does not have it. {:phx_new, "~> 1.7", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.34", only: :dev, runtime: false}, {:simple_sat, "~> 0.1", only: [:dev, :test]} ] end # Hex refuses to publish a package with a path dependency, so this resolves # from Hex by default. Set OPENFEED_PATH to develop the two together — CI does, # so the monorepo is tested as a unit rather than against whatever is released. # # OPENFEED_PATH=../openfeed mix test defp openfeed_dep do case System.get_env("OPENFEED_PATH") do nil -> {:openfeed, "~> 0.1"} path -> {:openfeed, path: path, override: true} end end defp package do [ maintainers: ["Ben Kolera"], licenses: ["Apache-2.0"], links: %{ "GitHub" => @source_url, "Changelog" => @source_url <> "/blob/main/ash_openfeed/CHANGELOG.md", "openfeed" => "https://hex.pm/packages/openfeed" }, files: ~w(lib mix.exs README.md CHANGELOG.md LICENSE .formatter.exs) ] end defp aliases do [ docs: ["spark.cheat_sheets", "docs", "spark.replace_doc_links"], "spark.formatter": "spark.formatter --extensions AshOpenFeed.Grant", "spark.cheat_sheets": "spark.cheat_sheets --extensions AshOpenFeed.Grant" ] end defp docs do [ main: "readme", source_ref: "v#{@version}", extras: [ {"README.md", title: "Home"}, # Generated by the `docs` alias below (mix spark.cheat_sheets). Without # this, HexDocs carries no `openfeed do ... end` reference at all, which # for a Spark extension is the doc people actually need. # # Deliberately no `search_data:` — Spark.Docs.search_data_for/1 is not # loadable at project-config evaluation time, and it only improves search # indexing. "documentation/dsls/DSL-AshOpenFeed.Grant.md", "CHANGELOG.md" ], groups_for_modules: [ Extension: [AshOpenFeed.Grant, AshOpenFeed.Info], Runtime: [AshOpenFeed], Configuration: [AshOpenFeed.ConfigProvider], "Key management": [AshOpenFeed.KeyStore.Ash] ] ] end end