Packages

An Elixir SQLite engine with pinned Bedrock SQLite and native Luau procedures

Current section

Files

Jump to
Raw

mix.exs

defmodule SqliteEngine.MixProject do
use Mix.Project
@version "0.1.1"
def project do
[
app: :sqlite_engine,
version: @version,
elixir: "~> 1.20",
compilers: [:elixir_make] ++ Mix.compilers(),
make_targets: ["all"],
make_clean: ["clean"],
make_force_build: force_build?(),
make_precompiler: make_precompiler(),
make_precompiler_url:
"https://github.com/mindreframer/sqlite_engine/releases/download/v#{@version}/@{artefact_filename}",
make_precompiler_filename: "sqlite_engine_nif",
make_precompiler_nif_versions: make_precompiler_nif_versions(),
make_env: Application.get_env(:sqlite_engine, :make_env, %{}),
cc_precompiler: cc_precompiler(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
package: package(),
description: description(),
test_paths: test_paths(System.get_env("SQLITE_ENGINE_INTEGRATION")),
elixirc_paths: elixirc_paths(Mix.env()),
dialyzer: dialyzer(),
# Docs
name: "SqliteEngine",
source_url: "https://github.com/mindreframer/sqlite_engine",
homepage_url: "https://github.com/mindreframer/sqlite_engine",
docs: docs()
]
end
defp force_build? do
Application.get_env(:sqlite_engine, :force_build, false) or
System.get_env("SQLITE_ENGINE_FORCE_BUILD") in ["1", "true"]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger, :crypto]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:db_connection, "~> 2.1"},
{:ex_sqlean, "~> 0.8.5", only: [:dev, :test]},
{:elixir_make, "~> 0.8", runtime: false},
{:cc_precompiler, "~> 0.1", runtime: false},
{:ex_doc, "~> 0.27", only: :dev, runtime: false},
{:temp, "~> 0.4", only: [:dev, :test]},
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:table, "~> 0.1.0", optional: true}
]
end
defp aliases do
[
lint: ["format --check-formatted", "credo --all", "dialyzer"]
]
end
defp description do
"An Elixir SQLite engine with pinned Bedrock SQLite and native Luau procedures"
end
defp make_precompiler do
if System.get_env("SQLITE_ENGINE_USE_SYSTEM") != nil do
nil
else
{:nif, CCPrecompiler}
end
end
defp package do
[
files: ~w(
lib
.formatter.exs
mix.exs
README.md
CHANGELOG.md
LICENSE
NOTICE.md
guides
.clang-format
c_src
native
bin/build_luau.sh
bin/clean_native_deps.sh
bin/setup_bedrock_sqlite.sh
bin/setup_native_deps.sh
bin/setup_native_luau.sh
bin/verify_native_deps.sh
bin/verify_native_locks.sh
Makefile*
checksum.exs
),
name: "sqlite_engine",
licenses: ["MIT"],
links: %{
"GitHub" => "https://github.com/mindreframer/sqlite_engine",
"Changelog" =>
"https://github.com/mindreframer/sqlite_engine/blob/main/CHANGELOG.md"
}
]
end
defp docs do
[
main: "readme",
extras: docs_extras(),
source_ref: "v#{@version}",
source_url: "https://github.com/mindreframer/sqlite_engine"
]
end
defp docs_extras do
[
"README.md": [title: "Readme"],
"guides/luau.md": [title: "Native Luau stored procedures"],
"guides/migrating_from_exqlite.md": [title: "Migrating from Exqlite"],
"NOTICE.md": [title: "Notices and provenance"],
"CHANGELOG.md": []
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp test_paths(nil), do: ["test"]
defp test_paths(_any), do: ["integration_test/sqlite_engine"]
defp dialyzer do
[
plt_add_deps: :apps_direct,
plt_add_apps: ~w(table)a
]
end
def make_precompiler_nif_versions do
[
versions: ["2.18"]
]
end
defp cc_precompiler do
[
cleanup: "clean",
only_listed_targets: false,
compilers: %{
{:unix, :linux} => %{
"x86_64-linux-gnu" => {"gcc", "g++"},
"aarch64-linux-gnu" => "aarch64-linux-gnu-",
"x86_64-linux-musl" => "x86_64-linux-musl-",
"aarch64-linux-musl" => "aarch64-linux-musl-"
},
{:unix, :darwin} => %{
"x86_64-apple-darwin" =>
{"clang", "clang++", "<%= cc %> -arch x86_64", "<%= cxx %> -arch x86_64"},
"aarch64-apple-darwin" =>
{"clang", "clang++", "<%= cc %> -arch arm64", "<%= cxx %> -arch arm64"}
}
}
]
end
end