at master 847 B view raw
1# shellcheck shell=bash 2# this hook will symlink all dependencies found in ERL_LIBS 3# since Elixir 1.12.2 elixir does not look into ERL_LIBS for 4# elixir depencencies anymore, so those have to be symlinked to the _build directory 5mkdir -p _build/"$MIX_BUILD_PREFIX"/lib 6while read -r -d ':' lib; do 7 for dir in "$lib"/*; do 8 # Strip version number for directory name if it exists, so naming of 9 # all libs matches what mix's expectation. 10 dest=$(basename "$dir" | cut -d '-' -f1) 11 build_dir="_build/$MIX_BUILD_PREFIX/lib/$dest" 12 ((MIX_DEBUG == 1)) && echo "Linking $dir to $build_dir" 13 # Symlink libs to _build so that mix can find them when compiling. 14 # This is what allows mix to compile the package without searching 15 # for dependencies over the network. 16 ln -s "$dir" "$build_dir" 17 done 18done <<< "$ERL_LIBS:"