defmodule LZMA.MixProject do use Mix.Project @version "0.1.0" @source_url "https://github.com/ImNotAVirus/lzma_ex" @dev? String.ends_with?(@version, "-dev") @force_build? System.get_env("LZMA_EX_BUILD") in ["1", "true"] def project() do [ app: :lzma, version: @version, elixir: "~> 1.15", deps: deps(), aliases: aliases(), package: package(), elixirc_options: [warnings_as_errors: true], preferred_cli_env: [ci: :test, "ci.check": :test], # Docs name: "LZMA", description: "LZMA compression library for Elixir via Rust NIF", docs: docs() ] end def application() do [ extra_applications: [:logger] ] end def aliases() do [ "rust.lint": ["cmd cargo clippy --manifest-path=native/lzma/Cargo.toml"], "rust.build": ["cmd cargo build --manifest-path=native/lzma/Cargo.toml"], "rust.clean": ["cmd cargo clean --manifest-path=native/lzma/Cargo.toml"], "rust.test": ["cmd cargo test --manifest-path=native/lzma/Cargo.toml"], "rust.fmt": ["cmd cargo fmt --manifest-path=native/lzma/Cargo.toml"], ci: ["format", "credo", "rust.fmt", "rust.lint", "test"], "ci.check": [ "format --check-formatted", "credo", "cmd cargo fmt --manifest-path=native/lzma/Cargo.toml --all -- --check", "cmd cargo clippy --manifest-path=native/lzma/Cargo.toml -- -Dwarnings", "compile --warnings-as-errors", "test" ] ] end defp deps() do [ {:rustler, "~> 0.37.0", optional: not (@dev? or @force_build?)}, {:rustler_precompiled, "~> 0.8"}, ## Dev {:ex_doc, "~> 0.39", only: :dev, runtime: false, warn_if_outdated: true}, {:credo, "~> 1.7", only: [:dev, :test], runtime: false} ] end defp package() do [ files: [ "lib", "native", "checksum-*.exs", "mix.exs", "CHANGELOG.md", "README.md", "LICENSE" ], licenses: ["MIT"], links: %{ "GitHub" => @source_url, "Changelog" => "#{@source_url}/blob/v#{@version}/CHANGELOG.md" }, maintainers: ["DarkyZ aka NotAVirus"] ] end defp docs() do [ main: "LZMA", source_ref: "v#{@version}", source_url: @source_url, extras: ["README.md", "CHANGELOG.md"], skip_undefined_reference_warnings_on: ["CHANGELOG.md"] ] end end