From 47faba29cb6642246c672b3021fc9f2ca0fcc0d1 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Fri, 11 Sep 2015 14:51:46 +0000 Subject: [PATCH] fix Issue 15031 - rdmd should force rebuild when --compiler changes --- rdmd.d | 1 + rdmd_test.d | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/rdmd.d b/rdmd.d index 313a343..eb4eecf 100644 --- a/rdmd.d +++ b/rdmd.d @@ -392,6 +392,7 @@ private string getWorkPath(in string root, in string[] compilerFlags) MD5 context; context.start(); + context.put(compiler.representation); context.put(root.absolutePath().representation); foreach (flag; compilerFlags) { diff --git a/rdmd_test.d b/rdmd_test.d index a3b62be..e2785b6 100644 --- a/rdmd_test.d +++ b/rdmd_test.d @@ -321,6 +321,22 @@ void runTests() mkdir(conflictDir); res = execute([rdmdApp, compilerSwitch, "-of" ~ conflictDir, forceSrc]); assert(res.status != 0, "-of set to a directory should fail"); + + /* rdmd should force rebuild when --compiler changes: https://issues.dlang.org/show_bug.cgi?id=15031 */ + + res = execute([rdmdApp, compilerSwitch, forceSrc]); + assert(res.status == 0, res.output); + assert(!res.output.canFind("compile_force_src")); + + auto fullCompilerPath = environment["PATH"] + .splitter(pathSeparator) + .map!(dir => dir.buildPath(compiler ~ binExt)) + .filter!exists + .front; + + res = execute([rdmdApp, "--compiler=" ~ fullCompilerPath, forceSrc]); + assert(res.status == 0, res.output ~ "\nCan't run with --compiler=" ~ fullCompilerPath); + assert(res.output.canFind("compile_force_src")); } void runConcurrencyTest()