Skip to content

Commit 36fe0b3

Browse files
committed
C#: Narrow scaffolding to transtive dependencies of the changed files.
1 parent d95ebc7 commit 36fe0b3

File tree

1 file changed

+18
-1
lines changed
  • csharp/extractor/Semmle.Extraction.CSharp/Extractor

1 file changed

+18
-1
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ public void AnalyseTree(SyntaxTree tree)
7878
/// </summary>
7979
public void AnalyseReferences()
8080
{
81+
// Only source files can be considered changed in overlay mode.
82+
// The transitive dependencies to references are extracted, when the
83+
// changed files are extracted.
84+
if (OverlayInfo.IsOverlayMode)
85+
{
86+
return;
87+
}
88+
8189
foreach (var assembly in compilation.References.OfType<PortableExecutableReference>())
8290
{
8391
extractionTasks.Add(() => DoAnalyseReferenceAssembly(assembly));
@@ -197,9 +205,18 @@ private void DoExtractTree(SyntaxTree tree)
197205
using var trapWriter = transformedSourcePath.CreateTrapWriter(Logger, options.TrapCompression, discardDuplicates: false);
198206

199207
var currentTaskId = IncrementTaskCount();
200-
ReportProgressTaskStarted(currentTaskId, sourcePath);
201208

202209
var cx = new Context(ExtractionContext, compilation, trapWriter, new SourceScope(tree), OverlayInfo, addAssemblyTrapPrefix);
210+
211+
// If the file is not changed, the transitive dependency extraction is handled
212+
// when the changed file is extracted.
213+
if (cx.OnlyScaffold)
214+
{
215+
return;
216+
}
217+
218+
ReportProgressTaskStarted(currentTaskId, sourcePath);
219+
203220
// Ensure that the file itself is populated in case the source file is totally empty
204221
var root = tree.GetRoot();
205222
Entities.File.Create(cx, root.SyntaxTree.FilePath);

0 commit comments

Comments
 (0)