@@ -487,6 +487,54 @@ public Task<ImmutableArray<FilePath>> GetAnalyzerFilesAsync (ProgressMonitor mon
487487 return ProjectExtension . OnGetAnalyzerFiles ( monitor , configuration ) ;
488488 }
489489
490+ /// <summary>
491+ /// Gets the .editorconfig files that are included in the project, including any that are added by `CoreCompileDependsOn`
492+ /// </summary>
493+ public Task < ImmutableArray < FilePath > > GetEditorConfigFilesAsync ( ConfigurationSelector configuration )
494+ {
495+ if ( sourceProject == null )
496+ return Task . FromResult ( ImmutableArray < FilePath > . Empty ) ;
497+
498+ return BindTask < ImmutableArray < FilePath > > ( async cancelToken => {
499+ using ( var cancelSource = CancellationTokenSource . CreateLinkedTokenSource ( cancelToken ) )
500+ using ( var monitor = new ProgressMonitor ( cancelSource ) ) {
501+ return await GetEditorConfigFilesAsync ( monitor , configuration ) ;
502+ }
503+ } ) ;
504+ }
505+
506+ /// <summary>
507+ /// Gets the .editorconfig files that are included in the project, including any that are added by `CoreCompileDependsOn`
508+ /// </summary>
509+ public Task < ImmutableArray < FilePath > > GetEditorConfigFilesAsync ( ProgressMonitor monitor , ConfigurationSelector configuration )
510+ {
511+ return ProjectExtension . OnGetEditorConfigFiles ( monitor , configuration ) ;
512+ }
513+
514+ /// <summary>
515+ /// Gets the AdditionalFiles files that are included in the project, including any that are added by `CoreCompileDependsOn`
516+ /// </summary>
517+ public Task < ImmutableArray < FilePath > > GetAdditionalFilesAsync ( ConfigurationSelector configuration )
518+ {
519+ if ( sourceProject == null )
520+ return Task . FromResult ( ImmutableArray < FilePath > . Empty ) ;
521+
522+ return BindTask < ImmutableArray < FilePath > > ( async cancelToken => {
523+ using ( var cancelSource = CancellationTokenSource . CreateLinkedTokenSource ( cancelToken ) )
524+ using ( var monitor = new ProgressMonitor ( cancelSource ) ) {
525+ return await GetAdditionalFilesAsync ( monitor , configuration ) ;
526+ }
527+ } ) ;
528+ }
529+
530+ /// <summary>
531+ /// Gets the AdditionalFiles that are included in the project, including any that are added by `CoreCompileDependsOn`
532+ /// </summary>
533+ public Task < ImmutableArray < FilePath > > GetAdditionalFilesAsync ( ProgressMonitor monitor , ConfigurationSelector configuration )
534+ {
535+ return ProjectExtension . OnGetAdditionalFiles ( monitor , configuration ) ;
536+ }
537+
490538 /// <summary>
491539 /// Gets the source files that are included in the project, including any that are added by `CoreCompileDependsOn`
492540 /// </summary>
@@ -511,6 +559,15 @@ public Task<ImmutableArray<ProjectFile>> GetSourceFilesAsync (ProgressMonitor mo
511559 return ProjectExtension . OnGetSourceFiles ( monitor , configuration ) ;
512560 }
513561
562+ /// <summary>
563+ /// Gets the additonal files that are included in the project, including any that are added by `CoreCompileDependsOn`
564+ /// </summary>
565+ protected virtual async Task < ImmutableArray < FilePath > > OnGetAdditionalFiles ( ProgressMonitor monitor , ConfigurationSelector configuration )
566+ {
567+ var coreCompileResult = await compileEvaluator . GetItemsFromCoreCompileDependenciesAsync ( this , monitor , configuration ) ;
568+ return coreCompileResult . AdditionalFiles ;
569+ }
570+
514571 /// <summary>
515572 /// Gets the analyzer files that are included in the project, including any that are added by `CoreCompileDependsOn`
516573 /// </summary>
@@ -520,6 +577,15 @@ protected virtual async Task<ImmutableArray<FilePath>> OnGetAnalyzerFiles (Progr
520577 return coreCompileResult . AnalyzerFiles ;
521578 }
522579
580+ /// <summary>
581+ /// Gets the .editorconfig files that are included in the project, including any that are added by `CoreCompileDependsOn`
582+ /// </summary>
583+ protected virtual async Task < ImmutableArray < FilePath > > OnGetEditorConfigFiles ( ProgressMonitor monitor , ConfigurationSelector configuration )
584+ {
585+ var coreCompileResult = await compileEvaluator . GetItemsFromCoreCompileDependenciesAsync ( this , monitor , configuration ) ;
586+ return coreCompileResult . EditorConfigFiles ;
587+ }
588+
523589 /// <summary>
524590 /// Gets the source files that are included in the project, including any that are added by `CoreCompileDependsOn`
525591 /// </summary>
@@ -623,16 +689,28 @@ ProjectFile CreateProjectFile (IMSBuildItemEvaluated item)
623689
624690 readonly struct CoreCompileEvaluationResult
625691 {
626- public static CoreCompileEvaluationResult Empty = new CoreCompileEvaluationResult ( ImmutableArray < ProjectFile > . Empty , ImmutableArray < FilePath > . Empty ) ;
627-
628- public CoreCompileEvaluationResult ( ImmutableArray < ProjectFile > sourceFiles , ImmutableArray < FilePath > analyzerFiles )
692+ public static CoreCompileEvaluationResult Empty = new CoreCompileEvaluationResult (
693+ ImmutableArray < ProjectFile > . Empty ,
694+ ImmutableArray < FilePath > . Empty ,
695+ ImmutableArray < FilePath > . Empty ,
696+ ImmutableArray < FilePath > . Empty ) ;
697+
698+ public CoreCompileEvaluationResult (
699+ ImmutableArray < ProjectFile > sourceFiles ,
700+ ImmutableArray < FilePath > analyzerFiles ,
701+ ImmutableArray < FilePath > additionalFiles ,
702+ ImmutableArray < FilePath > editorConfigFiles )
629703 {
630704 SourceFiles = sourceFiles ;
631705 AnalyzerFiles = analyzerFiles ;
706+ AdditionalFiles = additionalFiles ;
707+ EditorConfigFiles = editorConfigFiles ;
632708 }
633709
634710 public readonly ImmutableArray < ProjectFile > SourceFiles ;
635711 public readonly ImmutableArray < FilePath > AnalyzerFiles ;
712+ public readonly ImmutableArray < FilePath > AdditionalFiles ;
713+ public readonly ImmutableArray < FilePath > EditorConfigFiles ;
636714 }
637715
638716 class CachingCoreCompileEvaluator
@@ -699,6 +777,8 @@ public async Task<CoreCompileEvaluationResult> GetItemsFromCoreCompileDependenci
699777 var ctx = new TargetEvaluationContext ( ) ;
700778 ctx . ItemsToEvaluate . Add ( "Compile" ) ;
701779 ctx . ItemsToEvaluate . Add ( "Analyzer" ) ;
780+ ctx . ItemsToEvaluate . Add ( "EditorConfigFiles" ) ;
781+ ctx . ItemsToEvaluate . Add ( "AdditionalFiles" ) ;
702782 ctx . LoadReferencedProjects = false ;
703783 ctx . BuilderQueue = BuilderQueue . ShortOperations ;
704784 ctx . LogVerbosity = MSBuildVerbosity . Quiet ;
@@ -725,12 +805,15 @@ public void ResetCachedCompileItems ()
725805
726806 CoreCompileEvaluationResult ProcessMSBuildItems ( IEnumerable < IMSBuildItemEvaluated > items , Project project )
727807 {
808+ var additionalFilesList = new List < FilePath > ( ) ;
728809 var analyzerList = new List < FilePath > ( ) ;
810+ var editorConfigFilesList = new List < FilePath > ( ) ;
729811 var sourceFilesList = new List < ProjectFile > ( ) ;
730812 foreach ( var item in items ) {
731813 var msbuildPath = MSBuildProjectService . FromMSBuildPath ( project . sourceProject . BaseDirectory , item . Include ) ;
732814
733- if ( item . Name == "Compile" ) {
815+ switch ( item . Name ) {
816+ case "Compile" :
734817 var subtype = Subtype . Code ;
735818
736819 const string subtypeKey = "SubType" ;
@@ -742,11 +825,24 @@ CoreCompileEvaluationResult ProcessMSBuildItems (IEnumerable<IMSBuildItemEvaluat
742825
743826 var projectFile = new ProjectFile ( msbuildPath , item . Name , subtype ) { Project = project } ;
744827 sourceFilesList . Add ( projectFile ) ;
745- } else if ( item . Name == "Analyzer" )
828+ break ;
829+ case "Analyzer" :
746830 analyzerList . Add ( msbuildPath ) ;
831+ break ;
832+ case "AdditionalFiles" :
833+ additionalFilesList . Add ( msbuildPath ) ;
834+ break ;
835+ case "EditorConfigFiles" :
836+ editorConfigFilesList . Add ( msbuildPath ) ;
837+ break ;
838+ }
747839 }
748840
749- return new CoreCompileEvaluationResult ( sourceFilesList . ToImmutableArray ( ) , analyzerList . ToImmutableArray ( ) ) ;
841+ return new CoreCompileEvaluationResult (
842+ sourceFilesList . ToImmutableArray ( ) ,
843+ analyzerList . ToImmutableArray ( ) ,
844+ additionalFilesList . ToImmutableArray ( ) ,
845+ editorConfigFilesList . ToImmutableArray ( ) ) ;
750846 }
751847 }
752848
@@ -4971,12 +5067,21 @@ internal protected override bool OnFastCheckNeedsBuild (ConfigurationSelector co
49715067 return Project . OnFastCheckNeedsBuild ( configuration , context ) ;
49725068 }
49735069
5070+ internal protected override Task < ImmutableArray < FilePath > > OnGetAdditionalFiles ( ProgressMonitor monitor , ConfigurationSelector configuration )
5071+ {
5072+ return Project . OnGetAdditionalFiles ( monitor , configuration ) ;
5073+ }
49745074
49755075 internal protected override Task < ImmutableArray < FilePath > > OnGetAnalyzerFiles ( ProgressMonitor monitor , ConfigurationSelector configuration )
49765076 {
49775077 return Project . OnGetAnalyzerFiles ( monitor , configuration ) ;
49785078 }
49795079
5080+ internal protected override Task < ImmutableArray < FilePath > > OnGetEditorConfigFiles ( ProgressMonitor monitor , ConfigurationSelector configuration )
5081+ {
5082+ return Project . OnGetEditorConfigFiles ( monitor , configuration ) ;
5083+ }
5084+
49805085 internal protected override Task < ImmutableArray < ProjectFile > > OnGetSourceFiles ( ProgressMonitor monitor , ConfigurationSelector configuration )
49815086 {
49825087 return Project . OnGetSourceFiles ( monitor , configuration ) ;
0 commit comments