Skip to content

Commit

Permalink
Extract abi from :erlang.system_info (#117)
Browse files Browse the repository at this point in the history
* Extract abi from :erlang.system_info and add it to target spec

* Bump version to 1.4.1
  • Loading branch information
Noarkhh authored Dec 12, 2023
1 parent 19a5cca commit e58796f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/bundlex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,29 @@ defmodule Bundlex do
@type platform_t :: :linux | :macosx | :windows32 | :windows64 | :nerves

@typedoc """
A map containing three fields that describe the platform.
A map containing four fields that describe the platform.
It consists of:
* architecture - e.g. `x86_64` or `arm64`
* vendor - e.g. `pc`
* os - operating system, e.g. `linux` or `darwin20.6.0`
* abi - application binary interface, e.g. `musl` or `gnu` (nil if unknown / non-existent)
"""
@type target ::
%{architecture: String.t(), vendor: String.t(), os: String.t()}
%{architecture: String.t(), vendor: String.t(), os: String.t(), abi: String.t() | nil}
@doc """
A function returning a target triplet for the environment on which it is run.
"""
@spec get_target() :: target()
def get_target() do
[architecture, vendor, os | _rest] =
[architecture, vendor, os | maybe_abi] =
:erlang.system_info(:system_architecture) |> List.to_string() |> String.split("-")

%{
architecture: architecture,
vendor: vendor,
os: os
os: os,
abi: List.first(maybe_abi)
}
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Bundlex.Mixfile do
use Mix.Project

@version "1.4.0"
@version "1.4.1"
@github_url "https://github.com/membraneframework/bundlex"

def project do
Expand Down

0 comments on commit e58796f

Please sign in to comment.