Thread overview
[VisualD] Fully rebuilding a project after a smallest change in one file
Jan 19, 2018
Rogi
Jan 20, 2018
Rainer Schuetze
Jan 22, 2018
Rogi
Jan 23, 2018
Rainer Schuetze
Jan 23, 2018
Rogi
January 19, 2018
Hi,

When using VisualD in 'Visual C/C++ integration mode' my project rebuilds everything every time I make the smallest change in one file.

In the simplest case:

// file 'foo.d'
module foo;
class Foo
{
  void FooFunc()
  {
  }
}

//file 'main.d'
import foo;
int main()
{
  auto f = new Foo();
  f.FooFunc();
  return 0;
}

Both files are added to a simplest Visual C/C++ project (vcxproj) and compiling with DMD. The project is setup to compile 'One object file per source file' (far from optimal but necessary in my use case).
If I modify only main.d, both foo.d and main.d will be recompiled.
Expected behaviour would be: only main.d is recompiled (since foo.d does not depend on main.d).

I'm using VS2015 + VisualD 0.45.1.

Is this a known problem or I have some kind of problem in my setup?

Thanks!
January 20, 2018

On 19.01.2018 16:04, Rogi wrote:
> Hi,
> 
> When using VisualD in 'Visual C/C++ integration mode' my project rebuilds everything every time I make the smallest change in one file.
> 
> In the simplest case:
> 
> // file 'foo.d'
> module foo;
> class Foo
> {
>    void FooFunc()
>    {
>    }
> }
> 
> //file 'main.d'
> import foo;
> int main()
> {
>    auto f = new Foo();
>    f.FooFunc();
>    return 0;
> }
> 
> Both files are added to a simplest Visual C/C++ project (vcxproj) and compiling with DMD. The project is setup to compile 'One object file per source file' (far from optimal but necessary in my use case).
> If I modify only main.d, both foo.d and main.d will be recompiled.
> Expected behaviour would be: only main.d is recompiled (since foo.d does not depend on main.d).
> 
> I'm using VS2015 + VisualD 0.45.1.
> 
> Is this a known problem or I have some kind of problem in my setup?
> 
> Thanks!

I can reproduce it. According to the build log the build task thinks that the command line as changed. Will have to investigate more...
January 22, 2018
On Saturday, 20 January 2018 at 21:53:39 UTC, Rainer Schuetze wrote:
>
>
> On 19.01.2018 16:04, Rogi wrote:
>> [...]
>
> I can reproduce it. According to the build log the build task thinks that the command line as changed. Will have to investigate more...

Thanks for answering!
You gave me a hint where to start looking and I can propose you a patch which fixes the issue. I can prepare a pull request for it if you are interested.
January 23, 2018

On 22.01.2018 18:39, Rogi wrote:
> On Saturday, 20 January 2018 at 21:53:39 UTC, Rainer Schuetze wrote:
>>
>>
>> On 19.01.2018 16:04, Rogi wrote:
>>> [...]
>>
>> I can reproduce it. According to the build log the build task thinks that the command line as changed. Will have to investigate more...
> 
> Thanks for answering!
> You gave me a hint where to start looking and I can propose you a patch which fixes the issue. I can prepare a pull request for it if you are interested.

Please do. I had a quick look, but didn't yet had time to drill deeper, so a patch is very welcome.

My guess is that there is some format mismatch in GenerateCommandLineCommands: https://github.com/dlang/visuald/blob/master/msbuild/dbuild/CompileD.cs#L391
January 23, 2018
On Tuesday, 23 January 2018 at 07:00:40 UTC, Rainer Schuetze wrote:
>
>
> On 22.01.2018 18:39, Rogi wrote:
>> On Saturday, 20 January 2018 at 21:53:39 UTC, Rainer Schuetze wrote:
>>>
>>>
>>> On 19.01.2018 16:04, Rogi wrote:
>>>> [...]
>>>
>>> I can reproduce it. According to the build log the build task thinks that the command line as changed. Will have to investigate more...
>> 
>> Thanks for answering!
>> You gave me a hint where to start looking and I can propose you a patch which fixes the issue. I can prepare a pull request for it if you are interested.
>
> Please do. I had a quick look, but didn't yet had time to drill deeper, so a patch is very welcome.
>
> My guess is that there is some format mismatch in GenerateCommandLineCommands: https://github.com/dlang/visuald/blob/master/msbuild/dbuild/CompileD.cs#L391

Exactly.
Actually GenerateCommandLineCommands is not even called by the code which generates the list of sources out-of-date because of command line change, so it compares the previous command line with 'nothing'!
I submitted a pull request:
https://github.com/dlang/visuald/pull/86