Merge remote-tracking branch 'upstream/master' into stable

This commit is contained in:
Martin Nowak 2022-04-21 12:22:12 +02:00
commit 967b52f734
7 changed files with 30 additions and 79 deletions

View file

@ -1,26 +0,0 @@
language: d
sudo: false
matrix:
include:
- d: dmd
env: MODEL=64
- d: dmd-nightly
env: MODEL=64
- d: dmd
env: MODEL=32
addons:
apt:
packages:
- g++-multilib
- libcurl4-openssl-dev:i386
- d: dmd-nightly
env: MODEL=32
addons:
apt:
packages:
- g++-multilib
- libcurl4-openssl-dev:i386
script:
- ./travis.sh

View file

@ -3,7 +3,6 @@ D tools
[![GitHub tag](https://img.shields.io/github/tag/dlang/tools.svg?maxAge=86400)](https://github.com/dlang/tools/releases)
[![Bugzilla Issues](https://img.shields.io/badge/issues-Bugzilla-green.svg)](https://issues.dlang.org/buglist.cgi?component=tools&list_id=220149&product=D&resolution=---)
[![Travis](https://img.shields.io/travis/dlang/tools/master.svg?logo=travis&style=flat&label=travis)](https://travis-ci.org/dlang/tools)
[![Buildkite](https://img.shields.io/buildkite/8cc605b3a89338bc41b144efcd5226acfe6b91c844a8a27ad9/master.svg?logo=dependabot&style=flat&label=buildkite)](https://buildkite.com/dlang/tools)
[![license](https://img.shields.io/github/license/dlang/tools.svg)](https://github.com/dlang/tools/blob/master/LICENSE.txt)

View file

@ -0,0 +1,3 @@
rdmd now supports specifying the D compiler using the `RDMD_DMD` environment variable
rdmd now uses the `RDMD_DMD` environment variable, if it is present in the environment, to choose the D compiler to use. As with the `--compiler` option, the variable's value must specify the name or path of a compiler with a DMD-like command line syntax, such as `gdmd` or `ldmd2`. The variable overrides the default (which is decided at the time `rdmd` was built), but can still be overridden by the `--compiler` option.

View file

@ -89,6 +89,12 @@ of the options.
Specify directory to store cached program and other
temporaries [default = as per \fIhttp://dlang.org/phobos/std_file.html#.tempDir\fR]
.SH ENVIRONMENT
.TP
.B RDMD_DMD
Specifies the D compiler to use, in the same way as \fB--compiler\fR, when \fB--compiler\fR is not specified.
.PP
.SH NOTES
.B dmd
or

28
rdmd.d
View file

@ -64,18 +64,11 @@ else version (LDC)
private enum defaultCompiler = "ldmd2";
else
static assert(false, "Unknown compiler");
private string compiler = defaultCompiler;
private string compiler = null;
version(unittest) {} else
int main(string[] args)
{
// Look for the D compiler rdmd invokes automatically in the same directory as rdmd
// and fall back to using the one in your path otherwise.
string compilerPath = buildPath(dirName(thisExePath()), defaultCompiler ~ binExt);
if (Filesystem.existsAsFile(compilerPath))
compiler = compilerPath;
if (args.length > 1 && args[1].startsWith("--shebang ", "--shebang="))
{
// multiple options wrapped in one
@ -142,6 +135,7 @@ int main(string[] args)
string[] eval; // set by --eval
bool makeDepend;
string makeDepFile;
try
{
getopt(argsBeforeProgram,
@ -173,6 +167,24 @@ int main(string[] args)
if (bailout) return 0;
if (dryRun) chatty = true; // dry-run implies chatty
// If we don't have a known compiler specified by the user,
// then we need to look to see if it was specified via an environmental argument.
// We need to do this due to rdmd being used as the execution engine for shebang files.
// This was originally tested with both $DMD, and $DC variable support.
// It was removed due to the current test suites being fragile enough that it broke them.
if (!compiler)
compiler = environment.get("RDMD_DMD", null);
if (!compiler)
{
compiler = defaultCompiler;
// Look for the D compiler rdmd invokes automatically in the same directory as rdmd
// and fall back to using the one in your path otherwise.
string compilerPath = buildPath(dirName(thisExePath()), compiler ~ binExt);
if (Filesystem.existsAsFile(compilerPath))
compiler = compilerPath;
}
/* Only -of is supported because Make is very susceptible to file names, and
* it doesn't do a good job resolving them. One option would be to use
* std.path.buildNormalizedPath(), but some corner cases will break, so it

View file

@ -1,7 +1,7 @@
#!/usr/bin/env dub
/++dub.sdl:
name "tests_extractor"
dependency "libdparse" version="~>0.15.1"
dependency "libdparse" version="~>0.19.0"
+/
/*
* Parses all public unittests that are visible on dlang.org

View file

@ -1,43 +0,0 @@
#!/bin/bash
set -uexo pipefail
~/dlang/install.sh install gdc
~/dlang/install.sh install ldc
~/dlang/install.sh list
GDMD=$(find ~/dlang -type f -name "gdmd")
LDMD2=$(find ~/dlang -type f -name "ldmd2")
make -f posix.mak all DMD="$(which dmd)"
make -f posix.mak test DMD="$(which dmd)" \
RDMD_TEST_COMPILERS=dmd,"$GDMD","$LDMD2" \
VERBOSE_RDMD_TEST=1
# Test setup.sh
shellcheck setup.sh
dmd=dmd/generated/linux/release/64/dmd
dir=generated/setup.sh-test
cwd="$(pwd)"
# check initial checkout
rm -rf "$dir" && mkdir "$dir" && pushd "$dir"
echo "y" | "$cwd"/setup.sh
echo 'void main(){ import std.stdio; "Hello World".writeln;}' | "./${dmd}" -run - | grep -q "Hello World"
# test updates
echo "y" | "$cwd"/setup.sh
echo 'void main(){ import std.stdio; "Hello World".writeln;}' | "./${dmd}" -run - | grep -q "Hello World"
popd && rm -rf "$dir" && mkdir "$dir" && pushd "$dir"
# test checking out tags
# requires an older host compiler too, see also: https://github.com/dlang/tools/pull/324
. $(~/dlang/install.sh install dmd-2.078.1 -a)
echo "y" | "$cwd"/setup.sh --tag=2.078.1
echo 'void main(){ import std.stdio; __VERSION__.writeln;}' | "./2.078.1/${dmd}" -run - | grep -q "2078"
popd
# test building the DUB packages
./test/test_dub.sh