defmodule ExAnydoc.MixProject do use Mix.Project @version "0.1.0" @source_url "https://github.com/franzinBr/ex_anydoc" @description "Elixir bindings for anydoc, a local document-to-Markdown converter" def project do [ app: :ex_anydoc, version: @version, elixir: "~> 1.15", start_permanent: Mix.env() == :prod, compilers: Mix.compilers() ++ [:cleanup_anydoc_artifact], deps: deps(), description: @description, package: package(), name: "ExAnydoc", source_url: @source_url, homepage_url: @source_url, docs: docs() ] end def application do [ extra_applications: [:logger] ] end defp deps do [ {:rustler, "~> 0.38.0", runtime: false}, {:ex_doc, "~> 0.40", only: :dev, runtime: false} ] end defp package do [ maintainers: ["Alan Franzin"], licenses: ["MIT"], links: %{ "Documentation" => "https://hexdocs.pm/ex_anydoc", "GitHub" => @source_url, "Firecrawl anydoc" => "https://github.com/firecrawl/anydoc" }, files: ~w(lib native Cargo.toml Cargo.lock mix.exs README.md CHANGELOG.md LICENSE guides) ] end defp docs do [ main: "readme", source_ref: "v#{@version}", canonical: "https://hexdocs.pm/ex_anydoc", extras: [ "README.md", "guides/getting-started.md", "guides/formats-and-conversion.md", "guides/document-model.md", "guides/errors-and-deployment.md", "CHANGELOG.md", "LICENSE" ], groups_for_extras: [ Guides: ~r{guides/.+\.md}, Project: ["CHANGELOG.md", "LICENSE"] ], groups_for_modules: [ "Public API": [ExAnydoc, ExAnydoc.Document] ] ] end end defmodule Mix.Tasks.Compile.CleanupAnydocArtifact do use Mix.Task.Compiler @recursive true @impl Mix.Task.Compiler def run(_args) do artifact = Path.join([Mix.Project.app_path(), "priv", "native", "pdf_inspector.so"]) case File.rm(artifact) do :ok -> {:ok, []} {:error, :enoent} -> {:noop, []} {:error, reason} -> {:error, [{artifact, "could not remove invalid artifact: #{reason}"}]} end end end