diff options
author | w0rp <devw0rp@gmail.com> | 2016-09-18 10:38:54 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2016-09-18 10:38:54 +0100 |
commit | 0bc4b4c14c3cce61dd1838b5ed3ae5696f76f14d (patch) | |
tree | fc4b765121218694ad513ca5b4826999a716b79e /dmd-wrapper | |
parent | a32b380b6f31027e2a6f968cc323bb49f62ac3b3 (diff) | |
download | ale-0bc4b4c14c3cce61dd1838b5ed3ae5696f76f14d.zip |
Run DUB in a separate process as well, so it will not cause import lag.
Diffstat (limited to 'dmd-wrapper')
-rwxr-xr-x | dmd-wrapper | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/dmd-wrapper b/dmd-wrapper index e413f083..dd2bb53a 100755 --- a/dmd-wrapper +++ b/dmd-wrapper @@ -13,4 +13,27 @@ while read line; do echo "$line" >> "$temp_file" done -dmd "$@" "$temp_file" +# Read imports from DUB. +original_path="$(readlink -m .)" +path="$original_path" +import_line_options='' + +# We need to look for variable configuration files in parent directories. +while [ "$path" != '/' ]; do + if [ -f "$path/dub.sdl" ] || [ -f "$path/dub.json" ] || [ -f "$path/package.json" ]; then + + cd "$path" + + while read import_line; do + import_line_options="$import_line_options -I$import_line" + done <<< "$(dub describe --import-paths)" + + cd "$original_path" + + break + fi + + path="$(dirname "$path")" +done + +dmd $import_line_options "$@" "$temp_file" |