Current section

Files

Jump to
macaw_data mix.exs
Raw

mix.exs

defmodule Macaw.Data.MixProject do
  use Mix.Project

  @source_url "https://github.com/dcoai/macaw_data"
  @version "0.21.1"

  def project do
    [
      app: :macaw_data,
      version: @version,
      elixir: "~> 1.18",
      elixirc_paths: elixirc_paths(Mix.env()),
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      # A publish has every vendored family script the reference's current one (#165), and
      # is of the clean, pushed release tag (the family's guard, #162; spec/00 §3).
      aliases: [
        "hex.publish": [
          "cmd elixir ci/vendored.exs --reference",
          "cmd elixir ci/release_guard.exs #{@version}",
          "hex.publish"
        ]
      ],
      description:
        "Macaw's data layer: the interaction event, the data model, the source contract, derived sources, and the transforms and aggregates they share with designs.",
      source_url: @source_url,
      package: package(),
      docs: [
        main: "readme",
        extras: ["README.md", "CHANGELOG.md"],
        source_ref: "v#{@version}",
        logo: "brand/logo/macaw_scarlet.svg",
        assets: %{"brand/logo" => "brand/logo"}
      ]
    ]
  end

  # The application decides once, at start, whether the native kernels loaded (spec/04 §1.7).
  def application, do: [mod: {Macaw.Data.Application, []}, extra_applications: [:logger]]

  # `test/support` holds the tests' helpers, compiled in test only.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

  # Published on Hex from its public home, mirrored from GitLab (dco-tek/macaw/macaw#155).
  defp package do
    [
      licenses: ["MIT"],
      links: %{
        "GitHub" => @source_url,
        "Changelog" => "https://hexdocs.pm/macaw_data/changelog.html"
      },
      # The kernels' crate travels with the package, its sources, manifest, lockfile and build
      # script, so an adopter with a cargo builds the kernels from source (spec/04 §1.7,
      # macaw_data#482); never its `target/`, which a lint or test run in the crate writes.
      # ci/adopter_boot.exs refuses a package holding one.
      files:
        ~w(lib spec mix.exs README.md LICENSE CHANGELOG.md .formatter.exs) ++
          ~w(native/macaw_data_kernels/src native/macaw_data_kernels/Cargo.toml) ++
          ~w(native/macaw_data_kernels/Cargo.lock native/macaw_data_kernels/build.rs)
    ]
  end

  defp deps do
    [
      # What every Macaw package shares (spec/00 §1): names, faults and their formatter, the
      # canonical encoding and digest that is a schema's version, and the optional-callback
      # check. From Hex since the family's release (dco-tek/macaw/macaw#478 step 9, #487).
      {:macaw_base, "~> 0.1.1"},
      # Units as meaning (spec/03): UCUM codes, the currency extension, conversion and the
      # fixed list of quantities, which schemas check and combined sources convert by; it
      # brings ucum. From Hex since the family's release, on the same macaw_base. macaw_format
      # (presentation) is no dependency: nothing here formats.
      {:macaw_units, "~> 0.1.0"},
      # Optional readers at the table's edge (spec/01 §1.1): a host that has either gets
      # its tensors or `Table.Reader` sources read into a table; one that has neither never
      # fetches them.
      {:table, "~> 0.1.2", optional: true},
      {:nx, "~> 1.0", optional: true},
      # The optional native kernels (spec/04 §1.7), Rust built through Rustler at compile
      # time when a cargo is present whose rustc is at least the crate's rust-version; a build
      # tool only, nothing of it runs. Optional, so an adopter opts in by listing it, and an
      # adopter without it, or without a cargo, runs every step's Elixir path.
      {:rustler, "~> 0.38.0", runtime: false, optional: true},
      # `Macaw.Data.Source.Telemetry` (spec/01 §10.3) attaches to `:telemetry`, optional
      # like nx (which requires it): without it the module compiles and its collector
      # answers `{:error, :no_telemetry}`. `telemetry_metrics` is the tests' real
      # definitions only; the source reads a definition by its fields.
      {:telemetry, "~> 1.0", optional: true},
      {:telemetry_metrics, "~> 1.0", only: :test},
      {:stream_data, "~> 1.1", only: :test},
      # Docs for Hex (macaw_compose#155), dev and test only.
      {:ex_doc, "~> 0.34", only: [:dev, :test], runtime: false},
      # Spec, tests and code kept aligned (macaw_compose spec/00 §4.1); dev/test only.
      {:surfex, "~> 0.13.0", only: [:dev, :test], runtime: false}
    ]
  end
end