Skip to content

Comments

Allow installing dub in standalone#301

Merged
wilzbach merged 1 commit intodlang:masterfrom
wilzbach:dub
May 10, 2019
Merged

Allow installing dub in standalone#301
wilzbach merged 1 commit intodlang:masterfrom
wilzbach:dub

Conversation

@wilzbach
Copy link
Contributor

This allows using the installer script to install an individual version of DUB.

The main motivation for this are the failing DUB + Vibe.d Travis builds which still test very old DMD versions which don't come with the latest DUB binaries.

In the future we might support something like dmd-2.072.0+dub (latest dub) or dmd-2.072.2+dub.1.7.2, but for now this allows @s-ludwig to do add this extra line to update to the latest dub:

. $(~/dlang/install.sh dub -a)

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@wilzbach wilzbach force-pushed the dub branch 2 times, most recently from c2fe280 to 707db0d Compare February 21, 2018 01:26
log "Using dub shipped with $2"
DUB_BIN_PATH="${ROOT}/dub"
install_dub
fi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deliberately avoided updating the default dub symlink (which happens in install_dub), though there are pros and cons for this.

DUB_VERSION="$(fetch "${mirrors[@]}")"
local DUB="dub-${DUB_VERSION}"
if [ -z "$1" ] ; then
COMPILER="$DUB"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure on the best way to deal with this.
The problem is that I wanted to reuse the logic here in install_dub, but in install dmd path, we can't set COMPILER, but for install dub we should.

The missing coverage is because currently we only use specific versions on for the CI.

if [[ $name =~ \.tar\.xz$ ]]; then
tar --strip-components=1 -C "$tmp" -Jxf "$tmp/$name"
elif [[ $name =~ \.tar\.gz$ ]]; then
tar -C "$tmp" -xf "$tmp/$name"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dub binary is in the root-level.

deactivate() {
export PATH="\$_OLD_D_PATH"
EOF
if [ -n "$libpath" ] ; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following code writes thin activate scripts that only set the variables that are actually set.
In other words things like LIBRARY_PATH aren't written for dub

test/all.sh Outdated
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $DIR/common.sh

for file in $(find "$DIR" -name "*.sh") ; do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motivation: it's a lot more convenient to have small files as they can be run individually.
I have already run into this before, e.g. #297 (contains the same idea with test/all.sh)

@wilzbach
Copy link
Contributor Author

wilzbach commented May 2, 2018

FYI this has now been used by Vibe.d (vibe-d/vibe.d#2140) and Dub (vibe-d/vibe.d#2140) for about a month with the builds being a lot more greenish...

@wilzbach
Copy link
Contributor Author

At DConf Martin was a bit sceptical about using + as it's a valid SemVer character.
How about using @, | or : instead?

@PetarKirov
Copy link
Member

How about simply dmd-2.072.2,dub.1.7.2?

@wilzbach wilzbach force-pushed the dub branch 10 times, most recently from c9b4641 to 4b2741e Compare March 20, 2019 10:38
@wilzbach
Copy link
Contributor Author

How about simply dmd-2.072.2,dub.1.7.2?

Ok. Went with this ;-)

@wilzbach
Copy link
Contributor Author

24 days ago

Any objections?

CC @ZombineDev @thewilsonator

@thewilsonator
Copy link
Collaborator

Not really, but I don't understand the code very well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants