Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue 18433 - rdmd doesn't respect DFLAGS for its cache hash #343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rdmd.d
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ int main(string[] args)
}

// Compute the object directory and ensure it exists
immutable workDir = getWorkPath(root, compilerFlags);
auto environmentFlags = environment.get("DFLAGS", "").split(" ");
immutable workDir = getWorkPath(root, compilerFlags ~ environmentFlags);
lockWorkPath(workDir); // will be released by the OS on process exit
string objDir = buildPath(workDir, "objs");
Filesystem.mkdirRecurseIfLive(objDir);
Expand Down
21 changes: 21 additions & 0 deletions rdmd_test.d
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,27 @@ SHELL = %s
assert(res.status == 0, res.output);
assert(std.file.read(textOutput) == "hello world\n");
}

// https://issues.dlang.org/show_bug.cgi?id=18423
// rdmd ignores changes in DFLAGS
{
string srcName = tempDir().buildPath("force_rebuild_dflags.d");
std.file.write(srcName, `void main() { import std.stdio; version(Foo) {"foo".writeln;} else { "bar".writeln; }}`);

res = execute(rdmdArgs ~ [srcName]);
assert(res.status == 0, res.output);
assert(res.output.canFind("bar"));

environment["DFLAGS"] = "-version=Foo";
res = execute(rdmdArgs ~ [srcName]);
assert(res.status == 0, res.output);
assert(res.output.canFind("foo"), res.output);

environment.remove("DFLAGS");
res = execute(rdmdArgs ~ [srcName]);
assert(res.status == 0, res.output);
assert(res.output.canFind("bar"));
}
}

void runConcurrencyTest(string rdmdApp, string compiler, string model)
Expand Down