Adding ccache-like output caching to dmd

drug drug2004 at bk.ru
Wed Dec 30 11:52:33 UTC 2020


On 12/29/20 11:09 PM, John Colvin wrote:
> On Tuesday, 29 December 2020 at 19:57:21 UTC, Per Nordlöw wrote:
>> On Tuesday, 29 December 2020 at 16:43:33 UTC, John Colvin wrote:
>>> Or something like that, you get the idea... It's not intractable, 
>>> it's just a bit fiddly.
>>
>> Superb answer.
>>
>> Does this design match https://github.com/dlang/dub/pull/2044
> 
> Not really, although maybe it should?
> 
> If I understand correctly (I haven't reviewed the implementation), that 
> PR is using dub's normal rebuild rules w.r.t. changed files and is just 
> swapping out access times for content hashes.  


Dub already provides something like S, say S* [1], so currently compiler 
invocation is F(Z)->0, where Z = (X, S*). The PR implements this:

rebuild = false
foreach(file: Z)
{
	if Hash(file) != BuildCache[file] or !file.exists
	{
		rebuild = true
		break
	}
}

if (rebuild)
{
	buildWithCompiler
	BuildCache = Hash(Z)
}



> Maybe I'm mistaken, but I
> don't think dub pays any attention to changes in files that aren't 
> source files.
Probably I misunderstand but if you mean that source files are *.d files 
only then you are mistaken, Z contains *.{sdl|json}, string imports, 
binary libraries etc

1 Not exactly S, dub scans all string import paths and adds their 
content to S, so it can add files that are not used in the current build


More information about the Digitalmars-d mailing list