Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tsloughter's full-sized avatar

Tristan Sloughter tsloughter

View GitHub Profile
@tsloughter
tsloughter / gist:1e16d70268182db1415a
Last active May 22, 2023 22:08
Rebar3 Profiles

Rebar3 Profiles

Motivation

Often you want to build the same project in different ways depending on context, whether it be development or preparing for production deployment. Or you want some dependencies only for use in certain contexts such as running tests and don't want them conflicting with regular dependencies or bother to be fetched and built when not needed.

Those are some of the reasons we've introduced profiles.

Directory Structure

λ ../rebar/rebar3 pkgs
zeta:
Versions: 0.1.1
tinymt:
Versions: 0.0.9
swab:
Versions: 1.0.0
λ ../rebar/rebar3 help release
Usage: rebar release [-n <relname>] [-v <relvsn>] [-g <goal>]
                     [-u <upfrom>] [-o <output_dir>] [-h] [-l <lib_dir>]
                     [-p <path>] [--default-libs <default_libs>]
                     [-V [<log_level>]] [-d <dev_mode>]
                     [-i <include_erts>] [-a <override>] [-c [<config>]]
                     [--overlay_vars <overlay_vars>]
                     [--sys_config <sys_config>]
                     [--system_libs <system_libs>] [--version]
λ ./rebar3 help compile                     
Usage: rebar compile [-j <jobs>]

  -j, --jobs  Number of concurrent workers the compiler may use. Default: 3
@tsloughter
tsloughter / hello.c
Created September 28, 2014 14:55
Hello World Nif
#include "erl_nif.h"
static ERL_NIF_TERM world(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
return enif_make_string(env, "Hello world!", ERL_NIF_LATIN1);
}
static ErlNifFunc nif_funcs[] = {
{"world", 0, world}
};
@tsloughter
tsloughter / erl_nif.rs
Created September 28, 2014 03:58
Erlang Nif Rust Bindings
/* automatically generated by rust-bindgen */
extern crate libc;
use libc::size_t;
use libc::ssize_t;
#[repr(C)]
pub struct ErlDrvSysInfo {
pub driver_major_version: ::libc::c_int,
pub driver_minor_version: ::libc::c_int,
pub erts_version: *mut ::libc::c_char,
@tsloughter
tsloughter / erl_nif.rs
Created September 28, 2014 02:18
Erlang Nif Rust Bindings
/* automatically generated by rust-bindgen */
pub type ErlNifUInt64 = ::libc::c_ulong;
pub type ErlNifSInt64 = ::libc::c_long;
pub type ERL_NIF_TERM = ::libc::c_ulong;
pub type ERL_NIF_UINT = ERL_NIF_TERM;
pub enum Struct_enif_environment_t { }
pub type ErlNifEnv = Struct_enif_environment_t;
#[repr(C)]
pub struct ErlNifFunc {
dialyzer --fullpath --plt /home/tristan/Devel/rebar/.depsolver_plt -Wno_opaque -Wrace_conditions -r ./ebin
Checking whether the PLT /home/tristan/Devel/rebar/.depsolver_plt is up-to-date... yes
Proceeding with analysis...
dialyzer: Analysis failed with error:
Could not scan the following file(s):
Could not get core Erlang code for: /home/tristan/Devel/rebar/ebin/rebar_prv_version.beam Could not get core Erlang code for: /home/tristan/Devel/rebar/ebin/rebar_prv_update.beam Could not get core Erlang code for: /home/tristan/Devel/rebar/ebin/rebar_prv_shell.beam Could not get core Erlang code for: /home/tristan/Devel/rebar/ebin/rebar_prv_tar.beam Could not get core Erlang code for: /home/tristan/Devel/rebar/ebin/rebar_prv_release.beam Could not get core Erlang code for: /home/tristan/Devel/rebar/ebin/rebar_prv_packages.beam Could not get core Erlang code for: /home/tristan/Devel/rebar/ebin/rebar_prv_new.beam Could not get core Erlang code for: /home/tristan/Devel/rebar/ebin/rebar_prv_lock.beam Could
1> beam_lib:chunks("/home/tristan/Devel/rebar/ebin/rebar_prv_version.beam", [compile_info]).
{ok,{rebar_prv_version,
[{compile_info,
[{options,
[{outdir,"ebin"},
debug_info,
{d,namespaced_types},
debug_info,warnings_as_errors,
{i,"include"}]},
{version,"5.0.2"},
my_project:
{:foo, git: "https://github.com/elixir-lang/foo.git", tag: "0.1"}
{:bar, git: "https://github.com/elixir-lang/bar.git", tag: "0.1"}
foo 0.1:
{:bar, git: "https://github.com/elixir-lang/bar.git", tag: "0.1"}
foo 0.2:
{:bar, git: "https://github.com/elixir-lang/bar.git", tag: "0.2"}