Skip to content

Commit ec6b6e4

Browse files
committed
Update: Fixing some bugs from compiler inference after optimization
1 parent 9c44998 commit ec6b6e4

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- uses: MrcSnm/setup-dlang@v2
3636
with:
3737
compiler: ldc-latest
38-
redub: master
38+
redub: latest
3939

4040
- name: Build
4141
if: runner.os != 'macOS'

source/redub/misc/find_executable.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ string findExecutable(string executableName)
5353
}
5454

5555
}
56-
return "";
56+
return null;
5757
}

source/redub/tooling/compilers_inference.d

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,27 @@ private string getActualCompilerToUse(string preferredCompiler, ref string actua
123123
import std.typecons;
124124
import std.process;
125125
import redub.logging;
126-
import std.path: baseName, stripExtension;
126+
import std.path: baseName, stripExtension, isAbsolute;
127+
import redub.misc.find_executable;
127128
Tuple!(int, "status", string, "output") compVersionRes;
129+
compVersionRes.status = 1;
130+
compVersionRes.output = "No compiler found.";
128131

129132
bool preferredTested = false;
130133
foreach(string searchable; preferredCompiler~searchableCompilers)
131134
{
132-
if(preferredTested && searchable == preferredCompiler)
135+
if((preferredTested && searchable == preferredCompiler) || searchable.length == 0)
133136
continue;
134137
if(searchable != preferredCompiler)
135138
searchable = tryGetCompilerOnCwd(searchable);
136139
else
137140
preferredTested = true;
141+
if(!isAbsolute(searchable))
142+
{
143+
searchable = findExecutable(searchable);
144+
if(searchable.length == 0)
145+
continue;
146+
}
138147

139148
string[2] versionCommand = [searchable, "--version"];
140149
size_t args = searchable.baseName.stripExtension != "cl" ? 2 : 1;

0 commit comments

Comments
 (0)