www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Cherry on top for redub: looking for a module import analyzer

reply Hipreme <msnmancini hotmail.com> writes:
It is possible to make root builds way faster, specially for 
those which contains a lot of code. That being said, I would need 
an implementation of import analyzing library.

It should work as simply as: send a source file path and import 
paths then  it returns: the imported files by this file which it 
were found on:

```d

struct SourceFile
{
     string importPath, string sourcePath;
}

SourceFile[] getDependencies(string inputFile, string[] 
importPaths);

```

If that kind of work has been done in this area, I could do an 
improvement to redub.
Keep in mind that this is not a guaranteed improvement since the 
time it needs to analyze the imports can't be greater than the 
time won by using object files.
Jul 24
parent max haughton <maxhaton gmail.com> writes:
On Wednesday, 24 July 2024 at 12:29:37 UTC, Hipreme wrote:
 It is possible to make root builds way faster, specially for 
 those which contains a lot of code. That being said, I would 
 need an implementation of import analyzing library.

 It should work as simply as: send a source file path and import 
 paths then  it returns: the imported files by this file which 
 it were found on:

 ```d

 struct SourceFile
 {
     string importPath, string sourcePath;
 }

 SourceFile[] getDependencies(string inputFile, string[] 
 importPaths);

 ```

 If that kind of work has been done in this area, I could do an 
 improvement to redub.
 Keep in mind that this is not a guaranteed improvement since 
 the time it needs to analyze the imports can't be greater than 
 the time won by using object files.
In general you can't really do this because of string mixins. In practice you can get obviously get quite close.
Jul 31