Skip to content

Commit

Permalink
Add support for the nightlies uploaded to Github
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonlightSentinel authored and thewilsonator committed May 30, 2021
1 parent 4623fcf commit 7493f91
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions script/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ resolve_latest() {
logV "Determing latest dmd-beta version (${mirrors[0]})."
COMPILER="dmd-$(fetch "${mirrors[@]}")"
;;
dmd-nightly)
COMPILER="dmd-nightly"
;;
dmd-*) # nightly master or feature branch
# dmd-nightly, dmd-master, dmd-branch
# but not: dmd-2016-10-19 or dmd-branch-2016-10-20
Expand Down Expand Up @@ -798,6 +801,19 @@ install_compiler() {

download_and_unpack_with_verify "$ROOT/$compiler" "$url"

# Nightlies uploaded to the DMD repo
elif [[ $1 == dmd-nightly ]]; then
local baseUrl="https://github.com/dlang/dmd/releases/download/nightly/dmd.master"
local ext
test $OS = windows && ext=7z || ext=tar.xz
local mod=
test $OS = freebsd && mod=-64

download_and_unpack_without_verify "$ROOT/$compiler" "$baseUrl.$OS$mod.$ext"

# Create symlink `dmd-master => dmd-nightly` to be compatible with the old behaviour
ln -s "$ROOT/$compiler" "$ROOT/dmd-master"

# ldc-0.12.1 or ldc-0.15.0-alpha1
elif [[ $1 =~ ^ldc-(([0-9]+)\.([0-9]+)\.[0-9]+(-.*)?)$ ]]; then
local ver=${BASH_REMATCH[1]}
Expand Down Expand Up @@ -1193,6 +1209,11 @@ uninstall_compiler() {
fi
log "Removing $(display_path "$ROOT/$1")"
rm -rf "${ROOT:?}/$1"

# Remove the compatibility symlink for the nightlies
if [ "$1" == "dmd-nightly" ]; then
rm -rf "${ROOT:?}/dmd-master"
fi
}

list_compilers() {
Expand Down
2 changes: 1 addition & 1 deletion test/t/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fi

# test dmd-nightly
./script/install.sh install dmd-nightly
dmd_nightly="$(./script/install.sh list | grep dmd-master)"
dmd_nightly="$(./script/install.sh list | grep dmd-nightly)"
./script/install.sh uninstall "$dmd_nightly"

# test dmd-beta
Expand Down

0 comments on commit 7493f91

Please sign in to comment.