Skip to content

Commit 7493f91

Browse files
MoonlightSentinelthewilsonator
authored andcommitted
Add support for the nightlies uploaded to Github
1 parent 4623fcf commit 7493f91

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

script/install.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,9 @@ resolve_latest() {
675675
logV "Determing latest dmd-beta version (${mirrors[0]})."
676676
COMPILER="dmd-$(fetch "${mirrors[@]}")"
677677
;;
678+
dmd-nightly)
679+
COMPILER="dmd-nightly"
680+
;;
678681
dmd-*) # nightly master or feature branch
679682
# dmd-nightly, dmd-master, dmd-branch
680683
# but not: dmd-2016-10-19 or dmd-branch-2016-10-20
@@ -798,6 +801,19 @@ install_compiler() {
798801

799802
download_and_unpack_with_verify "$ROOT/$compiler" "$url"
800803

804+
# Nightlies uploaded to the DMD repo
805+
elif [[ $1 == dmd-nightly ]]; then
806+
local baseUrl="https://github.com/dlang/dmd/releases/download/nightly/dmd.master"
807+
local ext
808+
test $OS = windows && ext=7z || ext=tar.xz
809+
local mod=
810+
test $OS = freebsd && mod=-64
811+
812+
download_and_unpack_without_verify "$ROOT/$compiler" "$baseUrl.$OS$mod.$ext"
813+
814+
# Create symlink `dmd-master => dmd-nightly` to be compatible with the old behaviour
815+
ln -s "$ROOT/$compiler" "$ROOT/dmd-master"
816+
801817
# ldc-0.12.1 or ldc-0.15.0-alpha1
802818
elif [[ $1 =~ ^ldc-(([0-9]+)\.([0-9]+)\.[0-9]+(-.*)?)$ ]]; then
803819
local ver=${BASH_REMATCH[1]}
@@ -1193,6 +1209,11 @@ uninstall_compiler() {
11931209
fi
11941210
log "Removing $(display_path "$ROOT/$1")"
11951211
rm -rf "${ROOT:?}/$1"
1212+
1213+
# Remove the compatibility symlink for the nightlies
1214+
if [ "$1" == "dmd-nightly" ]; then
1215+
rm -rf "${ROOT:?}/dmd-master"
1216+
fi
11961217
}
11971218

11981219
list_compilers() {

test/t/base.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fi
136136

137137
# test dmd-nightly
138138
./script/install.sh install dmd-nightly
139-
dmd_nightly="$(./script/install.sh list | grep dmd-master)"
139+
dmd_nightly="$(./script/install.sh list | grep dmd-nightly)"
140140
./script/install.sh uninstall "$dmd_nightly"
141141

142142
# test dmd-beta

0 commit comments

Comments
 (0)